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

Side by Side Diff: components/precache/core/precache_fetcher.h

Issue 1921923002: Convert //components/[o-t]* 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 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 COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ 5 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_
6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ 6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <list> 11 #include <list>
12 #include <memory>
12 #include <string> 13 #include <string>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/callback.h" 16 #include "base/callback.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "components/precache/core/fetcher_pool.h" 20 #include "components/precache/core/fetcher_pool.h"
21 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
22 #include "net/url_request/url_fetcher_delegate.h" 22 #include "net/url_request/url_fetcher_delegate.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace net { 25 namespace net {
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
27 } 27 }
28 28
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // const std::list<GURL>& top_urls) { 61 // const std::list<GURL>& top_urls) {
62 // fetcher_.reset(new PrecacheFetcher(request_context, top_urls, this)); 62 // fetcher_.reset(new PrecacheFetcher(request_context, top_urls, this));
63 // fetcher_->Start(); 63 // fetcher_->Start();
64 // } 64 // }
65 // 65 //
66 // virtual void OnDone() { 66 // virtual void OnDone() {
67 // // Do something when precaching is done. 67 // // Do something when precaching is done.
68 // } 68 // }
69 // 69 //
70 // private: 70 // private:
71 // scoped_ptr<PrecacheFetcher> fetcher_; 71 // std::unique_ptr<PrecacheFetcher> fetcher_;
72 // }; 72 // };
73 class PrecacheFetcher { 73 class PrecacheFetcher {
74 public: 74 public:
75 class PrecacheDelegate { 75 class PrecacheDelegate {
76 public: 76 public:
77 // Called when the fetching of resources has finished, whether the resources 77 // Called when the fetching of resources has finished, whether the resources
78 // were fetched or not. If the PrecacheFetcher is destroyed before OnDone is 78 // were fetched or not. If the PrecacheFetcher is destroyed before OnDone is
79 // called, then precaching will be canceled and OnDone will not be called. 79 // called, then precaching will be canceled and OnDone will not be called.
80 virtual void OnDone() = 0; 80 virtual void OnDone() = 0;
81 }; 81 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // default flag-specified URL will be used. 138 // default flag-specified URL will be used.
139 const GURL config_url_; 139 const GURL config_url_;
140 140
141 // The custom URL prefix to use when fetching manifests. If not provided, the 141 // The custom URL prefix to use when fetching manifests. If not provided, the
142 // default flag-specified prefix will be used. 142 // default flag-specified prefix will be used.
143 const std::string manifest_url_prefix_; 143 const std::string manifest_url_prefix_;
144 144
145 // Non-owning pointer. Should not be NULL. 145 // Non-owning pointer. Should not be NULL.
146 PrecacheDelegate* precache_delegate_; 146 PrecacheDelegate* precache_delegate_;
147 147
148 scoped_ptr<PrecacheConfigurationSettings> config_; 148 std::unique_ptr<PrecacheConfigurationSettings> config_;
149 149
150 // Tally of the total number of bytes contained in URL fetches, including 150 // Tally of the total number of bytes contained in URL fetches, including
151 // config, manifests, and resources. This the number of bytes as they would be 151 // config, manifests, and resources. This the number of bytes as they would be
152 // compressed over the network. 152 // compressed over the network.
153 size_t total_response_bytes_; 153 size_t total_response_bytes_;
154 154
155 // Tally of the total number of bytes received over the network from URL 155 // Tally of the total number of bytes received over the network from URL
156 // fetches (the same ones as in total_response_bytes_). This includes response 156 // fetches (the same ones as in total_response_bytes_). This includes response
157 // headers and intermediate responses such as 30xs. 157 // headers and intermediate responses such as 30xs.
158 size_t network_response_bytes_; 158 size_t network_response_bytes_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void LoadFromNetwork(); 216 void LoadFromNetwork();
217 217
218 net::URLRequestContextGetter* const request_context_; 218 net::URLRequestContextGetter* const request_context_;
219 const GURL url_; 219 const GURL url_;
220 const base::Callback<void(const Fetcher&)> callback_; 220 const base::Callback<void(const Fetcher&)> callback_;
221 const bool is_resource_request_; 221 const bool is_resource_request_;
222 const size_t max_bytes_; 222 const size_t max_bytes_;
223 223
224 FetchStage fetch_stage_; 224 FetchStage fetch_stage_;
225 // The cache_url_fetcher_ is kept alive until Fetcher destruction for testing. 225 // The cache_url_fetcher_ is kept alive until Fetcher destruction for testing.
226 scoped_ptr<net::URLFetcher> cache_url_fetcher_; 226 std::unique_ptr<net::URLFetcher> cache_url_fetcher_;
227 scoped_ptr<net::URLFetcher> network_url_fetcher_; 227 std::unique_ptr<net::URLFetcher> network_url_fetcher_;
228 int64_t response_bytes_; 228 int64_t response_bytes_;
229 int64_t network_response_bytes_; 229 int64_t network_response_bytes_;
230 230
231 DISALLOW_COPY_AND_ASSIGN(Fetcher); 231 DISALLOW_COPY_AND_ASSIGN(Fetcher);
232 }; 232 };
233 233
234 } // namespace precache 234 } // namespace precache
235 235
236 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ 236 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_
OLDNEW
« no previous file with comments | « components/precache/core/precache_database_unittest.cc ('k') | components/precache/core/precache_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698