| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 #include "cc/blink/web_layer_impl.h" | 21 #include "cc/blink/web_layer_impl.h" |
| 22 #include "cc/debug/layer_tree_debug_state.h" | 22 #include "cc/debug/layer_tree_debug_state.h" |
| 23 #include "cc/debug/micro_benchmark.h" | 23 #include "cc/debug/micro_benchmark.h" |
| 24 #include "cc/input/layer_selection_bound.h" | 24 #include "cc/input/layer_selection_bound.h" |
| 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_gpu_memory_buffer_manager.h" |
| 31 #include "content/child/child_shared_bitmap_manager.h" | 32 #include "content/child/child_shared_bitmap_manager.h" |
| 32 #include "content/common/content_switches_internal.h" | 33 #include "content/common/content_switches_internal.h" |
| 33 #include "content/common/gpu/client/context_provider_command_buffer.h" | 34 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 34 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.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" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 scoped_ptr<base::Value> value) { | 521 scoped_ptr<base::Value> value) { |
| 521 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass()); | 522 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass()); |
| 522 } | 523 } |
| 523 | 524 |
| 524 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { | 525 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { |
| 525 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy; | 526 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy; |
| 526 scoped_refptr<base::SingleThreadTaskRunner> | 527 scoped_refptr<base::SingleThreadTaskRunner> |
| 527 main_thread_compositor_task_runner(base::MessageLoopProxy::current()); | 528 main_thread_compositor_task_runner(base::MessageLoopProxy::current()); |
| 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; |
| 531 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager = NULL; |
| 530 // render_thread may be NULL in tests. | 532 // render_thread may be NULL in tests. |
| 531 if (render_thread) { | 533 if (render_thread) { |
| 532 compositor_message_loop_proxy = | 534 compositor_message_loop_proxy = |
| 533 render_thread->compositor_message_loop_proxy(); | 535 render_thread->compositor_message_loop_proxy(); |
| 534 shared_bitmap_manager = render_thread->shared_bitmap_manager(); | 536 shared_bitmap_manager = render_thread->shared_bitmap_manager(); |
| 537 gpu_memory_buffer_manager = render_thread->gpu_memory_buffer_manager(); |
| 535 main_thread_compositor_task_runner = | 538 main_thread_compositor_task_runner = |
| 536 render_thread->main_thread_compositor_task_runner(); | 539 render_thread->main_thread_compositor_task_runner(); |
| 537 } | 540 } |
| 538 if (compositor_message_loop_proxy.get()) { | 541 if (compositor_message_loop_proxy.get()) { |
| 539 layer_tree_host_ = | 542 layer_tree_host_ = |
| 540 cc::LayerTreeHost::CreateThreaded(this, | 543 cc::LayerTreeHost::CreateThreaded(this, |
| 541 shared_bitmap_manager, | 544 shared_bitmap_manager, |
| 545 gpu_memory_buffer_manager, |
| 542 settings, | 546 settings, |
| 543 main_thread_compositor_task_runner, | 547 main_thread_compositor_task_runner, |
| 544 compositor_message_loop_proxy); | 548 compositor_message_loop_proxy); |
| 545 } else { | 549 } else { |
| 546 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 550 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
| 547 this, | 551 this, |
| 548 this, | 552 this, |
| 549 shared_bitmap_manager, | 553 shared_bitmap_manager, |
| 554 gpu_memory_buffer_manager, |
| 550 settings, | 555 settings, |
| 551 main_thread_compositor_task_runner); | 556 main_thread_compositor_task_runner); |
| 552 } | 557 } |
| 553 DCHECK(layer_tree_host_); | 558 DCHECK(layer_tree_host_); |
| 554 } | 559 } |
| 555 | 560 |
| 556 void RenderWidgetCompositor::setSurfaceReady() { | 561 void RenderWidgetCompositor::setSurfaceReady() { |
| 557 // In tests without a RenderThreadImpl, don't set ready as this kicks | 562 // In tests without a RenderThreadImpl, don't set ready as this kicks |
| 558 // off creating output surfaces that the test can't create. | 563 // off creating output surfaces that the test can't create. |
| 559 if (RenderThreadImpl::current()) | 564 if (RenderThreadImpl::current()) |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 widget_->OnSwapBuffersAborted(); | 875 widget_->OnSwapBuffersAborted(); |
| 871 } | 876 } |
| 872 | 877 |
| 873 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 878 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 874 cc::ContextProvider* provider = | 879 cc::ContextProvider* provider = |
| 875 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 880 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 876 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 881 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 877 } | 882 } |
| 878 | 883 |
| 879 } // namespace content | 884 } // namespace content |
| OLD | NEW |