summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorenne <enne@chromium.org>2015-03-09 23:01:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-10 06:02:31 +0000
commitbdb6fd2037025923c986d1e3552cf9f99a634554 (patch)
treef75d434f8b3f8c4c5cf5c914226f3f149e85561f /cc
parent843e610b00b629e45ec132bb4877dc217d8ae7bd (diff)
downloadchromium_src-bdb6fd2037025923c986d1e3552cf9f99a634554.zip
chromium_src-bdb6fd2037025923c986d1e3552cf9f99a634554.tar.gz
chromium_src-bdb6fd2037025923c986d1e3552cf9f99a634554.tar.bz2
cc: Add raster_enabled setting
In order to support impl-side painting plus an embedder without a message loop, cc needs a setting to disable raster. Rastering with impl-side painting requires a task runner (and DCHECKs this). This setting notifies cc that there's no need for a tile manager. Thankfully, tile manager is already considered optional in almost all contexts, and so just a few more callsites needed to be cleaned up to fix a few crashes. With this patch, all cc unittests pass with impl-side painting on by default. Review URL: https://codereview.chromium.org/984113004 Cr-Commit-Position: refs/heads/master@{#319840}
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer.cc27
-rw-r--r--cc/trees/layer_tree_host_impl.cc7
-rw-r--r--cc/trees/layer_tree_host_impl.h1
-rw-r--r--cc/trees/layer_tree_host_unittest_no_message_loop.cc1
-rw-r--r--cc/trees/layer_tree_settings.cc1
-rw-r--r--cc/trees/layer_tree_settings.h1
6 files changed, 23 insertions, 15 deletions
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 1cfe1f1..80d36d8 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -79,20 +79,23 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
Layer::SetLayerTreeHost(host);
- if (host) {
- if (!recording_source_) {
- if (host->settings().use_display_lists) {
- recording_source_.reset(new DisplayListRecordingSource);
- } else {
- recording_source_.reset(
- new PicturePile(host->settings().minimum_contents_scale,
- host->settings().default_tile_grid_size));
- }
+ if (!host)
+ return;
+
+ if (!recording_source_) {
+ if (host->settings().use_display_lists) {
+ recording_source_.reset(new DisplayListRecordingSource);
+ } else {
+ recording_source_.reset(
+ new PicturePile(host->settings().minimum_contents_scale,
+ host->settings().default_tile_grid_size));
}
- recording_source_->DidMoveToNewCompositor();
- recording_source_->SetSlowdownRasterScaleFactor(
- host->debug_state().slow_down_raster_scale_factor);
}
+ recording_source_->DidMoveToNewCompositor();
+ recording_source_->SetSlowdownRasterScaleFactor(
+ host->debug_state().slow_down_raster_scale_factor);
+
+ DCHECK(host->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 a5cdc02..0bd757d 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1055,7 +1055,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 (settings().impl_side_painting)
+ if (tile_manager_)
tile_manager_->UpdateVisibleTiles(global_tile_state_);
frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList();
@@ -1705,7 +1705,8 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() {
void LayerTreeHostImpl::SynchronouslyInitializeAllTiles() {
// Only valid for the single-threaded non-scheduled/synchronous case
// using the zero copy raster worker pool.
- single_thread_synchronous_task_graph_runner_->RunUntilIdle();
+ if (tile_manager_)
+ single_thread_synchronous_task_graph_runner_->RunUntilIdle();
}
void LayerTreeHostImpl::DidLoseOutputSurface() {
@@ -2136,7 +2137,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
CreateAndSetRenderer();
- if (settings_.impl_side_painting)
+ if (settings_.impl_side_painting && settings_.raster_enabled)
CreateAndSetTileManager();
RecreateTreeResources();
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index f666f0e..0be16b0 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -610,6 +610,7 @@ class CC_EXPORT LayerTreeHostImpl
// |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 use_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
index 06b3674..622143d 100644
--- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc
+++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
@@ -104,6 +104,7 @@ class LayerTreeHostNoMessageLoopTest
LayerTreeSettings settings;
settings.single_thread_proxy_scheduler = false;
settings.verify_property_trees = true;
+ settings.raster_enabled = false;
layer_tree_host_ = LayerTreeHost::CreateSingleThreaded(
this, this, nullptr, nullptr, settings, nullptr, nullptr);
layer_tree_host_->SetViewportSize(size_);
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index 0088e91..213ad28 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -15,6 +15,7 @@ namespace cc {
LayerTreeSettings::LayerTreeSettings()
: impl_side_painting(false),
+ raster_enabled(true),
throttle_frame_production(true),
single_thread_proxy_scheduler(true),
use_external_begin_frame_source(false),
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index ce8d856..373f704 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -21,6 +21,7 @@ class CC_EXPORT LayerTreeSettings {
RendererSettings renderer_settings;
bool impl_side_painting;
+ bool raster_enabled;
bool throttle_frame_production;
bool single_thread_proxy_scheduler;
bool use_external_begin_frame_source;