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

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

Issue 15927023: Explicit interface for synchronous InputHandlerProxy input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
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/input_handler_proxy.h" 5 #include "content/renderer/gpu/input_handler_proxy.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/renderer/gpu/input_handler_proxy_client.h" 9 #include "content/renderer/gpu/input_handler_proxy_client.h"
10 #include "third_party/WebKit/public/platform/Platform.h" 10 #include "third_party/WebKit/public/platform/Platform.h"
(...skipping 28 matching lines...) Expand all
39 input_handler_ = NULL; 39 input_handler_ = NULL;
40 DCHECK(client_); 40 DCHECK(client_);
41 client_->WillShutdown(); 41 client_->WillShutdown();
42 } 42 }
43 43
44 void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) { 44 void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) {
45 DCHECK(!client_ || !client); 45 DCHECK(!client_ || !client);
46 client_ = client; 46 client_ = client;
47 } 47 }
48 48
49 void InputHandlerProxy::HandleInputEvent(const WebInputEvent& event) { 49 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
50 const WebInputEvent& event) {
50 DCHECK(client_); 51 DCHECK(client_);
51 DCHECK(input_handler_); 52 DCHECK(input_handler_);
52 53
53 InputHandlerProxy::EventDisposition disposition = 54 InputHandlerProxy::EventDisposition disposition =
54 HandleInputEventInternal(event); 55 HandleInputEventInternal(event);
55 switch (disposition) {
56 case DidHandle:
57 client_->DidHandleInputEvent();
58 break;
59 case DidNotHandle:
60 client_->DidNotHandleInputEvent(true /* send_to_widget */);
61 break;
62 case DropEvent:
63 client_->DidNotHandleInputEvent(false /* send_to_widget */);
64 break;
65 }
66 if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) { 56 if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) {
67 input_handler_->DidReceiveLastInputEventForBeginFrame( 57 input_handler_->DidReceiveLastInputEventForBeginFrame(
68 base::TimeTicks::FromInternalValue(event.timeStampSeconds * 58 base::TimeTicks::FromInternalValue(event.timeStampSeconds *
69 base::Time::kMicrosecondsPerSecond)); 59 base::Time::kMicrosecondsPerSecond));
70 } 60 }
61 return disposition;
71 } 62 }
72 63
73 InputHandlerProxy::EventDisposition 64 InputHandlerProxy::EventDisposition
74 InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) { 65 InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
75 if (event.type == WebInputEvent::MouseWheel) { 66 if (event.type == WebInputEvent::MouseWheel) {
76 const WebMouseWheelEvent& wheel_event = 67 const WebMouseWheelEvent& wheel_event =
77 *static_cast<const WebMouseWheelEvent*>(&event); 68 *static_cast<const WebMouseWheelEvent*>(&event);
78 if (wheel_event.scrollByPage) { 69 if (wheel_event.scrollByPage) {
79 // TODO(jamesr): We don't properly handle scroll by page in the compositor 70 // TODO(jamesr): We don't properly handle scroll by page in the compositor
80 // thread, so punt it to the main thread. http://crbug.com/236639 71 // thread, so punt it to the main thread. http://crbug.com/236639
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 TRACE_EVENT2("renderer", 393 TRACE_EVENT2("renderer",
403 "InputHandlerProxy::notifyCurrentFlingVelocity", 394 "InputHandlerProxy::notifyCurrentFlingVelocity",
404 "vx", 395 "vx",
405 velocity.width, 396 velocity.width,
406 "vy", 397 "vy",
407 velocity.height); 398 velocity.height);
408 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); 399 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity));
409 } 400 }
410 401
411 } // namespace content 402 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698