| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 existing_response_headers_ = headers; | 115 existing_response_headers_ = headers; |
| 116 } | 116 } |
| 117 void set_existing_entry(const AppCacheEntry& entry) { | 117 void set_existing_entry(const AppCacheEntry& entry) { |
| 118 existing_entry_ = entry; | 118 existing_entry_ = entry; |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 // URLRequest::Delegate overrides | 122 // URLRequest::Delegate overrides |
| 123 virtual void OnReceivedRedirect(net::URLRequest* request, | 123 virtual void OnReceivedRedirect(net::URLRequest* request, |
| 124 const GURL& new_url, | 124 const GURL& new_url, |
| 125 bool* defer_redirect); | 125 bool* defer_redirect) OVERRIDE; |
| 126 virtual void OnResponseStarted(net::URLRequest* request); | 126 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
| 127 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 127 virtual void OnReadCompleted(net::URLRequest* request, |
| 128 int bytes_read) OVERRIDE; |
| 128 | 129 |
| 129 void AddConditionalHeaders(const net::HttpResponseHeaders* headers); | 130 void AddConditionalHeaders(const net::HttpResponseHeaders* headers); |
| 130 void OnWriteComplete(int result); | 131 void OnWriteComplete(int result); |
| 131 void ReadResponseData(); | 132 void ReadResponseData(); |
| 132 bool ConsumeResponseData(int bytes_read); | 133 bool ConsumeResponseData(int bytes_read); |
| 133 void OnResponseCompleted(); | 134 void OnResponseCompleted(); |
| 134 bool MaybeRetryRequest(); | 135 bool MaybeRetryRequest(); |
| 135 | 136 |
| 136 GURL url_; | 137 GURL url_; |
| 137 AppCacheUpdateJob* job_; | 138 AppCacheUpdateJob* job_; |
| 138 FetchType fetch_type_; | 139 FetchType fetch_type_; |
| 139 int retry_503_attempts_; | 140 int retry_503_attempts_; |
| 140 scoped_refptr<net::IOBuffer> buffer_; | 141 scoped_refptr<net::IOBuffer> buffer_; |
| 141 scoped_ptr<net::URLRequest> request_; | 142 scoped_ptr<net::URLRequest> request_; |
| 142 AppCacheEntry existing_entry_; | 143 AppCacheEntry existing_entry_; |
| 143 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_; | 144 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_; |
| 144 std::string manifest_data_; | 145 std::string manifest_data_; |
| 145 scoped_ptr<AppCacheResponseWriter> response_writer_; | 146 scoped_ptr<AppCacheResponseWriter> response_writer_; |
| 146 net::OldCompletionCallbackImpl<URLFetcher> write_callback_; | 147 net::OldCompletionCallbackImpl<URLFetcher> write_callback_; |
| 147 }; // class URLFetcher | 148 }; // class URLFetcher |
| 148 | 149 |
| 149 AppCacheResponseWriter* CreateResponseWriter(); | 150 AppCacheResponseWriter* CreateResponseWriter(); |
| 150 | 151 |
| 151 // Methods for AppCacheStorage::Delegate. | 152 // Methods for AppCacheStorage::Delegate. |
| 152 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info, | 153 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info, |
| 153 int64 response_id); | 154 int64 response_id) OVERRIDE; |
| 154 virtual void OnGroupAndNewestCacheStored(AppCacheGroup* group, | 155 virtual void OnGroupAndNewestCacheStored(AppCacheGroup* group, |
| 155 AppCache* newest_cache, | 156 AppCache* newest_cache, |
| 156 bool success, | 157 bool success, |
| 157 bool would_exceed_quota); | 158 bool would_exceed_quota) OVERRIDE; |
| 158 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success); | 159 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) OVERRIDE; |
| 159 | 160 |
| 160 // Methods for AppCacheHost::Observer. | 161 // Methods for AppCacheHost::Observer. |
| 161 virtual void OnCacheSelectionComplete(AppCacheHost* host) {} // N/A | 162 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A |
| 162 virtual void OnDestructionImminent(AppCacheHost* host); | 163 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; |
| 163 | 164 |
| 164 void HandleCacheFailure(const std::string& error_message); | 165 void HandleCacheFailure(const std::string& error_message); |
| 165 | 166 |
| 166 void FetchManifest(bool is_first_fetch); | 167 void FetchManifest(bool is_first_fetch); |
| 167 void HandleManifestFetchCompleted(URLFetcher* fetcher); | 168 void HandleManifestFetchCompleted(URLFetcher* fetcher); |
| 168 void ContinueHandleManifestFetchCompleted(bool changed); | 169 void ContinueHandleManifestFetchCompleted(bool changed); |
| 169 | 170 |
| 170 void HandleUrlFetchCompleted(URLFetcher* fetcher); | 171 void HandleUrlFetchCompleted(URLFetcher* fetcher); |
| 171 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); | 172 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); |
| 172 | 173 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 net::OldCompletionCallbackImpl<AppCacheUpdateJob> manifest_data_read_callback_
; | 310 net::OldCompletionCallbackImpl<AppCacheUpdateJob> manifest_data_read_callback_
; |
| 310 | 311 |
| 311 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 312 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
| 312 | 313 |
| 313 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 314 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
| 314 }; | 315 }; |
| 315 | 316 |
| 316 } // namespace appcache | 317 } // namespace appcache |
| 317 | 318 |
| 318 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 319 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| OLD | NEW |