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

Side by Side Diff: extensions/browser/updater/request_queue_impl.h

Issue 2551723002: Replace unique_ptr.reset/release with std::move under src/extensions (Closed)
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_ 5 #ifndef EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_
6 #define EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_ 6 #define EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // pop_heap swaps the first and last elements of pending_requests_, and after 105 // pop_heap swaps the first and last elements of pending_requests_, and after
106 // that assures that the rest of pending_requests_ (excluding the 106 // that assures that the rest of pending_requests_ (excluding the
107 // now last/formerly first element) forms a proper heap. After pop_heap 107 // now last/formerly first element) forms a proper heap. After pop_heap
108 // [begin, end-1) is a valid heap, and *(end - 1) contains the element that 108 // [begin, end-1) is a valid heap, and *(end - 1) contains the element that
109 // used to be at the top of the heap. Since no elements are actually 109 // used to be at the top of the heap. Since no elements are actually
110 // removed from the container it is safe to read the entry being removed after 110 // removed from the container it is safe to read the entry being removed after
111 // pop_heap is called (but before pop_back is called). 111 // pop_heap is called (but before pop_back is called).
112 std::pop_heap( 112 std::pop_heap(
113 pending_requests_.begin(), pending_requests_.end(), CompareRequests); 113 pending_requests_.begin(), pending_requests_.end(), CompareRequests);
114 114
115 active_backoff_entry_.reset(pending_requests_.back().backoff_entry.release()); 115 active_backoff_entry_ = std::move(pending_requests_.back().backoff_entry);
116 active_request_.reset(pending_requests_.back().request.release()); 116 active_request_ = std::move(pending_requests_.back().request);
117 117
118 pending_requests_.pop_back(); 118 pending_requests_.pop_back();
119 119
120 start_request_callback_.Run(); 120 start_request_callback_.Run();
121 } 121 }
122 122
123 template <typename T> 123 template <typename T>
124 void RequestQueue<T>::RetryRequest(const base::TimeDelta& min_backoff_delay) { 124 void RequestQueue<T>::RetryRequest(const base::TimeDelta& min_backoff_delay) {
125 active_backoff_entry_->InformOfRequest(false); 125 active_backoff_entry_->InformOfRequest(false);
126 if (active_backoff_entry_->GetTimeUntilRelease() < min_backoff_delay) { 126 if (active_backoff_entry_->GetTimeUntilRelease() < min_backoff_delay) {
(...skipping 21 matching lines...) Expand all
148 148
149 // static 149 // static
150 template <typename T> 150 template <typename T>
151 bool RequestQueue<T>::CompareRequests(const Request& a, const Request& b) { 151 bool RequestQueue<T>::CompareRequests(const Request& a, const Request& b) {
152 return a.backoff_entry->GetReleaseTime() > b.backoff_entry->GetReleaseTime(); 152 return a.backoff_entry->GetReleaseTime() > b.backoff_entry->GetReleaseTime();
153 } 153 }
154 154
155 } // namespace extensions 155 } // namespace extensions
156 156
157 #endif // EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_ 157 #endif // EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/web_request/web_request_api.cc ('k') | extensions/browser/user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698