| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "cc/base/switches.h" | 15 #include "cc/base/switches.h" |
| 16 #include "cc/base/thread_impl.h" | |
| 17 #include "cc/debug/layer_tree_debug_state.h" | 16 #include "cc/debug/layer_tree_debug_state.h" |
| 18 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
| 19 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
| 20 #include "content/common/gpu/client/context_provider_command_buffer.h" | 19 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 21 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
| 22 #include "content/renderer/gpu/input_handler_manager.h" | 21 #include "content/renderer/gpu/input_handler_manager.h" |
| 23 #include "content/renderer/render_thread_impl.h" | 22 #include "content/renderer/render_thread_impl.h" |
| 24 #include "third_party/WebKit/public/platform/WebSize.h" | 23 #include "third_party/WebKit/public/platform/WebSize.h" |
| 25 #include "third_party/WebKit/public/web/WebWidget.h" | 24 #include "third_party/WebKit/public/web/WebWidget.h" |
| 26 #include "ui/gl/gl_switches.h" | 25 #include "ui/gl/gl_switches.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 353 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 355 layer_tree_host_->SetNeedsRedrawRect(damage_rect); | 354 layer_tree_host_->SetNeedsRedrawRect(damage_rect); |
| 356 } | 355 } |
| 357 | 356 |
| 358 void RenderWidgetCompositor::SetLatencyInfo( | 357 void RenderWidgetCompositor::SetLatencyInfo( |
| 359 const ui::LatencyInfo& latency_info) { | 358 const ui::LatencyInfo& latency_info) { |
| 360 layer_tree_host_->SetLatencyInfo(latency_info); | 359 layer_tree_host_->SetLatencyInfo(latency_info); |
| 361 } | 360 } |
| 362 | 361 |
| 363 bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { | 362 bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { |
| 364 scoped_ptr<cc::Thread> impl_thread; | |
| 365 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = | 363 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = |
| 366 RenderThreadImpl::current()->compositor_message_loop_proxy(); | 364 RenderThreadImpl::current()->compositor_message_loop_proxy(); |
| 367 threaded_ = !!compositor_message_loop_proxy.get(); | |
| 368 if (threaded_) { | |
| 369 impl_thread = cc::ThreadImpl::CreateForDifferentThread( | |
| 370 compositor_message_loop_proxy); | |
| 371 } | |
| 372 layer_tree_host_ = cc::LayerTreeHost::Create(this, | 365 layer_tree_host_ = cc::LayerTreeHost::Create(this, |
| 373 settings, | 366 settings, |
| 374 impl_thread.Pass()); | 367 compositor_message_loop_proxy); |
| 375 return layer_tree_host_; | 368 return layer_tree_host_; |
| 376 } | 369 } |
| 377 | 370 |
| 378 void RenderWidgetCompositor::setSurfaceReady() { | 371 void RenderWidgetCompositor::setSurfaceReady() { |
| 379 layer_tree_host_->SetLayerTreeHostClientReady(); | 372 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 380 } | 373 } |
| 381 | 374 |
| 382 void RenderWidgetCompositor::setRootLayer(const WebKit::WebLayer& layer) { | 375 void RenderWidgetCompositor::setRootLayer(const WebKit::WebLayer& layer) { |
| 383 layer_tree_host_->SetRootLayer( | 376 layer_tree_host_->SetRootLayer( |
| 384 static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); | 377 static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 561 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 569 } | 562 } |
| 570 | 563 |
| 571 scoped_refptr<cc::ContextProvider> | 564 scoped_refptr<cc::ContextProvider> |
| 572 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 565 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
| 573 return RenderThreadImpl::current()-> | 566 return RenderThreadImpl::current()-> |
| 574 OffscreenContextProviderForCompositorThread(); | 567 OffscreenContextProviderForCompositorThread(); |
| 575 } | 568 } |
| 576 | 569 |
| 577 } // namespace content | 570 } // namespace content |
| OLD | NEW |