summaryrefslogtreecommitdiffstats
path: root/cc/blink
diff options
context:
space:
mode:
authorvollick <vollick@chromium.org>2016-01-22 11:13:29 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-22 19:15:16 +0000
commitfd6e4f4a7a3f166de9d2fbc89770b4f2eb90272f (patch)
tree1f8fca4ee6c31d1247fe57532f1abfba3a0a3f52 /cc/blink
parent3537f56b3e87d722b1e7caa3d996874f3199f750 (diff)
downloadchromium_src-fd6e4f4a7a3f166de9d2fbc89770b4f2eb90272f.zip
chromium_src-fd6e4f4a7a3f166de9d2fbc89770b4f2eb90272f.tar.gz
chromium_src-fd6e4f4a7a3f166de9d2fbc89770b4f2eb90272f.tar.bz2
compositor-worker: Remove code from cc_blink
In this CL, the compositor worker code in cc_blink has been removed, mostly by moving it into Source/platform/graphics, a more natural home for compositor-related stuff. An additional benefit is that much of the code in public/platform/ is unnecessary now. It was there only so that it could be implemented by classes in cc_blink. There was a wrinkle when moving the test: the cc test machinery expected a base::MessageLoop to have been constructed to work. This violated the current DEPS rules for platform/graphics. I did try to remove this dependency, but the code is quite coupled and the refactor was not only large, it resulted in more complex code in cc. Since platform is in general allowed to talk to base, it seemed more reasonable to update the DEPS in platform/graphics/ to allow the use of message_loop.h in tests. BUG=430155 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1599673002 Cr-Commit-Position: refs/heads/master@{#371006}
Diffstat (limited to 'cc/blink')
-rw-r--r--cc/blink/BUILD.gn5
-rw-r--r--cc/blink/cc_blink.gyp4
-rw-r--r--cc/blink/cc_blink_tests.gyp1
-rw-r--r--cc/blink/web_compositor_mutable_state_impl.cc72
-rw-r--r--cc/blink/web_compositor_mutable_state_impl.h46
-rw-r--r--cc/blink/web_compositor_mutable_state_impl_unittest.cc172
-rw-r--r--cc/blink/web_compositor_mutable_state_provider_impl.cc34
-rw-r--r--cc/blink/web_compositor_mutable_state_provider_impl.h44
-rw-r--r--cc/blink/web_layer_impl.cc31
9 files changed, 0 insertions, 409 deletions
diff --git a/cc/blink/BUILD.gn b/cc/blink/BUILD.gn
index cbdeef8..93915b0 100644
--- a/cc/blink/BUILD.gn
+++ b/cc/blink/BUILD.gn
@@ -21,10 +21,6 @@ component("blink") {
"web_compositor_animation_player_impl.h",
"web_compositor_animation_timeline_impl.cc",
"web_compositor_animation_timeline_impl.h",
- "web_compositor_mutable_state_impl.cc",
- "web_compositor_mutable_state_impl.h",
- "web_compositor_mutable_state_provider_impl.cc",
- "web_compositor_mutable_state_provider_impl.h",
"web_compositor_support_impl.cc",
"web_compositor_support_impl.h",
"web_content_layer_impl.cc",
@@ -83,7 +79,6 @@ if (!is_mac) {
sources = [
"web_animation_unittest.cc",
"web_compositor_animation_player_unittest.cc",
- "web_compositor_mutable_state_impl_unittest.cc",
"web_float_animation_curve_unittest.cc",
"web_layer_impl_fixed_bounds_unittest.cc",
diff --git a/cc/blink/cc_blink.gyp b/cc/blink/cc_blink.gyp
index 995af72..dc01cae 100644
--- a/cc/blink/cc_blink.gyp
+++ b/cc/blink/cc_blink.gyp
@@ -37,10 +37,6 @@
'web_compositor_animation_player_impl.h',
'web_compositor_animation_timeline_impl.cc',
'web_compositor_animation_timeline_impl.h',
- 'web_compositor_mutable_state_impl.cc',
- 'web_compositor_mutable_state_impl.h',
- 'web_compositor_mutable_state_provider_impl.cc',
- 'web_compositor_mutable_state_provider_impl.h',
'web_compositor_support_impl.cc',
'web_compositor_support_impl.h',
'web_content_layer_impl.cc',
diff --git a/cc/blink/cc_blink_tests.gyp b/cc/blink/cc_blink_tests.gyp
index edcd118..f72a5db 100644
--- a/cc/blink/cc_blink_tests.gyp
+++ b/cc/blink/cc_blink_tests.gyp
@@ -28,7 +28,6 @@
'web_compositor_animation_player_unittest.cc',
'web_float_animation_curve_unittest.cc',
'web_layer_impl_fixed_bounds_unittest.cc',
- 'web_compositor_mutable_state_impl_unittest.cc',
],
}
],
diff --git a/cc/blink/web_compositor_mutable_state_impl.cc b/cc/blink/web_compositor_mutable_state_impl.cc
deleted file mode 100644
index b0421e8..0000000
--- a/cc/blink/web_compositor_mutable_state_impl.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 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/blink/web_compositor_mutable_state_impl.h"
-
-#include "cc/animation/layer_tree_mutation.h"
-#include "cc/layers/layer_impl.h"
-#include "cc/trees/layer_tree_impl.h"
-
-namespace cc_blink {
-
-WebCompositorMutableStateImpl::WebCompositorMutableStateImpl(
- cc::LayerTreeMutation* mutation,
- cc::LayerImpl* main_layer,
- cc::LayerImpl* scroll_layer)
- : mutation_(mutation),
- main_layer_(main_layer),
- scroll_layer_(scroll_layer) {}
-
-WebCompositorMutableStateImpl::~WebCompositorMutableStateImpl() {}
-
-double WebCompositorMutableStateImpl::opacity() const {
- return main_layer_->opacity();
-}
-
-void WebCompositorMutableStateImpl::setOpacity(double opacity) {
- if (!main_layer_)
- return;
- main_layer_->OnOpacityAnimated(opacity);
- mutation_->SetOpacity(opacity);
-}
-
-const SkMatrix44& WebCompositorMutableStateImpl::transform() const {
- static SkMatrix44 identity;
- return main_layer_ ? main_layer_->transform().matrix() : identity;
-}
-
-void WebCompositorMutableStateImpl::setTransform(const SkMatrix44& matrix) {
- if (!main_layer_)
- return;
- main_layer_->OnTransformAnimated(gfx::Transform(matrix));
- mutation_->SetTransform(matrix);
-}
-
-double WebCompositorMutableStateImpl::scrollLeft() const {
- return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().x() : 0.0;
-}
-
-void WebCompositorMutableStateImpl::setScrollLeft(double scroll_left) {
- if (!scroll_layer_)
- return;
- gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset();
- offset.set_x(scroll_left);
- scroll_layer_->OnScrollOffsetAnimated(offset);
- mutation_->SetScrollLeft(scroll_left);
-}
-
-double WebCompositorMutableStateImpl::scrollTop() const {
- return scroll_layer_ ? scroll_layer_->CurrentScrollOffset().y() : 0.0;
-}
-
-void WebCompositorMutableStateImpl::setScrollTop(double scroll_top) {
- if (!scroll_layer_)
- return;
- gfx::ScrollOffset offset = scroll_layer_->CurrentScrollOffset();
- offset.set_y(scroll_top);
- scroll_layer_->OnScrollOffsetAnimated(offset);
- mutation_->SetScrollTop(scroll_top);
-}
-
-} // namespace cc_blink
diff --git a/cc/blink/web_compositor_mutable_state_impl.h b/cc/blink/web_compositor_mutable_state_impl.h
deleted file mode 100644
index b052eca..0000000
--- a/cc/blink/web_compositor_mutable_state_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_
-#define CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_
-
-#include "cc/blink/cc_blink_export.h"
-
-#include "third_party/WebKit/public/platform/WebCompositorMutableState.h"
-
-namespace cc {
-class LayerImpl;
-class LayerTreeMutation;
-}
-
-namespace cc_blink {
-
-class WebCompositorMutableStateImpl : public blink::WebCompositorMutableState {
- public:
- WebCompositorMutableStateImpl(cc::LayerTreeMutation* mutation,
- cc::LayerImpl* main_layer,
- cc::LayerImpl* scroll_layer);
- ~WebCompositorMutableStateImpl() override;
-
- double opacity() const override;
- void setOpacity(double opacity) override;
-
- const SkMatrix44& transform() const override;
- void setTransform(const SkMatrix44& transform) override;
-
- double scrollLeft() const override;
- void setScrollLeft(double scroll_left) override;
-
- double scrollTop() const override;
- void setScrollTop(double scroll_top) override;
-
- private:
- cc::LayerTreeMutation* mutation_;
- cc::LayerImpl* main_layer_;
- cc::LayerImpl* scroll_layer_;
-};
-
-} // namespace cc_blink
-
-#endif // CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_IMPL_H_
diff --git a/cc/blink/web_compositor_mutable_state_impl_unittest.cc b/cc/blink/web_compositor_mutable_state_impl_unittest.cc
deleted file mode 100644
index d2dc7df..0000000
--- a/cc/blink/web_compositor_mutable_state_impl_unittest.cc
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright 2015 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/blink/web_compositor_mutable_state_impl.h"
-
-#include "cc/animation/layer_tree_mutation.h"
-#include "cc/blink/web_compositor_mutable_state_provider_impl.h"
-#include "cc/test/fake_impl_task_runner_provider.h"
-#include "cc/test/fake_layer_tree_host_impl.h"
-#include "cc/test/fake_output_surface.h"
-#include "cc/test/layer_tree_host_common_test.h"
-#include "cc/test/test_shared_bitmap_manager.h"
-#include "cc/test/test_task_graph_runner.h"
-#include "cc/trees/layer_tree_host_impl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc_blink {
-namespace {
-
-using cc::FakeImplTaskRunnerProvider;
-using cc::FakeLayerTreeHostImpl;
-using cc::FakeOutputSurface;
-using cc::LayerImpl;
-using cc::LayerImplList;
-using cc::LayerTreeHostCommonTest;
-using cc::LayerTreeMutation;
-using cc::LayerTreeMutationMap;
-using cc::LayerTreeSettings;
-using cc::OutputSurface;
-using cc::TestTaskGraphRunner;
-using cc::TestSharedBitmapManager;
-
-using blink::WebCompositorMutableState;
-
-class WebCompositorMutableStateTest : public LayerTreeHostCommonTest {
- public:
- WebCompositorMutableStateTest()
- : output_surface_(FakeOutputSurface::Create3d()) {
- LayerTreeSettings settings;
- settings.layer_transforms_should_scale_layer_contents = true;
- settings.verify_property_trees = true;
- host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
- &shared_bitmap_manager_,
- &task_graph_runner_));
- host_impl_->SetVisible(true);
- EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
- }
-
- FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
-
- LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); }
-
- private:
- TestSharedBitmapManager shared_bitmap_manager_;
- TestTaskGraphRunner task_graph_runner_;
- FakeImplTaskRunnerProvider task_runner_provider_;
- scoped_ptr<OutputSurface> output_surface_;
- scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
-};
-
-TEST_F(WebCompositorMutableStateTest, NoMutableState) {
- // In this test, there are no layers with either an element id or mutable
- // properties. We should not be able to get any mutable state.
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42);
-
- gfx::Transform identity_matrix;
- gfx::Point3F transform_origin;
- gfx::PointF position;
- gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
- position, bounds, true, false, true);
- root->SetDrawsContent(true);
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(std::move(root));
- host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
-
- LayerTreeMutationMap mutations;
- WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(),
- &mutations);
- scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42));
- EXPECT_FALSE(state);
-}
-
-TEST_F(WebCompositorMutableStateTest, MutableStateNoMutableProperties) {
- // In this test, there is a layer with an element id, but no mutable
- // properties. This should behave just as if we'd had no element id.
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42);
-
- gfx::Transform identity_matrix;
- gfx::Point3F transform_origin;
- gfx::PointF position;
- gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
- position, bounds, true, false, true);
- root->SetDrawsContent(true);
- root->SetElementId(42);
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(std::move(root));
- host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
-
- LayerTreeMutationMap mutations;
- WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(),
- &mutations);
- scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42));
- EXPECT_FALSE(state);
-}
-
-TEST_F(WebCompositorMutableStateTest, MutableStateMutableProperties) {
- // In this test, there is a layer with an element id and mutable properties.
- // In this case, we should get a valid mutable state for this element id that
- // has a real effect on the corresponding layer.
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 42);
-
- gfx::Transform identity_matrix;
- gfx::Point3F transform_origin;
- gfx::PointF position;
- gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
- position, bounds, true, false, true);
- root->SetDrawsContent(true);
- root->SetElementId(42);
- root->SetMutableProperties(
- cc::kMutablePropertyOpacity | cc::kMutablePropertyTransform |
- cc::kMutablePropertyScrollLeft | cc::kMutablePropertyScrollTop);
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(std::move(root));
- host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
-
- LayerTreeMutationMap mutations;
- WebCompositorMutableStateProviderImpl provider(host_impl().active_tree(),
- &mutations);
-
- scoped_ptr<WebCompositorMutableState> state(provider.getMutableStateFor(42));
- EXPECT_TRUE(state.get());
-
- EXPECT_EQ(1.0, root_layer()->opacity());
- EXPECT_EQ(identity_matrix.ToString(), root_layer()->transform().ToString());
- EXPECT_EQ(0.0, root_layer()->CurrentScrollOffset().x());
- EXPECT_EQ(0.0, root_layer()->CurrentScrollOffset().y());
-
- gfx::Transform zero(0, 0, 0, 0, 0, 0);
- state->setOpacity(0.5);
- state->setTransform(zero.matrix());
- state->setScrollLeft(1.0);
- state->setScrollTop(1.0);
-
- EXPECT_EQ(0.5, root_layer()->opacity());
- EXPECT_EQ(zero.ToString(), root_layer()->transform().ToString());
- EXPECT_EQ(1.0, root_layer()->CurrentScrollOffset().x());
- EXPECT_EQ(1.0, root_layer()->CurrentScrollOffset().y());
-
- // The corresponding mutation should reflect the changed values.
- EXPECT_EQ(1ul, mutations.size());
-
- const LayerTreeMutation& mutation = mutations[42];
- EXPECT_TRUE(mutation.is_opacity_mutated());
- EXPECT_TRUE(mutation.is_transform_mutated());
- EXPECT_TRUE(mutation.is_scroll_left_mutated());
- EXPECT_TRUE(mutation.is_scroll_top_mutated());
-
- EXPECT_EQ(0.5, mutation.opacity());
- EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString());
- EXPECT_EQ(1.0, mutation.scroll_left());
- EXPECT_EQ(1.0, mutation.scroll_top());
-}
-
-} // namespace
-} // namespace cc_blink
diff --git a/cc/blink/web_compositor_mutable_state_provider_impl.cc b/cc/blink/web_compositor_mutable_state_provider_impl.cc
deleted file mode 100644
index 713a542..0000000
--- a/cc/blink/web_compositor_mutable_state_provider_impl.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 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/blink/web_compositor_mutable_state_provider_impl.h"
-
-#include "cc/blink/web_compositor_mutable_state_impl.h"
-#include "cc/layers/layer_impl.h"
-#include "cc/trees/layer_tree_impl.h"
-
-namespace cc_blink {
-
-WebCompositorMutableStateProviderImpl::WebCompositorMutableStateProviderImpl(
- cc::LayerTreeImpl* state,
- cc::LayerTreeMutationMap* mutations)
- : state_(state), mutations_(mutations) {}
-
-WebCompositorMutableStateProviderImpl::
- ~WebCompositorMutableStateProviderImpl() {}
-
-blink::WebPassOwnPtr<blink::WebCompositorMutableState>
-WebCompositorMutableStateProviderImpl::getMutableStateFor(uint64_t element_id) {
- cc::LayerTreeImpl::ElementLayers layers =
- state_->GetMutableLayers(element_id);
-
- if (!layers.main && !layers.scroll)
- return nullptr;
-
- return blink::adoptWebPtr<blink::WebCompositorMutableState>(
- new WebCompositorMutableStateImpl(&(*mutations_)[element_id], layers.main,
- layers.scroll));
-}
-
-} // namespace cc_blink
diff --git a/cc/blink/web_compositor_mutable_state_provider_impl.h b/cc/blink/web_compositor_mutable_state_provider_impl.h
deleted file mode 100644
index 138103d..0000000
--- a/cc/blink/web_compositor_mutable_state_provider_impl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_
-#define CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_
-
-#include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
-#include "cc/animation/layer_tree_mutation.h"
-#include "cc/blink/cc_blink_export.h"
-
-#include "third_party/WebKit/public/platform/WebCompositorMutableStateProvider.h"
-
-namespace cc {
-class LayerTreeImpl;
-} // namespace cc
-
-namespace cc_blink {
-
-class WebCompositorMutableStateProviderImpl
- : public blink::WebCompositorMutableStateProvider {
- public:
- // TODO(vollick): after slimming paint v2, this will need to operate on
- // property trees, not the layer tree impl.
- //
- // The LayerTreeImpl and the LayerTreeMutationMap are both owned by caller.
- CC_BLINK_EXPORT WebCompositorMutableStateProviderImpl(
- cc::LayerTreeImpl* state,
- cc::LayerTreeMutationMap* mutations);
-
- CC_BLINK_EXPORT ~WebCompositorMutableStateProviderImpl() override;
-
- CC_BLINK_EXPORT blink::WebPassOwnPtr<blink::WebCompositorMutableState>
- getMutableStateFor(uint64_t element_id) override WARN_UNUSED_RESULT;
-
- private:
- cc::LayerTreeImpl* state_;
- cc::LayerTreeMutationMap* mutations_;
-};
-
-} // namespace cc_blink
-
-#endif // CC_BLINK_WEB_COMPOSITOR_MUTABLE_STATE_PROVIDER_IMPL_H_
diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc
index a901b15..992157b 100644
--- a/cc/blink/web_layer_impl.cc
+++ b/cc/blink/web_layer_impl.cc
@@ -16,7 +16,6 @@
#include "base/threading/thread_checker.h"
#include "base/trace_event/trace_event_impl.h"
#include "cc/animation/animation.h"
-#include "cc/animation/mutable_properties.h"
#include "cc/base/region.h"
#include "cc/base/switches.h"
#include "cc/blink/web_animation_impl.h"
@@ -27,7 +26,6 @@
#include "cc/layers/layer_position_constraint.h"
#include "cc/layers/layer_settings.h"
#include "cc/trees/layer_tree_host.h"
-#include "third_party/WebKit/public/platform/WebCompositorMutableProperties.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
#include "third_party/WebKit/public/platform/WebFloatRect.h"
#include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
@@ -563,35 +561,6 @@ uint64_t WebLayerImpl::elementId() const {
return layer_->element_id();
}
-static_assert(
- static_cast<cc::MutableProperty>(blink::WebCompositorMutablePropertyNone) ==
- cc::kMutablePropertyNone,
- "MutableProperty and WebCompositorMutableProperty enums must match");
-
-static_assert(
- static_cast<cc::MutableProperty>(
- blink::WebCompositorMutablePropertyOpacity) ==
- cc::kMutablePropertyOpacity,
- "MutableProperty and WebCompositorMutableProperty enums must match");
-
-static_assert(
- static_cast<cc::MutableProperty>(
- blink::WebCompositorMutablePropertyScrollLeft) ==
- cc::kMutablePropertyScrollLeft,
- "MutableProperty and WebCompositorMutableProperty enums must match");
-
-static_assert(
- static_cast<cc::MutableProperty>(
- blink::WebCompositorMutablePropertyScrollTop) ==
- cc::kMutablePropertyScrollTop,
- "MutableProperty and WebCompositorMutableProperty enums must match");
-
-static_assert(
- static_cast<cc::MutableProperty>(
- blink::WebCompositorMutablePropertyTransform) ==
- cc::kMutablePropertyTransform,
- "MutableProperty and WebCompositorMutableProperty enums must match");
-
void WebLayerImpl::setCompositorMutableProperties(uint32_t properties) {
layer_->SetMutableProperties(properties);
}