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

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

Issue 441343002: Revert 287747 "Make SingleThreadProxy a SchedulerClient" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 | 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 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 double hide_threshold; 270 double hide_threshold;
271 if (base::StringToDouble(top_threshold_str, &hide_threshold) && 271 if (base::StringToDouble(top_threshold_str, &hide_threshold) &&
272 hide_threshold >= 0.f && hide_threshold <= 1.f) 272 hide_threshold >= 0.f && hide_threshold <= 1.f)
273 settings.top_controls_hide_threshold = hide_threshold; 273 settings.top_controls_hide_threshold = hide_threshold;
274 } 274 }
275 275
276 settings.use_pinch_virtual_viewport = 276 settings.use_pinch_virtual_viewport =
277 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); 277 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport);
278 settings.allow_antialiasing &= 278 settings.allow_antialiasing &=
279 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); 279 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing);
280 settings.single_thread_proxy_scheduler =
281 !cmd->HasSwitch(switches::kDisableSingleThreadProxyScheduler);
282 280
283 // These flags should be mirrored by UI versions in ui/compositor/. 281 // These flags should be mirrored by UI versions in ui/compositor/.
284 settings.initial_debug_state.show_debug_borders = 282 settings.initial_debug_state.show_debug_borders =
285 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); 283 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders);
286 settings.initial_debug_state.show_fps_counter = 284 settings.initial_debug_state.show_fps_counter =
287 cmd->HasSwitch(cc::switches::kShowFPSCounter); 285 cmd->HasSwitch(cc::switches::kShowFPSCounter);
288 settings.initial_debug_state.show_layer_animation_bounds_rects = 286 settings.initial_debug_state.show_layer_animation_bounds_rects =
289 cmd->HasSwitch(cc::switches::kShowLayerAnimationBounds); 287 cmd->HasSwitch(cc::switches::kShowLayerAnimationBounds);
290 settings.initial_debug_state.show_paint_rects = 288 settings.initial_debug_state.show_paint_rects =
291 cmd->HasSwitch(switches::kShowPaintRects); 289 cmd->HasSwitch(switches::kShowPaintRects);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 #endif 402 #endif
405 403
406 compositor->Initialize(settings); 404 compositor->Initialize(settings);
407 405
408 return compositor.Pass(); 406 return compositor.Pass();
409 } 407 }
410 408
411 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, 409 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget,
412 bool threaded) 410 bool threaded)
413 : threaded_(threaded), 411 : threaded_(threaded),
412 suppress_schedule_composite_(false),
414 widget_(widget) { 413 widget_(widget) {
415 } 414 }
416 415
417 RenderWidgetCompositor::~RenderWidgetCompositor() {} 416 RenderWidgetCompositor::~RenderWidgetCompositor() {}
418 417
419 const base::WeakPtr<cc::InputHandler>& 418 const base::WeakPtr<cc::InputHandler>&
420 RenderWidgetCompositor::GetInputHandler() { 419 RenderWidgetCompositor::GetInputHandler() {
421 return layer_tree_host_->GetInputHandler(); 420 return layer_tree_host_->GetInputHandler();
422 } 421 }
423 422
423 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) {
424 if (suppress_schedule_composite_ == suppress)
425 return;
426
427 if (suppress)
428 TRACE_EVENT_ASYNC_BEGIN0("gpu",
429 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
430 else
431 TRACE_EVENT_ASYNC_END0("gpu",
432 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
433 suppress_schedule_composite_ = suppress;
434 }
435
424 bool RenderWidgetCompositor::BeginMainFrameRequested() const { 436 bool RenderWidgetCompositor::BeginMainFrameRequested() const {
425 return layer_tree_host_->BeginMainFrameRequested(); 437 return layer_tree_host_->BeginMainFrameRequested();
426 } 438 }
427 439
440 void RenderWidgetCompositor::UpdateAnimations(base::TimeTicks time) {
441 layer_tree_host_->UpdateClientAnimations(time);
442 }
443
428 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { 444 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() {
429 layer_tree_host_->SetNeedsDisplayOnAllLayers(); 445 layer_tree_host_->SetNeedsDisplayOnAllLayers();
430 } 446 }
431 447
432 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { 448 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() {
433 cc::LayerTreeDebugState current = layer_tree_host_->debug_state(); 449 cc::LayerTreeDebugState current = layer_tree_host_->debug_state();
434 current.rasterize_only_visible_content = true; 450 current.rasterize_only_visible_content = true;
435 layer_tree_host_->SetDebugState(current); 451 layer_tree_host_->SetDebugState(current);
436 } 452 }
437 453
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 this, 542 this,
527 this, 543 this,
528 shared_bitmap_manager, 544 shared_bitmap_manager,
529 settings, 545 settings,
530 base::MessageLoopProxy::current()); 546 base::MessageLoopProxy::current());
531 } 547 }
532 DCHECK(layer_tree_host_); 548 DCHECK(layer_tree_host_);
533 } 549 }
534 550
535 void RenderWidgetCompositor::setSurfaceReady() { 551 void RenderWidgetCompositor::setSurfaceReady() {
536 // In tests without a RenderThreadImpl, don't set ready as this kicks 552 layer_tree_host_->SetLayerTreeHostClientReady();
537 // off creating output surfaces that the test can't create.
538 if (RenderThreadImpl::current())
539 layer_tree_host_->SetLayerTreeHostClientReady();
540 } 553 }
541 554
542 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { 555 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) {
543 layer_tree_host_->SetRootLayer( 556 layer_tree_host_->SetRootLayer(
544 static_cast<const WebLayerImpl*>(&layer)->layer()); 557 static_cast<const WebLayerImpl*>(&layer)->layer());
545 } 558 }
546 559
547 void RenderWidgetCompositor::clearRootLayer() { 560 void RenderWidgetCompositor::clearRootLayer() {
548 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); 561 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>());
549 } 562 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 695 }
683 } 696 }
684 697
685 void RenderWidgetCompositor::compositeAndReadbackAsync( 698 void RenderWidgetCompositor::compositeAndReadbackAsync(
686 blink::WebCompositeAndReadbackAsyncCallback* callback) { 699 blink::WebCompositeAndReadbackAsyncCallback* callback) {
687 DCHECK(layer_tree_host_->root_layer()); 700 DCHECK(layer_tree_host_->root_layer());
688 scoped_ptr<cc::CopyOutputRequest> request = 701 scoped_ptr<cc::CopyOutputRequest> request =
689 cc::CopyOutputRequest::CreateBitmapRequest( 702 cc::CopyOutputRequest::CreateBitmapRequest(
690 base::Bind(&CompositeAndReadbackAsyncCallback, callback)); 703 base::Bind(&CompositeAndReadbackAsyncCallback, callback));
691 layer_tree_host_->root_layer()->RequestCopyOfOutput(request.Pass()); 704 layer_tree_host_->root_layer()->RequestCopyOfOutput(request.Pass());
692 705 if (!threaded_) {
693 if (!threaded_ && 706 widget_->webwidget()->animate(0.0);
694 !layer_tree_host_->settings().single_thread_proxy_scheduler) { 707 widget_->webwidget()->layout();
695 layer_tree_host_->Composite(gfx::FrameTime::Now()); 708 layer_tree_host_->Composite(gfx::FrameTime::Now());
696 } 709 }
697 } 710 }
698 711
699 void RenderWidgetCompositor::finishAllRendering() { 712 void RenderWidgetCompositor::finishAllRendering() {
700 layer_tree_host_->FinishAllRendering(); 713 layer_tree_host_->FinishAllRendering();
701 } 714 }
702 715
703 void RenderWidgetCompositor::setDeferCommits(bool defer_commits) { 716 void RenderWidgetCompositor::setDeferCommits(bool defer_commits) {
704 layer_tree_host_->SetDeferCommits(defer_commits); 717 layer_tree_host_->SetDeferCommits(defer_commits);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 void RenderWidgetCompositor::DidCommitAndDrawFrame() { 793 void RenderWidgetCompositor::DidCommitAndDrawFrame() {
781 widget_->didCommitAndDrawCompositorFrame(); 794 widget_->didCommitAndDrawCompositorFrame();
782 } 795 }
783 796
784 void RenderWidgetCompositor::DidCompleteSwapBuffers() { 797 void RenderWidgetCompositor::DidCompleteSwapBuffers() {
785 widget_->didCompleteSwapBuffers(); 798 widget_->didCompleteSwapBuffers();
786 if (!threaded_) 799 if (!threaded_)
787 widget_->OnSwapBuffersComplete(); 800 widget_->OnSwapBuffersComplete();
788 } 801 }
789 802
803 void RenderWidgetCompositor::ScheduleComposite() {
804 if (!suppress_schedule_composite_)
805 widget_->scheduleComposite();
806 }
807
790 void RenderWidgetCompositor::ScheduleAnimation() { 808 void RenderWidgetCompositor::ScheduleAnimation() {
791 widget_->scheduleAnimation(); 809 widget_->scheduleAnimation();
792 } 810 }
793 811
794 void RenderWidgetCompositor::DidPostSwapBuffers() { 812 void RenderWidgetCompositor::DidPostSwapBuffers() {
795 widget_->OnSwapBuffersPosted(); 813 widget_->OnSwapBuffersPosted();
796 } 814 }
797 815
798 void RenderWidgetCompositor::DidAbortSwapBuffers() { 816 void RenderWidgetCompositor::DidAbortSwapBuffers() {
799 widget_->OnSwapBuffersAborted(); 817 widget_->OnSwapBuffersAborted();
800 } 818 }
801 819
802 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 820 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
803 cc::ContextProvider* provider = 821 cc::ContextProvider* provider =
804 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 822 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
805 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 823 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
806 } 824 }
807 825
808 } // namespace content 826 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/gpu/render_widget_compositor.h ('k') | trunk/src/content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698