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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 782723002: Refactor part of CompositorImpl::SetVisible() into its own method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 6 years 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 | « content/browser/renderer_host/compositor_impl_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index ed4de23ca992f1936e0b39f329a463fe73535455..b4c72a0077a0519a33d80f93afcd0cf50ba991ae 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -389,6 +389,44 @@ void CompositorImpl::SetSurface(jobject surface) {
}
}
+void CompositorImpl::CreateLayerTreeHost() {
+ DCHECK(!host_);
+ DCHECK(!WillCompositeThisFrame());
+ needs_composite_ = false;
+ defer_composite_for_gpu_channel_ = false;
+ pending_swapbuffers_ = 0;
+ cc::LayerTreeSettings settings;
+ settings.renderer_settings.refresh_rate = 60.0;
+ settings.renderer_settings.allow_antialiasing = false;
+ settings.renderer_settings.highp_threshold_min = 2048;
+ settings.impl_side_painting = false;
+ settings.calculate_top_controls_position = false;
+
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ settings.initial_debug_state.SetRecordRenderingStats(
+ command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking));
+ settings.initial_debug_state.show_fps_counter =
+ command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
+ // TODO(enne): Update this this compositor to use the scheduler.
+ settings.single_thread_proxy_scheduler = false;
+
+ host_ = cc::LayerTreeHost::CreateSingleThreaded(
+ this,
+ this,
+ HostSharedBitmapManager::current(),
+ BrowserGpuMemoryBufferManager::current(),
+ settings,
+ base::MessageLoopProxy::current(),
+ nullptr);
+ host_->SetRootLayer(root_layer_);
+
+ host_->SetVisible(true);
+ host_->SetLayerTreeHostClientReady();
+ host_->SetViewportSize(size_);
+ host_->set_has_transparent_background(has_transparent_background_);
+ host_->SetDeviceScaleFactor(device_scale_factor_);
+}
+
void CompositorImpl::SetVisible(bool visible) {
if (!visible) {
DCHECK(host_);
@@ -416,40 +454,7 @@ void CompositorImpl::SetVisible(bool visible) {
current_composite_task_.reset();
}
} else if (!host_) {
- DCHECK(!WillCompositeThisFrame());
- needs_composite_ = false;
- defer_composite_for_gpu_channel_ = false;
- pending_swapbuffers_ = 0;
- cc::LayerTreeSettings settings;
- settings.renderer_settings.refresh_rate = 60.0;
- settings.renderer_settings.allow_antialiasing = false;
- settings.renderer_settings.highp_threshold_min = 2048;
- settings.impl_side_painting = false;
- settings.calculate_top_controls_position = false;
-
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- settings.initial_debug_state.SetRecordRenderingStats(
- command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking));
- settings.initial_debug_state.show_fps_counter =
- command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
- // TODO(enne): Update this this compositor to use the scheduler.
- settings.single_thread_proxy_scheduler = false;
-
- host_ = cc::LayerTreeHost::CreateSingleThreaded(
- this,
- this,
- HostSharedBitmapManager::current(),
- BrowserGpuMemoryBufferManager::current(),
- settings,
- base::MessageLoopProxy::current(),
- nullptr);
- host_->SetRootLayer(root_layer_);
-
- host_->SetVisible(true);
- host_->SetLayerTreeHostClientReady();
- host_->SetViewportSize(size_);
- host_->set_has_transparent_background(has_transparent_background_);
- host_->SetDeviceScaleFactor(device_scale_factor_);
+ CreateLayerTreeHost();
ui_resource_provider_.SetLayerTreeHost(host_.get());
}
}
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698