| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 AppCacheHost* host, | 45 AppCacheHost* host, |
| 46 bool is_main_resource, | 46 bool is_main_resource, |
| 47 const OnPrepareToRestartCallback& restart_callback_); | 47 const OnPrepareToRestartCallback& restart_callback_); |
| 48 | 48 |
| 49 ~AppCacheURLRequestJob() override; | 49 ~AppCacheURLRequestJob() override; |
| 50 | 50 |
| 51 // Informs the job of what response it should deliver. Only one of these | 51 // Informs the job of what response it should deliver. Only one of these |
| 52 // methods should be called, and only once per job. A job will sit idle and | 52 // methods should be called, and only once per job. A job will sit idle and |
| 53 // wait indefinitely until one of the deliver methods is called. | 53 // wait indefinitely until one of the deliver methods is called. |
| 54 void DeliverAppCachedResponse(const GURL& manifest_url, | 54 void DeliverAppCachedResponse(const GURL& manifest_url, |
| 55 int64_t group_id, | |
| 56 int64_t cache_id, | 55 int64_t cache_id, |
| 57 const AppCacheEntry& entry, | 56 const AppCacheEntry& entry, |
| 58 bool is_fallback); | 57 bool is_fallback); |
| 59 void DeliverNetworkResponse(); | 58 void DeliverNetworkResponse(); |
| 60 void DeliverErrorResponse(); | 59 void DeliverErrorResponse(); |
| 61 | 60 |
| 62 bool is_waiting() const { | 61 bool is_waiting() const { |
| 63 return delivery_type_ == AWAITING_DELIVERY_ORDERS; | 62 return delivery_type_ == AWAITING_DELIVERY_ORDERS; |
| 64 } | 63 } |
| 65 | 64 |
| 66 bool is_delivering_appcache_response() const { | 65 bool is_delivering_appcache_response() const { |
| 67 return delivery_type_ == APPCACHED_DELIVERY; | 66 return delivery_type_ == APPCACHED_DELIVERY; |
| 68 } | 67 } |
| 69 | 68 |
| 70 bool is_delivering_network_response() const { | 69 bool is_delivering_network_response() const { |
| 71 return delivery_type_ == NETWORK_DELIVERY; | 70 return delivery_type_ == NETWORK_DELIVERY; |
| 72 } | 71 } |
| 73 | 72 |
| 74 bool is_delivering_error_response() const { | 73 bool is_delivering_error_response() const { |
| 75 return delivery_type_ == ERROR_DELIVERY; | 74 return delivery_type_ == ERROR_DELIVERY; |
| 76 } | 75 } |
| 77 | 76 |
| 78 // Accessors for the info about the appcached response, if any, | 77 // Accessors for the info about the appcached response, if any, |
| 79 // that this job has been instructed to deliver. These are only | 78 // that this job has been instructed to deliver. These are only |
| 80 // valid to call if is_delivering_appcache_response. | 79 // valid to call if is_delivering_appcache_response. |
| 81 const GURL& manifest_url() const { return manifest_url_; } | 80 const GURL& manifest_url() const { return manifest_url_; } |
| 82 int64_t group_id() const { return group_id_; } | |
| 83 int64_t cache_id() const { return cache_id_; } | 81 int64_t cache_id() const { return cache_id_; } |
| 84 const AppCacheEntry& entry() const { return entry_; } | 82 const AppCacheEntry& entry() const { return entry_; } |
| 85 | 83 |
| 86 // net::URLRequestJob's Kill method is made public so the users of this | 84 // net::URLRequestJob's Kill method is made public so the users of this |
| 87 // class in the appcache namespace can call it. | 85 // class in the appcache namespace can call it. |
| 88 void Kill() override; | 86 void Kill() override; |
| 89 | 87 |
| 90 // Returns true if the job has been started by the net library. | 88 // Returns true if the job has been started by the net library. |
| 91 bool has_been_started() const { | 89 bool has_been_started() const { |
| 92 return has_been_started_; | 90 return has_been_started_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // net::URLRequestJob::NotifyRestartRequired. | 164 // net::URLRequestJob::NotifyRestartRequired. |
| 167 void NotifyRestartRequired(); | 165 void NotifyRestartRequired(); |
| 168 | 166 |
| 169 AppCacheHost* host_; | 167 AppCacheHost* host_; |
| 170 AppCacheStorage* storage_; | 168 AppCacheStorage* storage_; |
| 171 base::TimeTicks start_time_tick_; | 169 base::TimeTicks start_time_tick_; |
| 172 bool has_been_started_; | 170 bool has_been_started_; |
| 173 bool has_been_killed_; | 171 bool has_been_killed_; |
| 174 DeliveryType delivery_type_; | 172 DeliveryType delivery_type_; |
| 175 GURL manifest_url_; | 173 GURL manifest_url_; |
| 176 int64_t group_id_; | |
| 177 int64_t cache_id_; | 174 int64_t cache_id_; |
| 178 AppCacheEntry entry_; | 175 AppCacheEntry entry_; |
| 179 bool is_fallback_; | 176 bool is_fallback_; |
| 180 bool is_main_resource_; // Used for histogram logging. | 177 bool is_main_resource_; // Used for histogram logging. |
| 181 bool cache_entry_not_found_; | 178 bool cache_entry_not_found_; |
| 182 scoped_refptr<AppCacheResponseInfo> info_; | 179 scoped_refptr<AppCacheResponseInfo> info_; |
| 183 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; | 180 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; |
| 184 std::unique_ptr<AppCacheResponseReader> handler_source_reader_; | 181 std::unique_ptr<AppCacheResponseReader> handler_source_reader_; |
| 185 net::HttpByteRange range_requested_; | 182 net::HttpByteRange range_requested_; |
| 186 std::unique_ptr<net::HttpResponseInfo> range_response_info_; | 183 std::unique_ptr<net::HttpResponseInfo> range_response_info_; |
| 187 std::unique_ptr<AppCacheResponseReader> reader_; | 184 std::unique_ptr<AppCacheResponseReader> reader_; |
| 188 scoped_refptr<AppCache> cache_; | 185 scoped_refptr<AppCache> cache_; |
| 189 scoped_refptr<AppCacheGroup> group_; | 186 scoped_refptr<AppCacheGroup> group_; |
| 190 const OnPrepareToRestartCallback on_prepare_to_restart_callback_; | 187 const OnPrepareToRestartCallback on_prepare_to_restart_callback_; |
| 191 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; | 188 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; |
| 192 }; | 189 }; |
| 193 | 190 |
| 194 } // namespace content | 191 } // namespace content |
| 195 | 192 |
| 196 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 193 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
| OLD | NEW |