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

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

Issue 2435863004: Remove stl_util's deletion function use from content/. (Closed)
Patch Set: minus service worker Created 4 years, 2 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 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 touch_event_queue_(this, config.touch_config), 91 touch_event_queue_(this, config.touch_config),
92 gesture_event_queue_(this, this, config.gesture_config), 92 gesture_event_queue_(this, this, config.gesture_config),
93 device_scale_factor_(1.f) { 93 device_scale_factor_(1.f) {
94 DCHECK(sender); 94 DCHECK(sender);
95 DCHECK(client); 95 DCHECK(client);
96 DCHECK(ack_handler); 96 DCHECK(ack_handler);
97 UpdateTouchAckTimeoutEnabled(); 97 UpdateTouchAckTimeoutEnabled();
98 } 98 }
99 99
100 InputRouterImpl::~InputRouterImpl() { 100 InputRouterImpl::~InputRouterImpl() {
101 STLDeleteElements(&pending_select_messages_);
102 } 101 }
103 102
104 bool InputRouterImpl::SendInput(std::unique_ptr<IPC::Message> message) { 103 bool InputRouterImpl::SendInput(std::unique_ptr<IPC::Message> message) {
105 DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart); 104 DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart);
106 switch (message->type()) { 105 switch (message->type()) {
107 // Check for types that require an ACK. 106 // Check for types that require an ACK.
108 case InputMsg_SelectRange::ID: 107 case InputMsg_SelectRange::ID:
109 case InputMsg_MoveRangeSelectionExtent::ID: 108 case InputMsg_MoveRangeSelectionExtent::ID:
110 return SendSelectMessage(std::move(message)); 109 return SendSelectMessage(std::move(message));
111 case InputMsg_MoveCaret::ID: 110 case InputMsg_MoveCaret::ID:
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 311
313 bool InputRouterImpl::SendSelectMessage(std::unique_ptr<IPC::Message> message) { 312 bool InputRouterImpl::SendSelectMessage(std::unique_ptr<IPC::Message> message) {
314 DCHECK(message->type() == InputMsg_SelectRange::ID || 313 DCHECK(message->type() == InputMsg_SelectRange::ID ||
315 message->type() == InputMsg_MoveRangeSelectionExtent::ID); 314 message->type() == InputMsg_MoveRangeSelectionExtent::ID);
316 315
317 // TODO(jdduke): Factor out common logic between selection and caret-related 316 // TODO(jdduke): Factor out common logic between selection and caret-related
318 // IPC messages. 317 // IPC messages.
319 if (select_message_pending_) { 318 if (select_message_pending_) {
320 if (!pending_select_messages_.empty() && 319 if (!pending_select_messages_.empty() &&
321 pending_select_messages_.back()->type() == message->type()) { 320 pending_select_messages_.back()->type() == message->type()) {
322 delete pending_select_messages_.back();
323 pending_select_messages_.pop_back(); 321 pending_select_messages_.pop_back();
324 } 322 }
325 323
326 pending_select_messages_.push_back(message.release()); 324 pending_select_messages_.push_back(std::move(message));
327 return true; 325 return true;
328 } 326 }
329 327
330 select_message_pending_ = true; 328 select_message_pending_ = true;
331 return Send(message.release()); 329 return Send(message.release());
332 } 330 }
333 331
334 bool InputRouterImpl::SendMoveCaret(std::unique_ptr<IPC::Message> message) { 332 bool InputRouterImpl::SendMoveCaret(std::unique_ptr<IPC::Message> message) {
335 DCHECK(message->type() == InputMsg_MoveCaret::ID); 333 DCHECK(message->type() == InputMsg_MoveCaret::ID);
336 if (move_caret_pending_) { 334 if (move_caret_pending_) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 void InputRouterImpl::OnMsgMoveCaretAck() { 457 void InputRouterImpl::OnMsgMoveCaretAck() {
460 move_caret_pending_ = false; 458 move_caret_pending_ = false;
461 if (next_move_caret_) 459 if (next_move_caret_)
462 SendMoveCaret(std::move(next_move_caret_)); 460 SendMoveCaret(std::move(next_move_caret_));
463 } 461 }
464 462
465 void InputRouterImpl::OnSelectMessageAck() { 463 void InputRouterImpl::OnSelectMessageAck() {
466 select_message_pending_ = false; 464 select_message_pending_ = false;
467 if (!pending_select_messages_.empty()) { 465 if (!pending_select_messages_.empty()) {
468 std::unique_ptr<IPC::Message> next_message = 466 std::unique_ptr<IPC::Message> next_message =
469 base::WrapUnique(pending_select_messages_.front()); 467 std::move(pending_select_messages_.front());
470 pending_select_messages_.pop_front(); 468 pending_select_messages_.pop_front();
471 469
472 SendSelectMessage(std::move(next_message)); 470 SendSelectMessage(std::move(next_message));
473 } 471 }
474 } 472 }
475 473
476 void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) { 474 void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) {
477 TRACE_EVENT1("input", "InputRouterImpl::OnHasTouchEventHandlers", 475 TRACE_EVENT1("input", "InputRouterImpl::OnHasTouchEventHandlers",
478 "has_handlers", has_handlers); 476 "has_handlers", has_handlers);
479 477
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 627
630 flush_requested_ = false; 628 flush_requested_ = false;
631 client_->DidFlush(); 629 client_->DidFlush();
632 } 630 }
633 631
634 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { 632 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) {
635 frame_tree_node_id_ = frameTreeNodeId; 633 frame_tree_node_id_ = frameTreeNodeId;
636 } 634 }
637 635
638 } // namespace content 636 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/input_router_impl.h ('k') | content/browser/renderer_host/input/mouse_wheel_event_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698