| 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 26 matching lines...) Expand all Loading... |
| 37 // Callback that will be invoked before the request is restarted. The caller | 37 // Callback that will be invoked before the request is restarted. The caller |
| 38 // can use this opportunity to grab state from the AppCacheURLRequestJob to | 38 // can use this opportunity to grab state from the AppCacheURLRequestJob to |
| 39 // determine how it should behave when the request is restarted. | 39 // determine how it should behave when the request is restarted. |
| 40 using OnPrepareToRestartCallback = base::Closure; | 40 using OnPrepareToRestartCallback = base::Closure; |
| 41 | 41 |
| 42 ~AppCacheURLRequestJob() override; | 42 ~AppCacheURLRequestJob() override; |
| 43 | 43 |
| 44 // AppCacheJob overrides. | 44 // AppCacheJob overrides. |
| 45 void Kill() override; | 45 void Kill() override; |
| 46 bool IsStarted() const override; | 46 bool IsStarted() const override; |
| 47 bool IsWaiting() const override; | |
| 48 bool IsDeliveringAppCacheResponse() const override; | |
| 49 bool IsDeliveringNetworkResponse() const override; | |
| 50 bool IsDeliveringErrorResponse() const override; | |
| 51 bool IsCacheEntryNotFound() const override; | |
| 52 void DeliverAppCachedResponse(const GURL& manifest_url, | 47 void DeliverAppCachedResponse(const GURL& manifest_url, |
| 53 int64_t cache_id, | 48 int64_t cache_id, |
| 54 const AppCacheEntry& entry, | 49 const AppCacheEntry& entry, |
| 55 bool is_fallback) override; | 50 bool is_fallback) override; |
| 56 void DeliverNetworkResponse() override; | 51 void DeliverNetworkResponse() override; |
| 57 void DeliverErrorResponse() override; | 52 void DeliverErrorResponse() override; |
| 58 const GURL& GetURL() const override; | 53 const GURL& GetURL() const override; |
| 59 net::URLRequestJob* AsURLRequestJob() override; | 54 net::URLRequestJob* AsURLRequestJob() override; |
| 60 | 55 |
| 61 // Accessors for the info about the appcached response, if any, | 56 // Accessors for the info about the appcached response, if any, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 76 // AppCacheJob::Create() creates this instance. | 71 // AppCacheJob::Create() creates this instance. |
| 77 friend class AppCacheJob; | 72 friend class AppCacheJob; |
| 78 | 73 |
| 79 AppCacheURLRequestJob(net::URLRequest* request, | 74 AppCacheURLRequestJob(net::URLRequest* request, |
| 80 net::NetworkDelegate* network_delegate, | 75 net::NetworkDelegate* network_delegate, |
| 81 AppCacheStorage* storage, | 76 AppCacheStorage* storage, |
| 82 AppCacheHost* host, | 77 AppCacheHost* host, |
| 83 bool is_main_resource, | 78 bool is_main_resource, |
| 84 const OnPrepareToRestartCallback& restart_callback_); | 79 const OnPrepareToRestartCallback& restart_callback_); |
| 85 | 80 |
| 86 enum DeliveryType { | |
| 87 AWAITING_DELIVERY_ORDERS, | |
| 88 APPCACHED_DELIVERY, | |
| 89 NETWORK_DELIVERY, | |
| 90 ERROR_DELIVERY | |
| 91 }; | |
| 92 | |
| 93 // Returns true if one of the Deliver methods has been called. | 81 // Returns true if one of the Deliver methods has been called. |
| 94 bool has_delivery_orders() const { return !IsWaiting(); } | 82 bool has_delivery_orders() const { return !IsWaiting(); } |
| 95 | 83 |
| 96 void MaybeBeginDelivery(); | 84 void MaybeBeginDelivery(); |
| 97 void BeginDelivery(); | 85 void BeginDelivery(); |
| 98 | 86 |
| 99 // For executable response handling. | 87 // For executable response handling. |
| 100 void BeginExecutableHandlerDelivery(); | 88 void BeginExecutableHandlerDelivery(); |
| 101 void OnExecutableSourceLoaded(int result); | 89 void OnExecutableSourceLoaded(int result); |
| 102 void InvokeExecutableHandler(AppCacheExecutableHandler* handler); | 90 void InvokeExecutableHandler(AppCacheExecutableHandler* handler); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 133 | 121 |
| 134 // Invokes |prepare_to_restart_callback_| and then calls | 122 // Invokes |prepare_to_restart_callback_| and then calls |
| 135 // net::URLRequestJob::NotifyRestartRequired. | 123 // net::URLRequestJob::NotifyRestartRequired. |
| 136 void NotifyRestartRequired(); | 124 void NotifyRestartRequired(); |
| 137 | 125 |
| 138 AppCacheHost* host_; | 126 AppCacheHost* host_; |
| 139 AppCacheStorage* storage_; | 127 AppCacheStorage* storage_; |
| 140 base::TimeTicks start_time_tick_; | 128 base::TimeTicks start_time_tick_; |
| 141 bool has_been_started_; | 129 bool has_been_started_; |
| 142 bool has_been_killed_; | 130 bool has_been_killed_; |
| 143 DeliveryType delivery_type_; | |
| 144 GURL manifest_url_; | 131 GURL manifest_url_; |
| 145 int64_t cache_id_; | 132 int64_t cache_id_; |
| 146 AppCacheEntry entry_; | 133 AppCacheEntry entry_; |
| 147 bool is_fallback_; | 134 bool is_fallback_; |
| 148 bool is_main_resource_; // Used for histogram logging. | 135 bool is_main_resource_; // Used for histogram logging. |
| 149 bool cache_entry_not_found_; | |
| 150 scoped_refptr<AppCacheResponseInfo> info_; | 136 scoped_refptr<AppCacheResponseInfo> info_; |
| 151 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; | 137 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; |
| 152 std::unique_ptr<AppCacheResponseReader> handler_source_reader_; | 138 std::unique_ptr<AppCacheResponseReader> handler_source_reader_; |
| 153 net::HttpByteRange range_requested_; | 139 net::HttpByteRange range_requested_; |
| 154 std::unique_ptr<net::HttpResponseInfo> range_response_info_; | 140 std::unique_ptr<net::HttpResponseInfo> range_response_info_; |
| 155 std::unique_ptr<AppCacheResponseReader> reader_; | 141 std::unique_ptr<AppCacheResponseReader> reader_; |
| 156 scoped_refptr<AppCache> cache_; | 142 scoped_refptr<AppCache> cache_; |
| 157 scoped_refptr<AppCacheGroup> group_; | 143 scoped_refptr<AppCacheGroup> group_; |
| 158 const OnPrepareToRestartCallback on_prepare_to_restart_callback_; | 144 const OnPrepareToRestartCallback on_prepare_to_restart_callback_; |
| 159 }; | 145 }; |
| 160 | 146 |
| 161 } // namespace content | 147 } // namespace content |
| 162 | 148 |
| 163 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 149 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
| OLD | NEW |