summaryrefslogtreecommitdiffstats
path: root/chromium/ppapi/shared_impl/compositor_layer_data.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ppapi/shared_impl/compositor_layer_data.cc')
-rw-r--r--chromium/ppapi/shared_impl/compositor_layer_data.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/chromium/ppapi/shared_impl/compositor_layer_data.cc b/chromium/ppapi/shared_impl/compositor_layer_data.cc
new file mode 100644
index 00000000000..a4b51d379c9
--- /dev/null
+++ b/chromium/ppapi/shared_impl/compositor_layer_data.cc
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/compositor_layer_data.h"
+
+namespace ppapi {
+
+namespace {
+
+template<typename T>
+void Copy(scoped_ptr<T>* a, const scoped_ptr<T>& b) {
+ if (b) {
+ if (!(*a))
+ a->reset(new T());
+ **a = *b;
+ } else {
+ a->reset();
+ }
+}
+
+} // namespace
+
+const CompositorLayerData& CompositorLayerData::operator=(
+ const CompositorLayerData& other) {
+ DCHECK(other.is_null() || other.is_valid());
+
+ common = other.common;
+ Copy(&color, other.color);
+ Copy(&texture, other.texture);
+ Copy(&image, other.image);
+
+ return *this;
+}
+
+} // namespace ppapi