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" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return compositor.Pass(); | 284 return compositor.Pass(); |
284 } | 285 } |
285 | 286 |
286 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) | 287 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) |
287 : suppress_schedule_composite_(false), | 288 : suppress_schedule_composite_(false), |
288 widget_(widget) { | 289 widget_(widget) { |
289 } | 290 } |
290 | 291 |
291 RenderWidgetCompositor::~RenderWidgetCompositor() {} | 292 RenderWidgetCompositor::~RenderWidgetCompositor() {} |
292 | 293 |
| 294 const base::WeakPtr<cc::InputHandler>& |
| 295 RenderWidgetCompositor::GetInputHandler() { |
| 296 return layer_tree_host_->GetInputHandler(); |
| 297 } |
| 298 |
293 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { | 299 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { |
294 if (suppress_schedule_composite_ == suppress) | 300 if (suppress_schedule_composite_ == suppress) |
295 return; | 301 return; |
296 | 302 |
297 if (suppress) | 303 if (suppress) |
298 TRACE_EVENT_ASYNC_BEGIN0("gpu", | 304 TRACE_EVENT_ASYNC_BEGIN0("gpu", |
299 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); | 305 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); |
300 else | 306 else |
301 TRACE_EVENT_ASYNC_END0("gpu", | 307 TRACE_EVENT_ASYNC_END0("gpu", |
302 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); | 308 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 520 |
515 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { | 521 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { |
516 return widget_->CreateOutputSurface(); | 522 return widget_->CreateOutputSurface(); |
517 } | 523 } |
518 | 524 |
519 void RenderWidgetCompositor::DidRecreateOutputSurface(bool success) { | 525 void RenderWidgetCompositor::DidRecreateOutputSurface(bool success) { |
520 if (!success) | 526 if (!success) |
521 widget_->webwidget()->didExitCompositingMode(); | 527 widget_->webwidget()->didExitCompositingMode(); |
522 } | 528 } |
523 | 529 |
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() { | 530 void RenderWidgetCompositor::WillCommit() { |
535 widget_->InstrumentWillComposite(); | 531 widget_->InstrumentWillComposite(); |
536 } | 532 } |
537 | 533 |
538 void RenderWidgetCompositor::DidCommit() { | 534 void RenderWidgetCompositor::DidCommit() { |
539 widget_->DidCommitCompositorFrame(); | 535 widget_->DidCommitCompositorFrame(); |
540 widget_->didBecomeReadyForAdditionalInput(); | 536 widget_->didBecomeReadyForAdditionalInput(); |
541 } | 537 } |
542 | 538 |
543 void RenderWidgetCompositor::DidCommitAndDrawFrame() { | 539 void RenderWidgetCompositor::DidCommitAndDrawFrame() { |
(...skipping 14 matching lines...) Expand all Loading... |
558 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 554 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
559 } | 555 } |
560 | 556 |
561 scoped_refptr<cc::ContextProvider> | 557 scoped_refptr<cc::ContextProvider> |
562 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 558 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
563 return RenderThreadImpl::current()-> | 559 return RenderThreadImpl::current()-> |
564 OffscreenContextProviderForCompositorThread(); | 560 OffscreenContextProviderForCompositorThread(); |
565 } | 561 } |
566 | 562 |
567 } // namespace content | 563 } // namespace content |
OLD | NEW |