| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // std::unique_ptr<PrecacheFetcher> fetcher_; | 121 // std::unique_ptr<PrecacheFetcher> fetcher_; |
| 122 // }; | 122 // }; |
| 123 class PrecacheFetcher : public base::SupportsWeakPtr<PrecacheFetcher> { | 123 class PrecacheFetcher : public base::SupportsWeakPtr<PrecacheFetcher> { |
| 124 public: | 124 public: |
| 125 class PrecacheDelegate { | 125 class PrecacheDelegate { |
| 126 public: | 126 public: |
| 127 // Called when the fetching of resources has finished, whether the resources | 127 // Called when the fetching of resources has finished, whether the resources |
| 128 // were fetched or not. If the PrecacheFetcher is destroyed before OnDone is | 128 // were fetched or not. If the PrecacheFetcher is destroyed before OnDone is |
| 129 // called, then precaching will be canceled and OnDone will not be called. | 129 // called, then precaching will be canceled and OnDone will not be called. |
| 130 virtual void OnDone() = 0; | 130 virtual void OnDone() = 0; |
| 131 |
| 132 // Called when a precache manifest has been successfully fetched and parsed. |
| 133 virtual void OnManifestFetched(const std::string& host, |
| 134 const PrecacheManifest& manifest) = 0; |
| 131 }; | 135 }; |
| 132 | 136 |
| 133 // Visible for testing. | 137 // Visible for testing. |
| 134 class Fetcher; | 138 class Fetcher; |
| 135 | 139 |
| 136 static void RecordCompletionStatistics( | 140 static void RecordCompletionStatistics( |
| 137 const PrecacheUnfinishedWork& unfinished_work, | 141 const PrecacheUnfinishedWork& unfinished_work, |
| 138 size_t remaining_manifest_urls_to_fetch, | 142 size_t remaining_manifest_urls_to_fetch, |
| 139 size_t remaining_resource_urls_to_fetch); | 143 size_t remaining_resource_urls_to_fetch); |
| 140 | 144 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 int64_t response_bytes_; | 360 int64_t response_bytes_; |
| 357 int64_t network_response_bytes_; | 361 int64_t network_response_bytes_; |
| 358 bool was_cached_; | 362 bool was_cached_; |
| 359 | 363 |
| 360 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 364 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
| 361 }; | 365 }; |
| 362 | 366 |
| 363 } // namespace precache | 367 } // namespace precache |
| 364 | 368 |
| 365 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ | 369 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_FETCHER_H_ |
| OLD | NEW |