| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 scoped_ptr<base::Value> value, | 382 scoped_ptr<base::Value> value, |
| 382 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { | 383 const base::Callback<void(scoped_ptr<base::Value>)>& callback) { |
| 383 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); | 384 return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback); |
| 384 } | 385 } |
| 385 | 386 |
| 386 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { | 387 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { |
| 387 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = | 388 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = |
| 388 RenderThreadImpl::current()->compositor_message_loop_proxy(); | 389 RenderThreadImpl::current()->compositor_message_loop_proxy(); |
| 389 if (compositor_message_loop_proxy.get()) { | 390 if (compositor_message_loop_proxy.get()) { |
| 390 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( | 391 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( |
| 391 this, NULL, settings, compositor_message_loop_proxy); | 392 this, |
| 393 ChildThread::current()->shared_bitmap_manager(), |
| 394 settings, |
| 395 compositor_message_loop_proxy); |
| 392 } else { | 396 } else { |
| 393 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 397 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
| 394 this, this, NULL, settings); | 398 this, this, ChildThread::current()->shared_bitmap_manager(), settings); |
| 395 } | 399 } |
| 396 DCHECK(layer_tree_host_); | 400 DCHECK(layer_tree_host_); |
| 397 } | 401 } |
| 398 | 402 |
| 399 void RenderWidgetCompositor::setSurfaceReady() { | 403 void RenderWidgetCompositor::setSurfaceReady() { |
| 400 layer_tree_host_->SetLayerTreeHostClientReady(); | 404 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 401 } | 405 } |
| 402 | 406 |
| 403 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 407 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
| 404 layer_tree_host_->SetRootLayer( | 408 layer_tree_host_->SetRootLayer( |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 widget_->OnSwapBuffersAborted(); | 636 widget_->OnSwapBuffersAborted(); |
| 633 } | 637 } |
| 634 | 638 |
| 635 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 639 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 636 cc::ContextProvider* provider = | 640 cc::ContextProvider* provider = |
| 637 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 641 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 638 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 642 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 639 } | 643 } |
| 640 | 644 |
| 641 } // namespace content | 645 } // namespace content |
| OLD | NEW |