Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: cc/test/push_properties_counting_layer.cc

Issue 2456093003: Enable more layer_tree_host_unittest for LayerTreeHostRemote. (Closed)
Patch Set: Minor polish on refactored test class. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/push_properties_counting_layer.h ('k') | cc/test/push_properties_counting_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/push_properties_counting_layer.cc
diff --git a/cc/test/push_properties_counting_layer.cc b/cc/test/push_properties_counting_layer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cb0bf3cbe3be1b712187cf1a3e5bd89bec0792e4
--- /dev/null
+++ b/cc/test/push_properties_counting_layer.cc
@@ -0,0 +1,57 @@
+// Copyright 2016 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 "cc/test/push_properties_counting_layer.h"
+
+#include "cc/test/push_properties_counting_layer_impl.h"
+
+namespace cc {
+
+// static
+scoped_refptr<PushPropertiesCountingLayer>
+PushPropertiesCountingLayer::Create() {
+ return new PushPropertiesCountingLayer();
+}
+
+PushPropertiesCountingLayer::PushPropertiesCountingLayer()
+ : push_properties_count_(0), persist_needs_push_properties_(false) {
+ SetBounds(gfx::Size(1, 1));
+}
+
+PushPropertiesCountingLayer::~PushPropertiesCountingLayer() = default;
+
+void PushPropertiesCountingLayer::PushPropertiesTo(LayerImpl* layer) {
+ Layer::PushPropertiesTo(layer);
+ AddPushPropertiesCount();
+}
+
+std::unique_ptr<LayerImpl> PushPropertiesCountingLayer::CreateLayerImpl(
+ LayerTreeImpl* tree_impl) {
+ return PushPropertiesCountingLayerImpl::Create(tree_impl, Layer::id());
+}
+
+void PushPropertiesCountingLayer::ToLayerPropertiesProto(
+ proto::LayerUpdate* layer_update,
+ bool inputs_only) {
+ Layer::ToLayerPropertiesProto(layer_update, inputs_only);
+ AddPushPropertiesCount();
+}
+
+void PushPropertiesCountingLayer::SetTypeForProtoSerialization(
+ proto::LayerNode* proto) const {
+ proto->set_type(proto::LayerNode::PUSH_PROPERTIES_COUNTING_LAYER);
+}
+
+void PushPropertiesCountingLayer::MakePushProperties() {
+ SetContentsOpaque(!contents_opaque());
+}
+
+void PushPropertiesCountingLayer::AddPushPropertiesCount() {
+ push_properties_count_++;
+ if (persist_needs_push_properties_) {
+ GetLayerTree()->AddLayerShouldPushProperties(this);
+ }
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/push_properties_counting_layer.h ('k') | cc/test/push_properties_counting_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698