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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility>
8 9
9 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "content/browser/renderer_host/input/gesture_event_queue.h" 14 #include "content/browser/renderer_host/input/gesture_event_queue.h"
14 #include "content/browser/renderer_host/input/input_ack_handler.h" 15 #include "content/browser/renderer_host/input/input_ack_handler.h"
15 #include "content/browser/renderer_host/input/input_router_client.h" 16 #include "content/browser/renderer_host/input/input_router_client.h"
16 #include "content/browser/renderer_host/input/touch_event_queue.h" 17 #include "content/browser/renderer_host/input/touch_event_queue.h"
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 InputRouterImpl::~InputRouterImpl() { 90 InputRouterImpl::~InputRouterImpl() {
90 STLDeleteElements(&pending_select_messages_); 91 STLDeleteElements(&pending_select_messages_);
91 } 92 }
92 93
93 bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) { 94 bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) {
94 DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart); 95 DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart);
95 switch (message->type()) { 96 switch (message->type()) {
96 // Check for types that require an ACK. 97 // Check for types that require an ACK.
97 case InputMsg_SelectRange::ID: 98 case InputMsg_SelectRange::ID:
98 case InputMsg_MoveRangeSelectionExtent::ID: 99 case InputMsg_MoveRangeSelectionExtent::ID:
99 return SendSelectMessage(message.Pass()); 100 return SendSelectMessage(std::move(message));
100 case InputMsg_MoveCaret::ID: 101 case InputMsg_MoveCaret::ID:
101 return SendMoveCaret(message.Pass()); 102 return SendMoveCaret(std::move(message));
102 case InputMsg_HandleInputEvent::ID: 103 case InputMsg_HandleInputEvent::ID:
103 NOTREACHED() << "WebInputEvents should never be sent via SendInput."; 104 NOTREACHED() << "WebInputEvents should never be sent via SendInput.";
104 return false; 105 return false;
105 default: 106 default:
106 return Send(message.release()); 107 return Send(message.release());
107 } 108 }
108 } 109 }
109 110
110 void InputRouterImpl::SendMouseEvent( 111 void InputRouterImpl::SendMouseEvent(
111 const MouseEventWithLatencyInfo& mouse_event) { 112 const MouseEventWithLatencyInfo& mouse_event) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return true; 322 return true;
322 } 323 }
323 324
324 select_message_pending_ = true; 325 select_message_pending_ = true;
325 return Send(message.release()); 326 return Send(message.release());
326 } 327 }
327 328
328 bool InputRouterImpl::SendMoveCaret(scoped_ptr<IPC::Message> message) { 329 bool InputRouterImpl::SendMoveCaret(scoped_ptr<IPC::Message> message) {
329 DCHECK(message->type() == InputMsg_MoveCaret::ID); 330 DCHECK(message->type() == InputMsg_MoveCaret::ID);
330 if (move_caret_pending_) { 331 if (move_caret_pending_) {
331 next_move_caret_ = message.Pass(); 332 next_move_caret_ = std::move(message);
332 return true; 333 return true;
333 } 334 }
334 335
335 move_caret_pending_ = true; 336 move_caret_pending_ = true;
336 return Send(message.release()); 337 return Send(message.release());
337 } 338 }
338 339
339 bool InputRouterImpl::Send(IPC::Message* message) { 340 bool InputRouterImpl::Send(IPC::Message* message) {
340 return sender_->Send(message); 341 return sender_->Send(message);
341 } 342 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 ack.unique_touch_event_id, RENDERER); 454 ack.unique_touch_event_id, RENDERER);
454 } 455 }
455 456
456 void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) { 457 void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) {
457 client_->DidOverscroll(params); 458 client_->DidOverscroll(params);
458 } 459 }
459 460
460 void InputRouterImpl::OnMsgMoveCaretAck() { 461 void InputRouterImpl::OnMsgMoveCaretAck() {
461 move_caret_pending_ = false; 462 move_caret_pending_ = false;
462 if (next_move_caret_) 463 if (next_move_caret_)
463 SendMoveCaret(next_move_caret_.Pass()); 464 SendMoveCaret(std::move(next_move_caret_));
464 } 465 }
465 466
466 void InputRouterImpl::OnSelectMessageAck() { 467 void InputRouterImpl::OnSelectMessageAck() {
467 select_message_pending_ = false; 468 select_message_pending_ = false;
468 if (!pending_select_messages_.empty()) { 469 if (!pending_select_messages_.empty()) {
469 scoped_ptr<IPC::Message> next_message = 470 scoped_ptr<IPC::Message> next_message =
470 make_scoped_ptr(pending_select_messages_.front()); 471 make_scoped_ptr(pending_select_messages_.front());
471 pending_select_messages_.pop_front(); 472 pending_select_messages_.pop_front();
472 473
473 SendSelectMessage(next_message.Pass()); 474 SendSelectMessage(std::move(next_message));
474 } 475 }
475 } 476 }
476 477
477 void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) { 478 void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) {
478 TRACE_EVENT1("input", "InputRouterImpl::OnHasTouchEventHandlers", 479 TRACE_EVENT1("input", "InputRouterImpl::OnHasTouchEventHandlers",
479 "has_handlers", has_handlers); 480 "has_handlers", has_handlers);
480 481
481 // Lack of a touch handler indicates that the page either has no touch-action 482 // Lack of a touch handler indicates that the page either has no touch-action
482 // modifiers or that all its touch-action modifiers are auto. Resetting the 483 // modifiers or that all its touch-action modifiers are auto. Resetting the
483 // touch-action here allows forwarding of subsequent gestures even if the 484 // touch-action here allows forwarding of subsequent gestures even if the
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return; 579 return;
579 580
580 current_mouse_move_.latency.AddNewLatencyFrom(latency); 581 current_mouse_move_.latency.AddNewLatencyFrom(latency);
581 ack_handler_->OnMouseEventAck(current_mouse_move_, ack_result); 582 ack_handler_->OnMouseEventAck(current_mouse_move_, ack_result);
582 583
583 DCHECK(mouse_move_pending_); 584 DCHECK(mouse_move_pending_);
584 mouse_move_pending_ = false; 585 mouse_move_pending_ = false;
585 586
586 if (next_mouse_move_) { 587 if (next_mouse_move_) {
587 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); 588 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove);
588 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move 589 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move =
589 = next_mouse_move_.Pass(); 590 std::move(next_mouse_move_);
590 SendMouseEvent(*next_mouse_move); 591 SendMouseEvent(*next_mouse_move);
591 } 592 }
592 } 593 }
593 594
594 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result, 595 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result,
595 const ui::LatencyInfo& latency) { 596 const ui::LatencyInfo& latency) {
596 // TODO(miletus): Add renderer side latency to each uncoalesced mouse 597 // TODO(miletus): Add renderer side latency to each uncoalesced mouse
597 // wheel event and add terminal component to each of them. 598 // wheel event and add terminal component to each of them.
598 current_wheel_event_.latency.AddNewLatencyFrom(latency); 599 current_wheel_event_.latency.AddNewLatencyFrom(latency);
599 600
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 return; 651 return;
651 652
652 if (HasPendingEvents()) 653 if (HasPendingEvents())
653 return; 654 return;
654 655
655 flush_requested_ = false; 656 flush_requested_ = false;
656 client_->DidFlush(); 657 client_->DidFlush();
657 } 658 }
658 659
659 } // namespace content 660 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698