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

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

Issue 2294653002: Some linked_ptr -> unique_ptr conversion in extensions/browser. (Closed)
Patch Set: address comments Created 4 years, 3 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_H_ 5 #ifndef EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_H_
6 #define EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_H_ 6 #define EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/memory/linked_ptr.h"
16 #include "base/time/time.h" 15 #include "base/time/time.h"
17 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
18 #include "net/base/backoff_entry.h" 17 #include "net/base/backoff_entry.h"
19 18
20 namespace extensions { 19 namespace extensions {
21 20
22 // This class keeps track of a queue of requests, and contains the logic to 21 // This class keeps track of a queue of requests, and contains the logic to
23 // retry requests with some backoff policy. Each request has a 22 // retry requests with some backoff policy. Each request has a
24 // net::BackoffEntry instance associated with it. 23 // net::BackoffEntry instance associated with it.
25 // 24 //
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 iterator begin(); 77 iterator begin();
79 iterator end(); 78 iterator end();
80 79
81 // Change the backoff policy used by the queue. 80 // Change the backoff policy used by the queue.
82 void set_backoff_policy(const net::BackoffEntry::Policy* backoff_policy); 81 void set_backoff_policy(const net::BackoffEntry::Policy* backoff_policy);
83 82
84 private: 83 private:
85 struct Request { 84 struct Request {
86 Request(net::BackoffEntry* backoff_entry, T* request) 85 Request(net::BackoffEntry* backoff_entry, T* request)
87 : backoff_entry(backoff_entry), request(request) {} 86 : backoff_entry(backoff_entry), request(request) {}
88 linked_ptr<net::BackoffEntry> backoff_entry; 87 std::unique_ptr<net::BackoffEntry> backoff_entry;
89 linked_ptr<T> request; 88 std::unique_ptr<T> request;
90 }; 89 };
91 90
92 // Compares the release time of two pending requests. 91 // Compares the release time of two pending requests.
93 static bool CompareRequests(const Request& a, const Request& b); 92 static bool CompareRequests(const Request& a, const Request& b);
94 93
95 // Pushes a request with a given backoff entry onto the queue. 94 // Pushes a request with a given backoff entry onto the queue.
96 void PushImpl(std::unique_ptr<T> request, 95 void PushImpl(std::unique_ptr<T> request,
97 std::unique_ptr<net::BackoffEntry> backoff_entry); 96 std::unique_ptr<net::BackoffEntry> backoff_entry);
98 97
99 // The backoff policy used to determine backoff delays. 98 // The backoff policy used to determine backoff delays.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 typedef std::deque<typename RequestQueue<T>::Request> Container; 134 typedef std::deque<typename RequestQueue<T>::Request> Container;
136 135
137 explicit iterator(const typename Container::iterator& it) : it_(it) {} 136 explicit iterator(const typename Container::iterator& it) : it_(it) {}
138 137
139 typename Container::iterator it_; 138 typename Container::iterator it_;
140 }; 139 };
141 140
142 } // namespace extensions 141 } // namespace extensions
143 142
144 #endif // EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_H_ 143 #endif // EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_H_
OLDNEW
« no previous file with comments | « extensions/browser/updater/extension_downloader.cc ('k') | extensions/browser/value_store/value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698