OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "chrome/common/child_process_info.h" | 13 #include "chrome/common/child_process_info.h" |
14 #include "net/base/load_states.h" | 14 #include "net/base/load_states.h" |
15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
16 #include "webkit/glue/resource_type.h" | 16 #include "webkit/glue/resource_type.h" |
17 | 17 |
18 class CrossSiteResourceHandler; | 18 class CrossSiteResourceHandler; |
19 class LoginHandler; | 19 class LoginHandler; |
20 class ResourceDispatcherHost; | 20 class ResourceDispatcherHost; |
21 class ResourceHandler; | 21 class ResourceHandler; |
22 class SSLClientAuthHandler; | 22 class SSLClientAuthHandler; |
23 | 23 |
| 24 namespace webkit_blob { |
| 25 class BlobData; |
| 26 } |
| 27 |
24 // Holds the data ResourceDispatcherHost associates with each request. | 28 // Holds the data ResourceDispatcherHost associates with each request. |
25 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. | 29 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. |
26 class ResourceDispatcherHostRequestInfo : public URLRequest::UserData { | 30 class ResourceDispatcherHostRequestInfo : public URLRequest::UserData { |
27 public: | 31 public: |
28 // This will take a reference to the handler. | 32 // This will take a reference to the handler. |
29 ResourceDispatcherHostRequestInfo( | 33 ResourceDispatcherHostRequestInfo( |
30 ResourceHandler* handler, | 34 ResourceHandler* handler, |
31 ChildProcessInfo::ProcessType process_type, | 35 ChildProcessInfo::ProcessType process_type, |
32 int child_id, | 36 int child_id, |
33 int route_id, | 37 int route_id, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 157 } |
154 | 158 |
155 // The approximate in-memory size (bytes) that we credited this request | 159 // The approximate in-memory size (bytes) that we credited this request |
156 // as consuming in |outstanding_requests_memory_cost_map_|. | 160 // as consuming in |outstanding_requests_memory_cost_map_|. |
157 int memory_cost() const { return memory_cost_; } | 161 int memory_cost() const { return memory_cost_; } |
158 void set_memory_cost(int cost) { memory_cost_ = cost; } | 162 void set_memory_cost(int cost) { memory_cost_ = cost; } |
159 | 163 |
160 int host_renderer_id() const { return host_renderer_id_; } | 164 int host_renderer_id() const { return host_renderer_id_; } |
161 int host_render_view_id() const { return host_render_view_id_; } | 165 int host_render_view_id() const { return host_render_view_id_; } |
162 | 166 |
| 167 // We hold a reference to the requested blob data to ensure it doesn't |
| 168 // get finally released prior to the URLRequestJob being started. |
| 169 webkit_blob::BlobData* requested_blob_data() const { |
| 170 return requested_blob_data_.get(); |
| 171 } |
| 172 void set_requested_blob_data(webkit_blob::BlobData* data); |
| 173 |
163 private: | 174 private: |
164 friend class ResourceDispatcherHost; | 175 friend class ResourceDispatcherHost; |
165 | 176 |
166 // Request is temporarily not handling network data. Should be used only | 177 // Request is temporarily not handling network data. Should be used only |
167 // by the ResourceDispatcherHost, not the event handlers (accessors are | 178 // by the ResourceDispatcherHost, not the event handlers (accessors are |
168 // provided for consistency with the rest of the interface). | 179 // provided for consistency with the rest of the interface). |
169 bool is_paused() const { return is_paused_; } | 180 bool is_paused() const { return is_paused_; } |
170 void set_is_paused(bool paused) { is_paused_ = paused; } | 181 void set_is_paused(bool paused) { is_paused_ = paused; } |
171 | 182 |
172 // Whether we called OnResponseStarted for this request or not. Should be used | 183 // Whether we called OnResponseStarted for this request or not. Should be used |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 std::string frame_origin_; | 218 std::string frame_origin_; |
208 std::string main_frame_origin_; | 219 std::string main_frame_origin_; |
209 ResourceType::Type resource_type_; | 220 ResourceType::Type resource_type_; |
210 bool replace_extension_localization_templates_; | 221 bool replace_extension_localization_templates_; |
211 net::LoadState last_load_state_; | 222 net::LoadState last_load_state_; |
212 uint64 upload_size_; | 223 uint64 upload_size_; |
213 uint64 last_upload_position_; | 224 uint64 last_upload_position_; |
214 base::TimeTicks last_upload_ticks_; | 225 base::TimeTicks last_upload_ticks_; |
215 bool waiting_for_upload_progress_ack_; | 226 bool waiting_for_upload_progress_ack_; |
216 int memory_cost_; | 227 int memory_cost_; |
| 228 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; |
217 | 229 |
218 // "Private" data accessible only to ResourceDispatcherHost (use the | 230 // "Private" data accessible only to ResourceDispatcherHost (use the |
219 // accessors above for consistency). | 231 // accessors above for consistency). |
220 bool is_paused_; | 232 bool is_paused_; |
221 bool called_on_response_started_; | 233 bool called_on_response_started_; |
222 bool has_started_reading_; | 234 bool has_started_reading_; |
223 int paused_read_bytes_; | 235 int paused_read_bytes_; |
224 | 236 |
225 // The following two members are specified if the request is initiated by | 237 // The following two members are specified if the request is initiated by |
226 // a plugin like Gears. | 238 // a plugin like Gears. |
227 | 239 |
228 // Contains the id of the host renderer. | 240 // Contains the id of the host renderer. |
229 int host_renderer_id_; | 241 int host_renderer_id_; |
230 // Contains the id of the host render view. | 242 // Contains the id of the host render view. |
231 int host_render_view_id_; | 243 int host_render_view_id_; |
232 | 244 |
233 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo); | 245 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo); |
234 }; | 246 }; |
235 | 247 |
236 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ | 248 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ |
OLD | NEW |