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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 14 matching lines...) Expand all
25 #include "cc/layers/layer.h" 25 #include "cc/layers/layer.h"
26 #include "cc/output/begin_frame_args.h" 26 #include "cc/output/begin_frame_args.h"
27 #include "cc/output/copy_output_request.h" 27 #include "cc/output/copy_output_request.h"
28 #include "cc/output/copy_output_result.h" 28 #include "cc/output/copy_output_result.h"
29 #include "cc/resources/single_release_callback.h" 29 #include "cc/resources/single_release_callback.h"
30 #include "cc/trees/layer_tree_host.h" 30 #include "cc/trees/layer_tree_host.h"
31 #include "content/child/child_shared_bitmap_manager.h" 31 #include "content/child/child_shared_bitmap_manager.h"
32 #include "content/common/content_switches_internal.h" 32 #include "content/common/content_switches_internal.h"
33 #include "content/common/gpu/client/context_provider_command_buffer.h" 33 #include "content/common/gpu/client/context_provider_command_buffer.h"
34 #include "content/public/common/content_switches.h" 34 #include "content/public/common/content_switches.h"
35 #include "content/renderer/gpu/compositor_external_begin_frame_source.h"
35 #include "content/renderer/input/input_handler_manager.h" 36 #include "content/renderer/input/input_handler_manager.h"
36 #include "content/renderer/render_thread_impl.h" 37 #include "content/renderer/render_thread_impl.h"
37 #include "gpu/command_buffer/client/gles2_interface.h" 38 #include "gpu/command_buffer/client/gles2_interface.h"
38 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h" 39 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h"
39 #include "third_party/WebKit/public/platform/WebSelectionBound.h" 40 #include "third_party/WebKit/public/platform/WebSelectionBound.h"
40 #include "third_party/WebKit/public/platform/WebSize.h" 41 #include "third_party/WebKit/public/platform/WebSize.h"
41 #include "third_party/WebKit/public/web/WebKit.h" 42 #include "third_party/WebKit/public/web/WebKit.h"
42 #include "third_party/WebKit/public/web/WebWidget.h" 43 #include "third_party/WebKit/public/web/WebWidget.h"
43 #include "ui/gfx/frame_time.h" 44 #include "ui/gfx/frame_time.h"
44 #include "ui/gl/gl_switches.h" 45 #include "ui/gl/gl_switches.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 529 RenderThreadImpl* render_thread = RenderThreadImpl::current();
529 cc::SharedBitmapManager* shared_bitmap_manager = NULL; 530 cc::SharedBitmapManager* shared_bitmap_manager = NULL;
530 // render_thread may be NULL in tests. 531 // render_thread may be NULL in tests.
531 if (render_thread) { 532 if (render_thread) {
532 compositor_message_loop_proxy = 533 compositor_message_loop_proxy =
533 render_thread->compositor_message_loop_proxy(); 534 render_thread->compositor_message_loop_proxy();
534 shared_bitmap_manager = render_thread->shared_bitmap_manager(); 535 shared_bitmap_manager = render_thread->shared_bitmap_manager();
535 main_thread_compositor_task_runner = 536 main_thread_compositor_task_runner =
536 render_thread->main_thread_compositor_task_runner(); 537 render_thread->main_thread_compositor_task_runner();
537 } 538 }
539 scoped_ptr<CompositorExternalBeginFrameSource> external_begin_frame_source;
540 if (settings.begin_frame_scheduling_enabled) {
541 external_begin_frame_source.reset(new CompositorExternalBeginFrameSource(
542 widget_->routing_id()));
543 }
538 if (compositor_message_loop_proxy.get()) { 544 if (compositor_message_loop_proxy.get()) {
539 layer_tree_host_ = 545 layer_tree_host_ =
540 cc::LayerTreeHost::CreateThreaded(this, 546 cc::LayerTreeHost::CreateThreaded(this,
541 shared_bitmap_manager, 547 shared_bitmap_manager,
542 settings, 548 settings,
543 main_thread_compositor_task_runner, 549 main_thread_compositor_task_runner,
544 compositor_message_loop_proxy); 550 compositor_message_loop_proxy,
551 external_begin_frame_source.Pass());
545 } else { 552 } else {
546 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( 553 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
547 this, 554 this,
548 this, 555 this,
549 shared_bitmap_manager, 556 shared_bitmap_manager,
550 settings, 557 settings,
551 main_thread_compositor_task_runner); 558 main_thread_compositor_task_runner,
559 external_begin_frame_source.Pass());
552 } 560 }
553 DCHECK(layer_tree_host_); 561 DCHECK(layer_tree_host_);
554 } 562 }
555 563
556 void RenderWidgetCompositor::setSurfaceReady() { 564 void RenderWidgetCompositor::setSurfaceReady() {
557 // In tests without a RenderThreadImpl, don't set ready as this kicks 565 // In tests without a RenderThreadImpl, don't set ready as this kicks
558 // off creating output surfaces that the test can't create. 566 // off creating output surfaces that the test can't create.
559 if (RenderThreadImpl::current()) 567 if (RenderThreadImpl::current())
560 layer_tree_host_->SetLayerTreeHostClientReady(); 568 layer_tree_host_->SetLayerTreeHostClientReady();
561 } 569 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 widget_->OnSwapBuffersAborted(); 878 widget_->OnSwapBuffersAborted();
871 } 879 }
872 880
873 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 881 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
874 cc::ContextProvider* provider = 882 cc::ContextProvider* provider =
875 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 883 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
876 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 884 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
877 } 885 }
878 886
879 } // namespace content 887 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698