| 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 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| 11 #include "base/android/sys_utils.h" | 11 #include "base/android/sys_utils.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "cc/base/latency_info_swap_promise.h" | 20 #include "cc/base/latency_info_swap_promise.h" |
| 21 #include "cc/base/latency_info_swap_promise_monitor.h" | 21 #include "cc/base/latency_info_swap_promise_monitor.h" |
| 22 #include "cc/base/switches.h" | 22 #include "cc/base/switches.h" |
| 23 #include "cc/debug/layer_tree_debug_state.h" | 23 #include "cc/debug/layer_tree_debug_state.h" |
| 24 #include "cc/debug/micro_benchmark.h" | 24 #include "cc/debug/micro_benchmark.h" |
| 25 #include "cc/layers/layer.h" | 25 #include "cc/layers/layer.h" |
| 26 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
| 27 #include "content/child/child_shared_bitmap_manager.h" |
| 27 #include "content/common/content_switches_internal.h" | 28 #include "content/common/content_switches_internal.h" |
| 28 #include "content/common/gpu/client/context_provider_command_buffer.h" | 29 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 30 #include "content/renderer/input/input_handler_manager.h" | 31 #include "content/renderer/input/input_handler_manager.h" |
| 31 #include "content/renderer/render_thread_impl.h" | 32 #include "content/renderer/render_thread_impl.h" |
| 32 #include "gpu/command_buffer/client/gles2_interface.h" | 33 #include "gpu/command_buffer/client/gles2_interface.h" |
| 33 #include "third_party/WebKit/public/platform/WebSize.h" | 34 #include "third_party/WebKit/public/platform/WebSize.h" |
| 34 #include "third_party/WebKit/public/web/WebWidget.h" | 35 #include "third_party/WebKit/public/web/WebWidget.h" |
| 35 #include "ui/gl/gl_switches.h" | 36 #include "ui/gl/gl_switches.h" |
| 36 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 37 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 scoped_ptr<base::Value> value, | 388 scoped_ptr<base::Value> value, |
| 388 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { | 389 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { |
| 389 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); | 390 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); |
| 390 } | 391 } |
| 391 | 392 |
| 392 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { | 393 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { |
| 393 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = | 394 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = |
| 394 RenderThreadImpl::current()->compositor_message_loop_proxy(); | 395 RenderThreadImpl::current()->compositor_message_loop_proxy(); |
| 395 if (compositor_message_loop_proxy.get()) { | 396 if (compositor_message_loop_proxy.get()) { |
| 396 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( | 397 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( |
| 397 this, NULL, settings, compositor_message_loop_proxy); | 398 this, |
| 399 ChildThread::current()->shared_bitmap_manager(), |
| 400 settings, |
| 401 compositor_message_loop_proxy); |
| 398 } else { | 402 } else { |
| 399 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 403 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
| 400 this, this, NULL, settings); | 404 this, this, ChildThread::current()->shared_bitmap_manager(), settings); |
| 401 } | 405 } |
| 402 DCHECK(layer_tree_host_); | 406 DCHECK(layer_tree_host_); |
| 403 } | 407 } |
| 404 | 408 |
| 405 void RenderWidgetCompositor::setSurfaceReady() { | 409 void RenderWidgetCompositor::setSurfaceReady() { |
| 406 layer_tree_host_->SetLayerTreeHostClientReady(); | 410 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 407 } | 411 } |
| 408 | 412 |
| 409 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 413 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
| 410 layer_tree_host_->SetRootLayer( | 414 layer_tree_host_->SetRootLayer( |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 widget_->OnSwapBuffersAborted(); | 642 widget_->OnSwapBuffersAborted(); |
| 639 } | 643 } |
| 640 | 644 |
| 641 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 645 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 642 cc::ContextProvider* provider = | 646 cc::ContextProvider* provider = |
| 643 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 647 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 644 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 648 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 645 } | 649 } |
| 646 | 650 |
| 647 } // namespace content | 651 } // namespace content |
| OLD | NEW |