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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 85693007: cc: Defer first OutputSurface creation until client is ready (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #if defined(OS_ANDROID) 10 #if defined(OS_ANDROID)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 #elif !defined(OS_MACOSX) 300 #elif !defined(OS_MACOSX)
301 if (cmd->HasSwitch(switches::kEnableOverlayScrollbars)) { 301 if (cmd->HasSwitch(switches::kEnableOverlayScrollbars)) {
302 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; 302 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning;
303 } 303 }
304 if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport) || 304 if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport) ||
305 cmd->HasSwitch(switches::kEnableOverlayScrollbars)) { 305 cmd->HasSwitch(switches::kEnableOverlayScrollbars)) {
306 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 306 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
307 } 307 }
308 #endif 308 #endif
309 309
310 if (!compositor->Initialize(settings)) 310 compositor->Initialize(settings);
311 return scoped_ptr<RenderWidgetCompositor>();
312 311
313 return compositor.Pass(); 312 return compositor.Pass();
314 } 313 }
315 314
316 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, 315 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget,
317 bool threaded) 316 bool threaded)
318 : threaded_(threaded), 317 : threaded_(threaded),
319 suppress_schedule_composite_(false), 318 suppress_schedule_composite_(false),
320 widget_(widget) { 319 widget_(widget) {
321 } 320 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 return layer_tree_host_->root_layer(); 405 return layer_tree_host_->root_layer();
407 } 406 }
408 407
409 bool RenderWidgetCompositor::ScheduleMicroBenchmark( 408 bool RenderWidgetCompositor::ScheduleMicroBenchmark(
410 const std::string& name, 409 const std::string& name,
411 scoped_ptr<base::Value> value, 410 scoped_ptr<base::Value> value,
412 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { 411 const base::Callback<void(scoped_ptr<base::Value>)>& callback) {
413 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); 412 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback);
414 } 413 }
415 414
416 bool RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { 415 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) {
417 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = 416 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy =
418 RenderThreadImpl::current()->compositor_message_loop_proxy(); 417 RenderThreadImpl::current()->compositor_message_loop_proxy();
419 if (compositor_message_loop_proxy.get()) { 418 if (compositor_message_loop_proxy.get()) {
420 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( 419 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(
421 this, NULL, settings, compositor_message_loop_proxy); 420 this, NULL, settings, compositor_message_loop_proxy);
422 } else { 421 } else {
423 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( 422 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
424 this, this, NULL, settings); 423 this, this, NULL, settings);
425 } 424 }
426 return layer_tree_host_; 425 DCHECK(layer_tree_host_);
427 } 426 }
428 427
429 void RenderWidgetCompositor::setSurfaceReady() { 428 void RenderWidgetCompositor::setSurfaceReady() {
430 layer_tree_host_->SetLayerTreeHostClientReady(); 429 layer_tree_host_->SetLayerTreeHostClientReady();
431 } 430 }
432 431
433 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { 432 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) {
434 layer_tree_host_->SetRootLayer( 433 layer_tree_host_->SetRootLayer(
435 static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); 434 static_cast<const webkit::WebLayerImpl*>(&layer)->layer());
436 } 435 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 widget_->OnSwapBuffersAborted(); 662 widget_->OnSwapBuffersAborted();
664 } 663 }
665 664
666 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 665 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
667 cc::ContextProvider* provider = 666 cc::ContextProvider* provider =
668 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 667 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
669 provider->Context3d()->rateLimitOffscreenContextCHROMIUM(); 668 provider->Context3d()->rateLimitOffscreenContextCHROMIUM();
670 } 669 }
671 670
672 } // namespace content 671 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698