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

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

Issue 1385043002: cc: Remove SetLayerTreeHostClientReady() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startcomp
Patch Set: sky's offline comment Created 5 years, 2 months 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
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 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 compositor->Initialize(); 207 compositor->Initialize();
208 return compositor; 208 return compositor;
209 } 209 }
210 210
211 RenderWidgetCompositor::RenderWidgetCompositor( 211 RenderWidgetCompositor::RenderWidgetCompositor(
212 RenderWidget* widget, 212 RenderWidget* widget,
213 CompositorDependencies* compositor_deps) 213 CompositorDependencies* compositor_deps)
214 : num_failed_recreate_attempts_(0), 214 : num_failed_recreate_attempts_(0),
215 widget_(widget), 215 widget_(widget),
216 compositor_deps_(compositor_deps), 216 compositor_deps_(compositor_deps),
217 never_visible_(false),
217 layout_and_paint_async_callback_(nullptr), 218 layout_and_paint_async_callback_(nullptr),
218 weak_factory_(this) { 219 weak_factory_(this) {
219 } 220 }
220 221
221 void RenderWidgetCompositor::Initialize() { 222 void RenderWidgetCompositor::Initialize() {
222 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 223 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
223 224
224 cc::LayerTreeSettings settings; 225 cc::LayerTreeSettings settings;
225 226
226 // For web contents, layer transforms should scale up the contents of layers 227 // For web contents, layer transforms should scale up the contents of layers
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( 493 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(
493 compositor_thread_task_runner, &params); 494 compositor_thread_task_runner, &params);
494 } else { 495 } else {
495 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 496 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
496 } 497 }
497 DCHECK(layer_tree_host_); 498 DCHECK(layer_tree_host_);
498 } 499 }
499 500
500 RenderWidgetCompositor::~RenderWidgetCompositor() {} 501 RenderWidgetCompositor::~RenderWidgetCompositor() {}
501 502
503 void RenderWidgetCompositor::SetNeverVisible() {
504 DCHECK(!layer_tree_host_->visible());
505 never_visible_ = true;
506 }
507
502 const base::WeakPtr<cc::InputHandler>& 508 const base::WeakPtr<cc::InputHandler>&
503 RenderWidgetCompositor::GetInputHandler() { 509 RenderWidgetCompositor::GetInputHandler() {
504 return layer_tree_host_->GetInputHandler(); 510 return layer_tree_host_->GetInputHandler();
505 } 511 }
506 512
507 bool RenderWidgetCompositor::BeginMainFrameRequested() const { 513 bool RenderWidgetCompositor::BeginMainFrameRequested() const {
508 return layer_tree_host_->BeginMainFrameRequested(); 514 return layer_tree_host_->BeginMainFrameRequested();
509 } 515 }
510 516
511 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { 517 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { 572 const base::Callback<void(scoped_ptr<base::Value>)>& callback) {
567 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); 573 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback);
568 } 574 }
569 575
570 bool RenderWidgetCompositor::SendMessageToMicroBenchmark( 576 bool RenderWidgetCompositor::SendMessageToMicroBenchmark(
571 int id, 577 int id,
572 scoped_ptr<base::Value> value) { 578 scoped_ptr<base::Value> value) {
573 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass()); 579 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass());
574 } 580 }
575 581
576 void RenderWidgetCompositor::StartCompositor() {
577 layer_tree_host_->SetLayerTreeHostClientReady();
578 }
579
580 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { 582 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) {
581 layer_tree_host_->SetRootLayer( 583 layer_tree_host_->SetRootLayer(
582 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); 584 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer());
583 } 585 }
584 586
585 void RenderWidgetCompositor::clearRootLayer() { 587 void RenderWidgetCompositor::clearRootLayer() {
586 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); 588 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>());
587 } 589 }
588 590
589 void RenderWidgetCompositor::attachCompositorAnimationTimeline( 591 void RenderWidgetCompositor::attachCompositorAnimationTimeline(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 628
627 void RenderWidgetCompositor::setBackgroundColor(blink::WebColor color) { 629 void RenderWidgetCompositor::setBackgroundColor(blink::WebColor color) {
628 layer_tree_host_->set_background_color(color); 630 layer_tree_host_->set_background_color(color);
629 } 631 }
630 632
631 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { 633 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) {
632 layer_tree_host_->set_has_transparent_background(transparent); 634 layer_tree_host_->set_has_transparent_background(transparent);
633 } 635 }
634 636
635 void RenderWidgetCompositor::setVisible(bool visible) { 637 void RenderWidgetCompositor::setVisible(bool visible) {
638 if (never_visible_)
639 return;
640
636 layer_tree_host_->SetVisible(visible); 641 layer_tree_host_->SetVisible(visible);
637 } 642 }
638 643
639 void RenderWidgetCompositor::setPageScaleFactorAndLimits( 644 void RenderWidgetCompositor::setPageScaleFactorAndLimits(
640 float page_scale_factor, float minimum, float maximum) { 645 float page_scale_factor, float minimum, float maximum) {
641 layer_tree_host_->SetPageScaleFactorAndLimits( 646 layer_tree_host_->SetPageScaleFactorAndLimits(
642 page_scale_factor, minimum, maximum); 647 page_scale_factor, minimum, maximum);
643 } 648 }
644 649
645 void RenderWidgetCompositor::startPageScaleAnimation( 650 void RenderWidgetCompositor::startPageScaleAnimation(
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // Ignore what the system said and give all clients the same maximum 1090 // Ignore what the system said and give all clients the same maximum
1086 // allocation on desktop platforms. 1091 // allocation on desktop platforms.
1087 actual.bytes_limit_when_visible = 512 * 1024 * 1024; 1092 actual.bytes_limit_when_visible = 512 * 1024 * 1024;
1088 actual.priority_cutoff_when_visible = 1093 actual.priority_cutoff_when_visible =
1089 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 1094 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
1090 #endif 1095 #endif
1091 return actual; 1096 return actual;
1092 } 1097 }
1093 1098
1094 } // namespace content 1099 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.h ('k') | content/renderer/gpu/render_widget_compositor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698