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

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: address feedback 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return compositor.Pass(); 292 return compositor.Pass();
293 } 293 }
294 294
295 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget) 295 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget)
296 : suppress_schedule_composite_(false), 296 : suppress_schedule_composite_(false),
297 widget_(widget) { 297 widget_(widget) {
298 } 298 }
299 299
300 RenderWidgetCompositor::~RenderWidgetCompositor() {} 300 RenderWidgetCompositor::~RenderWidgetCompositor() {}
301 301
302 const base::WeakPtr<cc::InputHandler>&
303 RenderWidgetCompositor::GetInputHandler() {
304 return layer_tree_host_->GetInputHandler();
305 }
306
302 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { 307 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) {
303 if (suppress_schedule_composite_ == suppress) 308 if (suppress_schedule_composite_ == suppress)
304 return; 309 return;
305 310
306 if (suppress) 311 if (suppress)
307 TRACE_EVENT_ASYNC_BEGIN0("gpu", 312 TRACE_EVENT_ASYNC_BEGIN0("gpu",
308 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 313 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
309 else 314 else
310 TRACE_EVENT_ASYNC_END0("gpu", 315 TRACE_EVENT_ASYNC_END0("gpu",
311 "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 316 "RenderWidgetCompositor::SetSuppressScheduleComposite", this);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 533
529 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() { 534 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface() {
530 return widget_->CreateOutputSurface(); 535 return widget_->CreateOutputSurface();
531 } 536 }
532 537
533 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) { 538 void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) {
534 if (!success) 539 if (!success)
535 widget_->webwidget()->didExitCompositingMode(); 540 widget_->webwidget()->didExitCompositingMode();
536 } 541 }
537 542
538 scoped_ptr<cc::InputHandlerClient>
539 RenderWidgetCompositor::CreateInputHandlerClient() {
540 scoped_ptr<cc::InputHandlerClient> ret;
541 scoped_ptr<WebKit::WebInputHandler> web_handler(
542 widget_->webwidget()->createInputHandler());
543 if (web_handler)
544 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass());
545 return ret.Pass();
546 }
547
548 void RenderWidgetCompositor::WillCommit() { 543 void RenderWidgetCompositor::WillCommit() {
549 widget_->InstrumentWillComposite(); 544 widget_->InstrumentWillComposite();
550 } 545 }
551 546
552 void RenderWidgetCompositor::DidCommit() { 547 void RenderWidgetCompositor::DidCommit() {
553 widget_->DidCommitCompositorFrame(); 548 widget_->DidCommitCompositorFrame();
554 widget_->didBecomeReadyForAdditionalInput(); 549 widget_->didBecomeReadyForAdditionalInput();
555 } 550 }
556 551
557 void RenderWidgetCompositor::DidCommitAndDrawFrame() { 552 void RenderWidgetCompositor::DidCommitAndDrawFrame() {
(...skipping 14 matching lines...) Expand all
572 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); 567 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread();
573 } 568 }
574 569
575 scoped_refptr<cc::ContextProvider> 570 scoped_refptr<cc::ContextProvider>
576 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { 571 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() {
577 return RenderThreadImpl::current()-> 572 return RenderThreadImpl::current()->
578 OffscreenContextProviderForCompositorThread(); 573 OffscreenContextProviderForCompositorThread();
579 } 574 }
580 575
581 } // namespace content 576 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698