| 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 | 9 |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "cc/base/switches.h" | 15 #include "cc/base/switches.h" |
| 15 #include "cc/base/thread_impl.h" | 16 #include "cc/base/thread_impl.h" |
| 16 #include "cc/debug/layer_tree_debug_state.h" | 17 #include "cc/debug/layer_tree_debug_state.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 "ui/gl/gl_switches.h" | 25 #include "ui/gl/gl_switches.h" |
| 25 #include "webkit/compositor_bindings/web_layer_impl.h" | 26 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 26 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" | |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 class Layer; | 29 class Layer; |
| 30 } | 30 } |
| 31 | 31 |
| 32 using WebKit::WebFloatPoint; | 32 using WebKit::WebFloatPoint; |
| 33 using WebKit::WebSize; | 33 using WebKit::WebSize; |
| 34 using WebKit::WebRect; | 34 using WebKit::WebRect; |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return compositor.Pass(); | 283 return compositor.Pass(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) | 286 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) |
| 287 : suppress_schedule_composite_(false), | 287 : suppress_schedule_composite_(false), |
| 288 widget_(widget) { | 288 widget_(widget) { |
| 289 } | 289 } |
| 290 | 290 |
| 291 RenderWidgetCompositor::~RenderWidgetCompositor() {} | 291 RenderWidgetCompositor::~RenderWidgetCompositor() {} |
| 292 | 292 |
| 293 const base::WeakPtr<cc::InputHandler>& |
| 294 RenderWidgetCompositor::GetInputHandler() { |
| 295 return layer_tree_host_->GetInputHandler(); |
| 296 } |
| 297 |
| 293 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { | 298 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { |
| 294 if (suppress_schedule_composite_ == suppress) | 299 if (suppress_schedule_composite_ == suppress) |
| 295 return; | 300 return; |
| 296 | 301 |
| 297 if (suppress) | 302 if (suppress) |
| 298 TRACE_EVENT_ASYNC_BEGIN0("gpu", | 303 TRACE_EVENT_ASYNC_BEGIN0("gpu", |
| 299 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); | 304 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); |
| 300 else | 305 else |
| 301 TRACE_EVENT_ASYNC_END0("gpu", | 306 TRACE_EVENT_ASYNC_END0("gpu", |
| 302 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); | 307 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 519 |
| 515 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { | 520 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { |
| 516 return widget_->CreateOutputSurface(); | 521 return widget_->CreateOutputSurface(); |
| 517 } | 522 } |
| 518 | 523 |
| 519 void RenderWidgetCompositor::DidRecreateOutputSurface(bool success) { | 524 void RenderWidgetCompositor::DidRecreateOutputSurface(bool success) { |
| 520 if (!success) | 525 if (!success) |
| 521 widget_->webwidget()->didExitCompositingMode(); | 526 widget_->webwidget()->didExitCompositingMode(); |
| 522 } | 527 } |
| 523 | 528 |
| 524 scoped_ptr<cc::InputHandlerClient> | |
| 525 RenderWidgetCompositor::CreateInputHandlerClient() { | |
| 526 scoped_ptr<cc::InputHandlerClient> ret; | |
| 527 scoped_ptr<WebKit::WebInputHandler> web_handler( | |
| 528 widget_->webwidget()->createInputHandler()); | |
| 529 if (web_handler) | |
| 530 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | |
| 531 return ret.Pass(); | |
| 532 } | |
| 533 | |
| 534 void RenderWidgetCompositor::WillCommit() { | 529 void RenderWidgetCompositor::WillCommit() { |
| 535 widget_->InstrumentWillComposite(); | 530 widget_->InstrumentWillComposite(); |
| 536 } | 531 } |
| 537 | 532 |
| 538 void RenderWidgetCompositor::DidCommit() { | 533 void RenderWidgetCompositor::DidCommit() { |
| 539 widget_->DidCommitCompositorFrame(); | 534 widget_->DidCommitCompositorFrame(); |
| 540 widget_->didBecomeReadyForAdditionalInput(); | 535 widget_->didBecomeReadyForAdditionalInput(); |
| 541 } | 536 } |
| 542 | 537 |
| 543 void RenderWidgetCompositor::DidCommitAndDrawFrame() { | 538 void RenderWidgetCompositor::DidCommitAndDrawFrame() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 558 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 553 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 559 } | 554 } |
| 560 | 555 |
| 561 scoped_refptr<cc::ContextProvider> | 556 scoped_refptr<cc::ContextProvider> |
| 562 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 557 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
| 563 return RenderThreadImpl::current()-> | 558 return RenderThreadImpl::current()-> |
| 564 OffscreenContextProviderForCompositorThread(); | 559 OffscreenContextProviderForCompositorThread(); |
| 565 } | 560 } |
| 566 | 561 |
| 567 } // namespace content | 562 } // namespace content |
| OLD | NEW |