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

Side by Side Diff: ui/events/gesture_detection/motion_event_buffer.cc

Issue 1138993007: Substituting pattern push_back(ptr.release()) with push_back(ptr.Pass()) in ui/events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated the review comments Created 5 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
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event_generic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/gesture_detection/motion_event_buffer.h" 5 #include "ui/events/gesture_detection/motion_event_buffer.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "ui/events/gesture_detection/motion_event_generic.h" 8 #include "ui/events/gesture_detection/motion_event_generic.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // artificially synthesized. 254 // artificially synthesized.
255 if (!last_extrapolated_event_time_.is_null()) { 255 if (!last_extrapolated_event_time_.is_null()) {
256 DCHECK(buffered_events_.empty()); 256 DCHECK(buffered_events_.empty());
257 if (event.GetEventTime() < last_extrapolated_event_time_) 257 if (event.GetEventTime() < last_extrapolated_event_time_)
258 return; 258 return;
259 last_extrapolated_event_time_ = base::TimeTicks(); 259 last_extrapolated_event_time_ = base::TimeTicks();
260 } 260 }
261 261
262 scoped_ptr<MotionEventGeneric> clone = MotionEventGeneric::CloneEvent(event); 262 scoped_ptr<MotionEventGeneric> clone = MotionEventGeneric::CloneEvent(event);
263 if (buffered_events_.empty()) { 263 if (buffered_events_.empty()) {
264 buffered_events_.push_back(clone.release()); 264 buffered_events_.push_back(clone.Pass());
265 client_->SetNeedsFlush(); 265 client_->SetNeedsFlush();
266 return; 266 return;
267 } 267 }
268 268
269 if (CanAddSample(*buffered_events_.front(), *clone)) { 269 if (CanAddSample(*buffered_events_.front(), *clone)) {
270 DCHECK(buffered_events_.back()->GetEventTime() <= clone->GetEventTime()); 270 DCHECK(buffered_events_.back()->GetEventTime() <= clone->GetEventTime());
271 } else { 271 } else {
272 FlushWithoutResampling(buffered_events_.Pass()); 272 FlushWithoutResampling(buffered_events_.Pass());
273 } 273 }
274 274
275 buffered_events_.push_back(clone.release()); 275 buffered_events_.push_back(clone.Pass());
276 // No need to request another flush as the first event will have requested it. 276 // No need to request another flush as the first event will have requested it.
277 } 277 }
278 278
279 void MotionEventBuffer::Flush(base::TimeTicks frame_time) { 279 void MotionEventBuffer::Flush(base::TimeTicks frame_time) {
280 if (buffered_events_.empty()) 280 if (buffered_events_.empty())
281 return; 281 return;
282 282
283 // Shifting the sample time back slightly minimizes the potential for 283 // Shifting the sample time back slightly minimizes the potential for
284 // misprediction when extrapolating events. 284 // misprediction when extrapolating events.
285 if (resample_) 285 if (resample_)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 void MotionEventBuffer::FlushWithoutResampling(MotionEventVector events) { 332 void MotionEventBuffer::FlushWithoutResampling(MotionEventVector events) {
333 last_extrapolated_event_time_ = base::TimeTicks(); 333 last_extrapolated_event_time_ = base::TimeTicks();
334 if (events.empty()) 334 if (events.empty())
335 return; 335 return;
336 336
337 client_->ForwardMotionEvent(*ConsumeSamples(events.Pass())); 337 client_->ForwardMotionEvent(*ConsumeSamples(events.Pass()));
338 } 338 }
339 339
340 } // namespace ui 340 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event_generic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698