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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_controller.h

Issue 1415223007: Utilize std::move(scoped_ptr) while using it with ScopedVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving build issues Created 4 years, 10 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 | « AUTHORS ('k') | content/browser/renderer_host/media/audio_input_sync_writer.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 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 scoped_ptr<SyntheticGesture::Result> pending_gesture_result_; 53 scoped_ptr<SyntheticGesture::Result> pending_gesture_result_;
54 54
55 // A queue of gesture/callback pairs. Implemented as two queues to 55 // A queue of gesture/callback pairs. Implemented as two queues to
56 // simplify the ownership of SyntheticGesture pointers. 56 // simplify the ownership of SyntheticGesture pointers.
57 class GestureAndCallbackQueue { 57 class GestureAndCallbackQueue {
58 public: 58 public:
59 GestureAndCallbackQueue(); 59 GestureAndCallbackQueue();
60 ~GestureAndCallbackQueue(); 60 ~GestureAndCallbackQueue();
61 void Push(scoped_ptr<SyntheticGesture> gesture, 61 void Push(scoped_ptr<SyntheticGesture> gesture,
62 const OnGestureCompleteCallback& callback) { 62 const OnGestureCompleteCallback& callback) {
63 gestures_.push_back(gesture.release()); 63 gestures_.push_back(std::move(gesture));
64 callbacks_.push(callback); 64 callbacks_.push(callback);
65 } 65 }
66 void Pop() { 66 void Pop() {
67 gestures_.erase(gestures_.begin()); 67 gestures_.erase(gestures_.begin());
68 callbacks_.pop(); 68 callbacks_.pop();
69 } 69 }
70 SyntheticGesture* FrontGesture() { 70 SyntheticGesture* FrontGesture() {
71 return gestures_.front(); 71 return gestures_.front();
72 } 72 }
73 OnGestureCompleteCallback& FrontCallback() { 73 OnGestureCompleteCallback& FrontCallback() {
74 return callbacks_.front(); 74 return callbacks_.front();
75 } 75 }
76 bool IsEmpty() { 76 bool IsEmpty() {
77 CHECK(gestures_.empty() == callbacks_.empty()); 77 CHECK(gestures_.empty() == callbacks_.empty());
78 return gestures_.empty(); 78 return gestures_.empty();
79 } 79 }
80 private: 80 private:
81 ScopedVector<SyntheticGesture> gestures_; 81 ScopedVector<SyntheticGesture> gestures_;
82 std::queue<OnGestureCompleteCallback> callbacks_; 82 std::queue<OnGestureCompleteCallback> callbacks_;
83 } pending_gesture_queue_; 83 } pending_gesture_queue_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); 85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController);
86 }; 86 };
87 87
88 } // namespace content 88 } // namespace content
89 89
90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | content/browser/renderer_host/media/audio_input_sync_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698