Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 13844021: Move compositor thread input handling logic into content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch in blink changes to WebCompositorInputHandlerImpl* Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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/compositor_bindings/web_layer_impl.h" 27 #include "webkit/compositor_bindings/web_layer_impl.h"
27 #include "webkit/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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return compositor.Pass(); 290 return compositor.Pass();
291 } 291 }
292 292
293 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) 293 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget)
294 : suppress_schedule_composite_(false), 294 : suppress_schedule_composite_(false),
295 widget_(widget) { 295 widget_(widget) {
296 } 296 }
297 297
298 RenderWidgetCompositor::~RenderWidgetCompositor() {} 298 RenderWidgetCompositor::~RenderWidgetCompositor() {}
299 299
300 const base::WeakPtr<cc::InputHandler>&
301 RenderWidgetCompositor::GetInputHandler() {
302 return layer_tree_host_->GetInputHandler();
303 }
304
300 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { 305 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) {
301 if (suppress_schedule_composite_ == suppress) 306 if (suppress_schedule_composite_ == suppress)
302 return; 307 return;
303 308
304 if (suppress) 309 if (suppress)
305 TRACE_EVENT_ASYNC_BEGIN0("gpu", 310 TRACE_EVENT_ASYNC_BEGIN0("gpu",
306 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 311 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
307 else 312 else
308 TRACE_EVENT_ASYNC_END0("gpu", 313 TRACE_EVENT_ASYNC_END0("gpu",
309 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 314 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 531
527 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { 532 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() {
528 return widget_->CreateOutputSurface(); 533 return widget_->CreateOutputSurface();
529 } 534 }
530 535
531 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) { 536 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) {
532 if (!success) 537 if (!success)
533 widget_->webwidget()->didExitCompositingMode(); 538 widget_->webwidget()->didExitCompositingMode();
534 } 539 }
535 540
536 scoped_ptr<cc::InputHandlerClient>
537 RenderWidgetCompositor::CreateInputHandlerClient() {
538 scoped_ptr<cc::InputHandlerClient> ret;
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 }
545
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 }
554 549
555 void RenderWidgetCompositor::DidCommitAndDrawFrame() { 550 void RenderWidgetCompositor::DidCommitAndDrawFrame() {
(...skipping 14 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698