diff options
Diffstat (limited to 'cc')
-rw-r--r-- | cc/BUILD.gn | 1 | ||||
-rw-r--r-- | cc/cc_tests.gyp | 1 | ||||
-rw-r--r-- | cc/layers/picture_layer.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 9 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_no_message_loop.cc | 249 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.cc | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.h | 1 |
8 files changed, 4 insertions, 263 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index 3524e73..64bf8e9 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn @@ -833,7 +833,6 @@ test("cc_unittests") { "trees/layer_tree_host_unittest_copyrequest.cc", "trees/layer_tree_host_unittest_damage.cc", "trees/layer_tree_host_unittest_delegated.cc", - "trees/layer_tree_host_unittest_no_message_loop.cc", "trees/layer_tree_host_unittest_occlusion.cc", "trees/layer_tree_host_unittest_picture.cc", "trees/layer_tree_host_unittest_proxy.cc", diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 2da5544..169de6b 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -126,7 +126,6 @@ 'trees/layer_tree_host_unittest_copyrequest.cc', 'trees/layer_tree_host_unittest_damage.cc', 'trees/layer_tree_host_unittest_delegated.cc', - 'trees/layer_tree_host_unittest_no_message_loop.cc', 'trees/layer_tree_host_unittest_occlusion.cc', 'trees/layer_tree_host_unittest_picture.cc', 'trees/layer_tree_host_unittest_proxy.cc', diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index f746836..028cbbe 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -102,8 +102,6 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { recording_source_->SetSlowdownRasterScaleFactor( host->debug_state().slow_down_raster_scale_factor); recording_source_->SetGatherPixelRefs(settings.gather_pixel_refs); - - DCHECK(settings.raster_enabled); } void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 2ef7bef..c92cb44 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1035,7 +1035,7 @@ DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) { // This will cause NotifyTileStateChanged() to be called for any visible tiles // that completed, which will add damage to the frame for them so they appear // as part of the current frame being drawn. - if (tile_manager_) + if (settings_.impl_side_painting) tile_manager_->UpdateVisibleTiles(global_tile_state_); frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); @@ -1527,7 +1527,7 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame) { !output_surface_->context_provider()); rendering_stats_instrumentation_->IncrementFrameCount(1); - if (tile_manager_) { + if (settings_.impl_side_painting) { memory_history_->SaveEntry( tile_manager_->memory_stats_from_last_assign()); } @@ -1827,8 +1827,7 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() { void LayerTreeHostImpl::SynchronouslyInitializeAllTiles() { // Only valid for the single-threaded non-scheduled/synchronous case // using the zero copy raster worker pool. - if (tile_manager_) - single_thread_synchronous_task_graph_runner_->RunUntilIdle(); + single_thread_synchronous_task_graph_runner_->RunUntilIdle(); } void LayerTreeHostImpl::DidLoseOutputSurface() { @@ -2270,7 +2269,7 @@ bool LayerTreeHostImpl::InitializeRenderer( // Since the new renderer may be capable of MSAA, update status here. UpdateGpuRasterizationStatus(); - if (settings_.impl_side_painting && settings_.raster_enabled) + if (settings_.impl_side_painting) CreateAndSetTileManager(); RecreateTreeResources(); diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 6551255..bce1a81 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -655,9 +655,6 @@ class CC_EXPORT LayerTreeHostImpl scoped_ptr<OutputSurface> output_surface_; - // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- - // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). - // |tile_manager_| can also be NULL when raster_enabled is false. scoped_ptr<ResourceProvider> resource_provider_; scoped_ptr<TileManager> tile_manager_; bool content_is_suitable_for_gpu_rasterization_; diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc deleted file mode 100644 index cd13240..0000000 --- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc +++ /dev/null @@ -1,249 +0,0 @@ -// 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 "base/thread_task_runner_handle.h" -#include "base/threading/simple_thread.h" -#include "cc/layers/delegated_frame_provider.h" -#include "cc/layers/delegated_frame_resource_collection.h" -#include "cc/layers/delegated_renderer_layer.h" -#include "cc/layers/layer.h" -#include "cc/layers/solid_color_layer.h" -#include "cc/output/delegated_frame_data.h" -#include "cc/output/output_surface.h" -#include "cc/output/output_surface_client.h" -#include "cc/resources/resource_provider.h" -#include "cc/scheduler/begin_frame_source.h" -#include "cc/test/fake_delegated_renderer_layer.h" -#include "cc/test/test_context_provider.h" -#include "cc/trees/layer_tree_host.h" -#include "cc/trees/layer_tree_host_client.h" -#include "cc/trees/layer_tree_host_single_thread_client.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkColor.h" - -namespace cc { -namespace { - -class NoMessageLoopOutputSurface : public OutputSurface { - public: - NoMessageLoopOutputSurface() : OutputSurface(TestContextProvider::Create()) {} - ~NoMessageLoopOutputSurface() override {} - - // OutputSurface overrides. - void SwapBuffers(CompositorFrame* frame) override { - DCHECK(client_); - client_->DidSwapBuffers(); - client_->DidSwapBuffersComplete(); - } -}; - -class LayerTreeHostNoMessageLoopTest - : public testing::Test, - public base::DelegateSimpleThread::Delegate, - public LayerTreeHostClient, - public LayerTreeHostSingleThreadClient { - public: - LayerTreeHostNoMessageLoopTest() - : did_initialize_output_surface_(false), - did_commit_(false), - did_commit_and_draw_frame_(false), - size_(100, 100), - no_loop_thread_(this, "LayerTreeHostNoMessageLoopTest") {} - ~LayerTreeHostNoMessageLoopTest() override {} - - // LayerTreeHostClient overrides. - void WillBeginMainFrame() override {} - void BeginMainFrame(const BeginFrameArgs& args) override {} - void BeginMainFrameNotExpectedSoon() override {} - void DidBeginMainFrame() override {} - void Layout() override {} - void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, - const gfx::Vector2dF& outer_delta, - const gfx::Vector2dF& elastic_overscroll_delta, - float page_scale, - float top_controls_delta) override {} - void RequestNewOutputSurface() override { - layer_tree_host_->SetOutputSurface( - make_scoped_ptr<OutputSurface>(new NoMessageLoopOutputSurface)); - } - void DidInitializeOutputSurface() override { - did_initialize_output_surface_ = true; - } - void DidFailToInitializeOutputSurface() override {} - void WillCommit() override {} - void DidCommit() override { did_commit_ = true; } - void DidCommitAndDrawFrame() override { did_commit_and_draw_frame_ = true; } - void DidCompleteSwapBuffers() override {} - void DidCompletePageScaleAnimation() override {} - void RecordFrameTimingEvents( - scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, - scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) - override {} - - // LayerTreeHostSingleThreadClient overrides. - void DidPostSwapBuffers() override {} - void DidAbortSwapBuffers() override {} - - void RunTest() { - no_loop_thread_.Start(); - no_loop_thread_.Join(); - } - - // base::DelegateSimpleThread::Delegate override. - void Run() override { - ASSERT_FALSE(base::ThreadTaskRunnerHandle::IsSet()); - RunTestWithoutMessageLoop(); - EXPECT_FALSE(base::ThreadTaskRunnerHandle::IsSet()); - } - - protected: - virtual void RunTestWithoutMessageLoop() = 0; - - void SetupLayerTreeHost() { - LayerTreeSettings settings; - settings.single_thread_proxy_scheduler = false; - settings.verify_property_trees = false; - settings.raster_enabled = false; - - LayerTreeHost::InitParams params; - params.client = this; - params.settings = &settings; - layer_tree_host_ = LayerTreeHost::CreateSingleThreaded(this, ¶ms); - layer_tree_host_->SetViewportSize(size_); - layer_tree_host_->SetRootLayer(root_layer_); - } - - void Composite() { - did_commit_ = false; - did_commit_and_draw_frame_ = false; - layer_tree_host_->Composite(base::TimeTicks::Now()); - EXPECT_TRUE(did_initialize_output_surface_); - EXPECT_TRUE(did_commit_); - EXPECT_TRUE(did_commit_and_draw_frame_); - } - - void TearDownLayerTreeHost() { - // Explicit teardown to make failures easier to debug. - layer_tree_host_ = nullptr; - root_layer_ = nullptr; - } - - // All protected member variables are accessed only on |no_loop_thread_|. - scoped_ptr<LayerTreeHost> layer_tree_host_; - scoped_refptr<Layer> root_layer_; - - bool did_initialize_output_surface_; - bool did_commit_; - bool did_commit_and_draw_frame_; - gfx::Size size_; - - private: - base::DelegateSimpleThread no_loop_thread_; -}; - -class LayerTreeHostNoMessageLoopSmokeTest - : public LayerTreeHostNoMessageLoopTest { - protected: - void RunTestWithoutMessageLoop() override { - gfx::Size size(100, 100); - - // Set up root layer. - { - scoped_refptr<SolidColorLayer> solid_color_layer = - SolidColorLayer::Create(LayerSettings()); - solid_color_layer->SetBackgroundColor(SK_ColorRED); - solid_color_layer->SetBounds(size_); - solid_color_layer->SetIsDrawable(true); - root_layer_ = solid_color_layer; - } - - SetupLayerTreeHost(); - Composite(); - TearDownLayerTreeHost(); - } -}; - -TEST_F(LayerTreeHostNoMessageLoopSmokeTest, SmokeTest) { - RunTest(); -} - -class LayerTreeHostNoMessageLoopDelegatedLayer - : public LayerTreeHostNoMessageLoopTest, - public DelegatedFrameResourceCollectionClient { - protected: - void RunTestWithoutMessageLoop() override { - resource_collection_ = new DelegatedFrameResourceCollection; - frame_provider_ = new DelegatedFrameProvider( - resource_collection_.get(), CreateFrameDataWithResource(998)); - - LayerSettings layer_settings; - root_layer_ = Layer::Create(layer_settings); - delegated_layer_ = FakeDelegatedRendererLayer::Create( - layer_settings, frame_provider_.get()); - delegated_layer_->SetBounds(size_); - delegated_layer_->SetIsDrawable(true); - root_layer_->AddChild(delegated_layer_); - - SetupLayerTreeHost(); - - // Draw first frame. - Composite(); - - // Prepare and draw second frame. - frame_provider_->SetFrameData(CreateFrameDataWithResource(999)); - Composite(); - - // Resource from first frame should be returned. - CheckReturnedResource(1u); - - TearDownLayerTreeHost(); - delegated_layer_ = NULL; - frame_provider_ = NULL; - - // Resource from second frame should be returned. - CheckReturnedResource(1u); - resource_collection_ = NULL; - } - - // DelegatedFrameResourceCollectionClient overrides. - void UnusedResourcesAreAvailable() override {} - - private: - scoped_ptr<DelegatedFrameData> CreateFrameDataWithResource( - ResourceId resource_id) { - scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); - gfx::Rect frame_rect(size_); - - scoped_ptr<RenderPass> root_pass(RenderPass::Create()); - root_pass->SetNew( - RenderPassId(1, 1), frame_rect, frame_rect, gfx::Transform()); - frame->render_pass_list.push_back(root_pass.Pass()); - - TransferableResource resource; - resource.id = resource_id; - resource.mailbox_holder.texture_target = GL_TEXTURE_2D; - resource.mailbox_holder.mailbox = gpu::Mailbox::Generate(); - frame->resource_list.push_back(resource); - - return frame.Pass(); - } - - void CheckReturnedResource(size_t expected_num) { - ReturnedResourceArray returned_resources; - resource_collection_->TakeUnusedResourcesForChildCompositor( - &returned_resources); - EXPECT_EQ(expected_num, returned_resources.size()); - } - - scoped_refptr<DelegatedFrameResourceCollection> resource_collection_; - scoped_refptr<DelegatedFrameProvider> frame_provider_; - scoped_refptr<DelegatedRendererLayer> delegated_layer_; -}; - -TEST_F(LayerTreeHostNoMessageLoopDelegatedLayer, SingleDelegatedLayer) { - RunTest(); -} - -} // namespace -} // namespace cc diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index 1043f1e..5b82456 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -21,7 +21,6 @@ LayerSettings::~LayerSettings() { LayerTreeSettings::LayerTreeSettings() : impl_side_painting(false), - raster_enabled(true), single_thread_proxy_scheduler(true), use_external_begin_frame_source(false), main_frame_before_activation_enabled(false), diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 36ace43..2d47aef 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -30,7 +30,6 @@ class CC_EXPORT LayerTreeSettings { RendererSettings renderer_settings; bool impl_side_painting; - bool raster_enabled; bool single_thread_proxy_scheduler; bool use_external_begin_frame_source; bool main_frame_before_activation_enabled; |