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

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

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 (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 24 matching lines...) Expand all
35 T* RequestQueue<T>::active_request() { 35 T* RequestQueue<T>::active_request() {
36 return active_request_.get(); 36 return active_request_.get();
37 } 37 }
38 38
39 template <typename T> 39 template <typename T>
40 int RequestQueue<T>::active_request_failure_count() { 40 int RequestQueue<T>::active_request_failure_count() {
41 return active_backoff_entry_->failure_count(); 41 return active_backoff_entry_->failure_count();
42 } 42 }
43 43
44 template <typename T> 44 template <typename T>
45 scoped_ptr<T> RequestQueue<T>::reset_active_request() { 45 std::unique_ptr<T> RequestQueue<T>::reset_active_request() {
46 active_backoff_entry_.reset(); 46 active_backoff_entry_.reset();
47 return std::move(active_request_); 47 return std::move(active_request_);
48 } 48 }
49 49
50 template <typename T> 50 template <typename T>
51 void RequestQueue<T>::ScheduleRequest(scoped_ptr<T> request) { 51 void RequestQueue<T>::ScheduleRequest(std::unique_ptr<T> request) {
52 PushImpl(std::move(request), scoped_ptr<net::BackoffEntry>( 52 PushImpl(std::move(request), std::unique_ptr<net::BackoffEntry>(
53 new net::BackoffEntry(backoff_policy_))); 53 new net::BackoffEntry(backoff_policy_)));
54 StartNextRequest(); 54 StartNextRequest();
55 } 55 }
56 56
57 template <typename T> 57 template <typename T>
58 void RequestQueue<T>::PushImpl(scoped_ptr<T> request, 58 void RequestQueue<T>::PushImpl(
59 scoped_ptr<net::BackoffEntry> backoff_entry) { 59 std::unique_ptr<T> request,
60 std::unique_ptr<net::BackoffEntry> backoff_entry) {
60 pending_requests_.push_back( 61 pending_requests_.push_back(
61 Request(backoff_entry.release(), request.release())); 62 Request(backoff_entry.release(), request.release()));
62 std::push_heap( 63 std::push_heap(
63 pending_requests_.begin(), pending_requests_.end(), CompareRequests); 64 pending_requests_.begin(), pending_requests_.end(), CompareRequests);
64 } 65 }
65 66
66 template <typename T> 67 template <typename T>
67 bool RequestQueue<T>::empty() const { 68 bool RequestQueue<T>::empty() const {
68 return pending_requests_.empty(); 69 return pending_requests_.empty();
69 } 70 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 148
148 // static 149 // static
149 template <typename T> 150 template <typename T>
150 bool RequestQueue<T>::CompareRequests(const Request& a, const Request& b) { 151 bool RequestQueue<T>::CompareRequests(const Request& a, const Request& b) {
151 return a.backoff_entry->GetReleaseTime() > b.backoff_entry->GetReleaseTime(); 152 return a.backoff_entry->GetReleaseTime() > b.backoff_entry->GetReleaseTime();
152 } 153 }
153 154
154 } // namespace extensions 155 } // namespace extensions
155 156
156 #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/updater/request_queue.h ('k') | extensions/browser/updater/safe_manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698