| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 PrecacheDelegate* precache_delegate); | 94 PrecacheDelegate* precache_delegate); |
| 95 | 95 |
| 96 virtual ~PrecacheFetcher(); | 96 virtual ~PrecacheFetcher(); |
| 97 | 97 |
| 98 // Starts fetching resources to precache. URLs are fetched sequentially. Can | 98 // Starts fetching resources to precache. URLs are fetched sequentially. Can |
| 99 // be called from any thread. Start should only be called once on a | 99 // be called from any thread. Start should only be called once on a |
| 100 // PrecacheFetcher instance. | 100 // PrecacheFetcher instance. |
| 101 void Start(); | 101 void Start(); |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 friend class PrecacheFetcherTest; |
| 105 FRIEND_TEST_ALL_PREFIXES(PrecacheFetcherTest, FetcherPoolMaxLimitReached); |
| 106 |
| 104 // Fetches the next resource or manifest URL, if any remain. Fetching is done | 107 // Fetches the next resource or manifest URL, if any remain. Fetching is done |
| 105 // sequentially and depth-first: all resources are fetched for a manifest | 108 // sequentially and depth-first: all resources are fetched for a manifest |
| 106 // before the next manifest is fetched. This is done to limit the length of | 109 // before the next manifest is fetched. This is done to limit the length of |
| 107 // the |resource_urls_to_fetch_| list, reducing the memory usage. | 110 // the |resource_urls_to_fetch_| list, reducing the memory usage. |
| 108 void StartNextFetch(); | 111 void StartNextFetch(); |
| 109 | 112 |
| 110 void StartNextManifestFetch(); | 113 void StartNextManifestFetch(); |
| 111 void StartNextResourceFetch(); | 114 void StartNextResourceFetch(); |
| 112 | 115 |
| 113 // Called when the precache configuration settings have been fetched. | 116 // Called when the precache configuration settings have been fetched. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 std::unique_ptr<net::URLFetcher> network_url_fetcher_; | 230 std::unique_ptr<net::URLFetcher> network_url_fetcher_; |
| 228 int64_t response_bytes_; | 231 int64_t response_bytes_; |
| 229 int64_t network_response_bytes_; | 232 int64_t network_response_bytes_; |
| 230 | 233 |
| 231 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 234 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
| 232 }; | 235 }; |
| 233 | 236 |
| 234 } // namespace precache | 237 } // namespace precache |
| 235 | 238 |
| 236 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ | 239 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ |
| OLD | NEW |