OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool success); | 97 bool success); |
98 void OnGroupMadeObsolete(AppCacheGroup* group, bool success); | 98 void OnGroupMadeObsolete(AppCacheGroup* group, bool success); |
99 | 99 |
100 // Methods for AppCacheHost::Observer. | 100 // Methods for AppCacheHost::Observer. |
101 void OnCacheSelectionComplete(AppCacheHost* host) {} // N/A | 101 void OnCacheSelectionComplete(AppCacheHost* host) {} // N/A |
102 void OnDestructionImminent(AppCacheHost* host); | 102 void OnDestructionImminent(AppCacheHost* host); |
103 | 103 |
104 void CheckPolicy(); | 104 void CheckPolicy(); |
105 void OnPolicyCheckComplete(int rv); | 105 void OnPolicyCheckComplete(int rv); |
106 | 106 |
107 void HandleCacheFailure(); | 107 void HandleCacheFailure(const std::string& error_message); |
108 | 108 |
109 void FetchManifest(bool is_first_fetch); | 109 void FetchManifest(bool is_first_fetch); |
110 | 110 |
111 // Add extra HTTP headers to the request based on the response info and | 111 // Add extra HTTP headers to the request based on the response info and |
112 // start the URL request. | 112 // start the URL request. |
113 void AddHttpHeadersAndFetch(URLRequest* request, | 113 void AddHttpHeadersAndFetch(URLRequest* request, |
114 const net::HttpResponseInfo* info); | 114 const net::HttpResponseInfo* info); |
115 | 115 |
116 void OnResponseCompleted(URLRequest* request); | 116 void OnResponseCompleted(URLRequest* request); |
117 | 117 |
(...skipping 18 matching lines...) Expand all Loading... |
136 void HandleUrlFetchCompleted(URLRequest* request); | 136 void HandleUrlFetchCompleted(URLRequest* request); |
137 void HandleMasterEntryFetchCompleted(URLRequest* request); | 137 void HandleMasterEntryFetchCompleted(URLRequest* request); |
138 | 138 |
139 void HandleManifestRefetchCompleted(URLRequest* request); | 139 void HandleManifestRefetchCompleted(URLRequest* request); |
140 void OnManifestInfoWriteComplete(int result); | 140 void OnManifestInfoWriteComplete(int result); |
141 void OnManifestDataWriteComplete(int result); | 141 void OnManifestDataWriteComplete(int result); |
142 | 142 |
143 void StoreGroupAndCache(); | 143 void StoreGroupAndCache(); |
144 | 144 |
145 void NotifySingleHost(AppCacheHost* host, EventID event_id); | 145 void NotifySingleHost(AppCacheHost* host, EventID event_id); |
146 void NotifyAllPendingMasterHosts(EventID event_id); | |
147 void NotifyAllAssociatedHosts(EventID event_id); | 146 void NotifyAllAssociatedHosts(EventID event_id); |
148 void NotifyProgress(const GURL& url); | 147 void NotifyAllProgress(const GURL& url); |
149 void NotifyFinalProgress(); | 148 void NotifyAllFinalProgress(); |
| 149 void NotifyAllError(const std::string& error_message); |
150 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); | 150 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); |
151 | 151 |
152 // Checks if manifest is byte for byte identical with the manifest | 152 // Checks if manifest is byte for byte identical with the manifest |
153 // in the newest application cache. | 153 // in the newest application cache. |
154 void CheckIfManifestChanged(); | 154 void CheckIfManifestChanged(); |
155 void OnManifestDataReadComplete(int result); | 155 void OnManifestDataReadComplete(int result); |
156 | 156 |
157 // Creates the list of files that may need to be fetched and initiates | 157 // Creates the list of files that may need to be fetched and initiates |
158 // fetches. Section 6.9.4 steps 12-17 | 158 // fetches. Section 6.9.4 steps 12-17 |
159 void BuildUrlFileList(const Manifest& manifest); | 159 void BuildUrlFileList(const Manifest& manifest); |
160 void AddUrlToFileList(const GURL& url, int type); | 160 void AddUrlToFileList(const GURL& url, int type); |
161 void FetchUrls(); | 161 void FetchUrls(); |
162 void CancelAllUrlFetches(); | 162 void CancelAllUrlFetches(); |
163 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); | 163 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); |
164 | 164 |
165 // If entry already exists in the cache currently being updated, merge | 165 // If entry already exists in the cache currently being updated, merge |
166 // the entry type information with the existing entry. | 166 // the entry type information with the existing entry. |
167 // Returns true if entry exists in cache currently being updated. | 167 // Returns true if entry exists in cache currently being updated. |
168 bool AlreadyFetchedEntry(const GURL& url, int entry_type); | 168 bool AlreadyFetchedEntry(const GURL& url, int entry_type); |
169 | 169 |
170 // TODO(jennb): Delete when update no longer fetches master entries directly. | 170 // TODO(jennb): Delete when update no longer fetches master entries directly. |
171 // Creates the list of master entries that need to be fetched and initiates | 171 // Creates the list of master entries that need to be fetched and initiates |
172 // fetches. | 172 // fetches. |
173 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, | 173 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, |
174 bool is_new); | 174 bool is_new); |
175 void FetchMasterEntries(); | 175 void FetchMasterEntries(); |
176 void CancelAllMasterEntryFetches(); | 176 void CancelAllMasterEntryFetches(const std::string& error_message); |
177 | 177 |
178 // Asynchronously loads the entry from the newest complete cache if the | 178 // Asynchronously loads the entry from the newest complete cache if the |
179 // HTTP caching semantics allow. | 179 // HTTP caching semantics allow. |
180 // Returns false if immediately obvious that data cannot be loaded from | 180 // Returns false if immediately obvious that data cannot be loaded from |
181 // newest complete cache. | 181 // newest complete cache. |
182 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); | 182 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); |
183 void LoadFromNewestCacheFailed(const GURL& url); | 183 void LoadFromNewestCacheFailed(const GURL& url); |
184 | 184 |
185 // Does nothing if update process is still waiting for pending master | 185 // Does nothing if update process is still waiting for pending master |
186 // entries or URL fetches to complete downloading. Otherwise, completes | 186 // entries or URL fetches to complete downloading. Otherwise, completes |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 scoped_refptr<net::CancelableCompletionCallback<AppCacheUpdateJob> > | 273 scoped_refptr<net::CancelableCompletionCallback<AppCacheUpdateJob> > |
274 policy_callback_; | 274 policy_callback_; |
275 | 275 |
276 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); | 276 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); |
277 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 277 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
278 }; | 278 }; |
279 | 279 |
280 } // namespace appcache | 280 } // namespace appcache |
281 | 281 |
282 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 282 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
OLD | NEW |