| 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 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "cc/base/switches.h" | 14 #include "cc/base/switches.h" |
| 15 #include "cc/base/thread_impl.h" | 15 #include "cc/base/thread_impl.h" |
| 16 #include "cc/debug/layer_tree_debug_state.h" | 16 #include "cc/debug/layer_tree_debug_state.h" |
| 17 #include "cc/input/input_handler.h" |
| 17 #include "cc/layers/layer.h" | 18 #include "cc/layers/layer.h" |
| 18 #include "cc/trees/layer_tree_host.h" | 19 #include "cc/trees/layer_tree_host.h" |
| 19 #include "content/common/gpu/client/context_provider_command_buffer.h" | 20 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 21 #include "content/renderer/gpu/input_handler_manager.h" | 22 #include "content/renderer/gpu/input_handler_manager.h" |
| 22 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
| 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
| 25 #include "ui/gl/gl_switches.h" | 26 #include "ui/gl/gl_switches.h" |
| 26 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 27 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 27 #include "webkit/renderer/compositor_bindings/web_to_ccinput_handler_adapter.h" | |
| 28 | 28 |
| 29 namespace cc { | 29 namespace cc { |
| 30 class Layer; | 30 class Layer; |
| 31 } | 31 } |
| 32 | 32 |
| 33 using WebKit::WebFloatPoint; | 33 using WebKit::WebFloatPoint; |
| 34 using WebKit::WebSize; | 34 using WebKit::WebSize; |
| 35 using WebKit::WebRect; | 35 using WebKit::WebRect; |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 return widget_->CreateOutputSurface(); | 528 return widget_->CreateOutputSurface(); |
| 529 } | 529 } |
| 530 | 530 |
| 531 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) { | 531 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) { |
| 532 if (!success) | 532 if (!success) |
| 533 widget_->webwidget()->didExitCompositingMode(); | 533 widget_->webwidget()->didExitCompositingMode(); |
| 534 } | 534 } |
| 535 | 535 |
| 536 scoped_ptr<cc::InputHandlerClient> | 536 scoped_ptr<cc::InputHandlerClient> |
| 537 RenderWidgetCompositor::CreateInputHandlerClient() { | 537 RenderWidgetCompositor::CreateInputHandlerClient() { |
| 538 scoped_ptr<cc::InputHandlerClient> ret; | 538 return widget_->CreateInputHandlerClient(); |
| 539 scoped_ptr<WebKit::WebInputHandler> web_handler( | |
| 540 widget_->webwidget()->createInputHandler()); | |
| 541 if (web_handler) | |
| 542 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | |
| 543 return ret.Pass(); | |
| 544 } | 539 } |
| 545 | 540 |
| 546 void RenderWidgetCompositor::WillCommit() { | 541 void RenderWidgetCompositor::WillCommit() { |
| 547 widget_->InstrumentWillComposite(); | 542 widget_->InstrumentWillComposite(); |
| 548 } | 543 } |
| 549 | 544 |
| 550 void RenderWidgetCompositor::DidCommit() { | 545 void RenderWidgetCompositor::DidCommit() { |
| 551 widget_->DidCommitCompositorFrame(); | 546 widget_->DidCommitCompositorFrame(); |
| 552 widget_->didBecomeReadyForAdditionalInput(); | 547 widget_->didBecomeReadyForAdditionalInput(); |
| 553 } | 548 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 570 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 565 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 571 } | 566 } |
| 572 | 567 |
| 573 scoped_refptr<cc::ContextProvider> | 568 scoped_refptr<cc::ContextProvider> |
| 574 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 569 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
| 575 return RenderThreadImpl::current()-> | 570 return RenderThreadImpl::current()-> |
| 576 OffscreenContextProviderForCompositorThread(); | 571 OffscreenContextProviderForCompositorThread(); |
| 577 } | 572 } |
| 578 | 573 |
| 579 } // namespace content | 574 } // namespace content |
| OLD | NEW |