| OLD | NEW |
| 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 <deque> | 10 #include <deque> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // PrecacheFetcher instance. | 145 // PrecacheFetcher instance. |
| 146 void Start(); | 146 void Start(); |
| 147 | 147 |
| 148 // Stops all precaching work. The PreacheFetcher should not be used after | 148 // Stops all precaching work. The PreacheFetcher should not be used after |
| 149 // calling this method. | 149 // calling this method. |
| 150 std::unique_ptr<PrecacheUnfinishedWork> CancelPrecaching(); | 150 std::unique_ptr<PrecacheUnfinishedWork> CancelPrecaching(); |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 friend class PrecacheFetcherTest; | 153 friend class PrecacheFetcherTest; |
| 154 FRIEND_TEST_ALL_PREFIXES(PrecacheFetcherTest, FetcherPoolMaxLimitReached); | 154 FRIEND_TEST_ALL_PREFIXES(PrecacheFetcherTest, FetcherPoolMaxLimitReached); |
| 155 FRIEND_TEST_ALL_PREFIXES(PrecacheFetcherTest, |
| 156 CancelPrecachingAfterAllManifestFetch); |
| 155 | 157 |
| 156 // Notifies the precache delete that precaching is done, and report | 158 // Notifies the precache delete that precaching is done, and report |
| 157 // completion statistics. | 159 // completion statistics. |
| 158 void NotifyDone(size_t remaining_manifest_urls_to_fetch, | 160 void NotifyDone(size_t remaining_manifest_urls_to_fetch, |
| 159 size_t remaining_resource_urls_to_fetch); | 161 size_t remaining_resource_urls_to_fetch); |
| 160 | 162 |
| 161 // Fetches the next resource or manifest URL, if any remain. Fetching is done | 163 // Fetches the next resource or manifest URL, if any remain. Fetching is done |
| 162 // sequentially and depth-first: all resources are fetched for a manifest | 164 // sequentially and depth-first: all resources are fetched for a manifest |
| 163 // before the next manifest is fetched. This is done to limit the length of | 165 // before the next manifest is fetched. This is done to limit the length of |
| 164 // the |resource_urls_to_fetch_| list, reducing the memory usage. | 166 // the |resource_urls_to_fetch_| list, reducing the memory usage. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 int64_t response_bytes_; | 288 int64_t response_bytes_; |
| 287 int64_t network_response_bytes_; | 289 int64_t network_response_bytes_; |
| 288 bool was_cached_; | 290 bool was_cached_; |
| 289 | 291 |
| 290 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 292 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
| 291 }; | 293 }; |
| 292 | 294 |
| 293 } // namespace precache | 295 } // namespace precache |
| 294 | 296 |
| 295 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ | 297 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ |
| OLD | NEW |