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 WEBKIT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // A net::URLRequestJob derivative that knows how to return a response stored | 27 // A net::URLRequestJob derivative that knows how to return a response stored |
28 // in the appcache. | 28 // in the appcache. |
29 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheURLRequestJob | 29 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheURLRequestJob |
30 : public net::URLRequestJob, | 30 : public net::URLRequestJob, |
31 public AppCacheStorage::Delegate { | 31 public AppCacheStorage::Delegate { |
32 public: | 32 public: |
33 AppCacheURLRequestJob(net::URLRequest* request, | 33 AppCacheURLRequestJob(net::URLRequest* request, |
34 net::NetworkDelegate* network_delegate, | 34 net::NetworkDelegate* network_delegate, |
35 AppCacheStorage* storage, | 35 AppCacheStorage* storage, |
36 AppCacheHost* host); | 36 AppCacheHost* host, |
| 37 bool is_main_resource); |
37 | 38 |
38 // Informs the job of what response it should deliver. Only one of these | 39 // Informs the job of what response it should deliver. Only one of these |
39 // methods should be called, and only once per job. A job will sit idle and | 40 // methods should be called, and only once per job. A job will sit idle and |
40 // wait indefinitely until one of the deliver methods is called. | 41 // wait indefinitely until one of the deliver methods is called. |
41 void DeliverAppCachedResponse(const GURL& manifest_url, int64 group_id, | 42 void DeliverAppCachedResponse(const GURL& manifest_url, int64 group_id, |
42 int64 cache_id, const AppCacheEntry& entry, | 43 int64 cache_id, const AppCacheEntry& entry, |
43 bool is_fallback); | 44 bool is_fallback); |
44 void DeliverNetworkResponse(); | 45 void DeliverNetworkResponse(); |
45 void DeliverErrorResponse(); | 46 void DeliverErrorResponse(); |
46 | 47 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 AppCacheStorage* storage_; | 152 AppCacheStorage* storage_; |
152 base::TimeTicks start_time_tick_; | 153 base::TimeTicks start_time_tick_; |
153 bool has_been_started_; | 154 bool has_been_started_; |
154 bool has_been_killed_; | 155 bool has_been_killed_; |
155 DeliveryType delivery_type_; | 156 DeliveryType delivery_type_; |
156 GURL manifest_url_; | 157 GURL manifest_url_; |
157 int64 group_id_; | 158 int64 group_id_; |
158 int64 cache_id_; | 159 int64 cache_id_; |
159 AppCacheEntry entry_; | 160 AppCacheEntry entry_; |
160 bool is_fallback_; | 161 bool is_fallback_; |
| 162 bool is_main_resource_; // Used for histogram logging. |
161 bool cache_entry_not_found_; | 163 bool cache_entry_not_found_; |
162 scoped_refptr<AppCacheResponseInfo> info_; | 164 scoped_refptr<AppCacheResponseInfo> info_; |
163 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; | 165 scoped_refptr<net::GrowableIOBuffer> handler_source_buffer_; |
164 scoped_ptr<AppCacheResponseReader> handler_source_reader_; | 166 scoped_ptr<AppCacheResponseReader> handler_source_reader_; |
165 net::HttpByteRange range_requested_; | 167 net::HttpByteRange range_requested_; |
166 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 168 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
167 scoped_ptr<AppCacheResponseReader> reader_; | 169 scoped_ptr<AppCacheResponseReader> reader_; |
168 scoped_refptr<AppCache> cache_; | 170 scoped_refptr<AppCache> cache_; |
169 scoped_refptr<AppCacheGroup> group_; | 171 scoped_refptr<AppCacheGroup> group_; |
170 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; | 172 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; |
171 }; | 173 }; |
172 | 174 |
173 } // namespace appcache | 175 } // namespace appcache |
174 | 176 |
175 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 177 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
OLD | NEW |