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

Side by Side Diff: ui/events/blink/compositor_thread_event_queue.cc

Issue 2546973003: Replace unique_ptr.reset/release with std::move under src/ui (Closed)
Patch Set: Whitespace formatting Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/blink/compositor_thread_event_queue.h" 5 #include "ui/events/blink/compositor_thread_event_queue.h"
6 6
7 namespace ui { 7 namespace ui {
8 8
9 CompositorThreadEventQueue::CompositorThreadEventQueue() {} 9 CompositorThreadEventQueue::CompositorThreadEventQueue() {}
10 10
11 CompositorThreadEventQueue::~CompositorThreadEventQueue() {} 11 CompositorThreadEventQueue::~CompositorThreadEventQueue() {}
12 12
13 // TODO(chongz): Support coalescing events across interleaved boundaries. 13 // TODO(chongz): Support coalescing events across interleaved boundaries.
14 // https://crbug.com/661601 14 // https://crbug.com/661601
15 void CompositorThreadEventQueue::Queue(std::unique_ptr<EventWithCallback> event, 15 void CompositorThreadEventQueue::Queue(std::unique_ptr<EventWithCallback> event,
16 base::TimeTicks timestamp_now) { 16 base::TimeTicks timestamp_now) {
17 if (!queue_.empty() && queue_.back()->CanCoalesceWith(*event)) { 17 if (!queue_.empty() && queue_.back()->CanCoalesceWith(*event)) {
18 queue_.back()->CoalesceWith(event.get(), timestamp_now); 18 queue_.back()->CoalesceWith(event.get(), timestamp_now);
19 return; 19 return;
20 } 20 }
21 21
22 queue_.emplace_back(std::move(event)); 22 queue_.emplace_back(std::move(event));
23 } 23 }
24 24
25 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { 25 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() {
26 std::unique_ptr<EventWithCallback> result; 26 std::unique_ptr<EventWithCallback> result;
27 if (!queue_.empty()) { 27 if (!queue_.empty()) {
28 result.reset(queue_.front().release()); 28 result = std::move(queue_.front());
29 queue_.pop_front(); 29 queue_.pop_front();
30 } 30 }
31 return result; 31 return result;
32 } 32 }
33 33
34 } // namespace ui 34 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698