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 // The intent of this file is to provide a type-neutral abstraction between | 5 // The intent of this file is to provide a type-neutral abstraction between |
6 // Chrome and WebKit for resource loading. This pure-virtual interface is | 6 // Chrome and WebKit for resource loading. This pure-virtual interface is |
7 // implemented by the embedder. | 7 // implemented by the embedder. |
8 // | 8 // |
9 // One of these objects will be created by WebKit for each request. WebKit | 9 // One of these objects will be created by WebKit for each request. WebKit |
10 // will own the pointer to the bridge, and will delete it when the request is | 10 // will own the pointer to the bridge, and will delete it when the request is |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/platform_file.h" | 26 #include "base/platform_file.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 #include "net/base/request_priority.h" | 28 #include "net/base/request_priority.h" |
29 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 29 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
30 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 30 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
32 #include "webkit/child/webkit_child_export.h" | 32 #include "webkit/child/webkit_child_export.h" |
33 #include "webkit/common/resource_response_info.h" | 33 #include "webkit/common/resource_response_info.h" |
34 #include "webkit/common/resource_type.h" | 34 #include "webkit/common/resource_type.h" |
35 | 35 |
| 36 namespace blink { |
| 37 class WebParserResourceBridge; |
| 38 } |
| 39 |
36 namespace webkit_glue { | 40 namespace webkit_glue { |
37 class ResourceRequestBody; | 41 class ResourceRequestBody; |
38 | 42 |
39 class ResourceLoaderBridge { | 43 class ResourceLoaderBridge { |
40 public: | 44 public: |
41 // Structure used when calling | 45 // Structure used when calling |
42 // WebKitPlatformSupportImpl::CreateResourceLoader(). | 46 // WebKitPlatformSupportImpl::CreateResourceLoader(). |
43 struct WEBKIT_CHILD_EXPORT RequestInfo { | 47 struct WEBKIT_CHILD_EXPORT RequestInfo { |
44 RequestInfo(); | 48 RequestInfo(); |
45 ~RequestInfo(); | 49 ~RequestInfo(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 178 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
175 | 179 |
176 // Called when the response is complete. This method signals completion of | 180 // Called when the response is complete. This method signals completion of |
177 // the resource load. | 181 // the resource load. |
178 virtual void OnCompletedRequest( | 182 virtual void OnCompletedRequest( |
179 int error_code, | 183 int error_code, |
180 bool was_ignored_by_handler, | 184 bool was_ignored_by_handler, |
181 const std::string& security_info, | 185 const std::string& security_info, |
182 const base::TimeTicks& completion_time) = 0; | 186 const base::TimeTicks& completion_time) = 0; |
183 | 187 |
| 188 // Called by the parser-resource bridge when its resource filter has |
| 189 // been installed on the I/O thread, and signals Blink that any further |
| 190 // data chunks which are received by the main thread should not be passed |
| 191 // to the parser thread as that now happens directly. |
| 192 virtual void OnParserResourceMessageFilterAdded() { } |
184 protected: | 193 protected: |
185 virtual ~Peer() {} | 194 virtual ~Peer() {} |
186 }; | 195 }; |
187 | 196 |
188 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 197 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
189 // anybody can delete at any time, INCLUDING during processing of callbacks. | 198 // anybody can delete at any time, INCLUDING during processing of callbacks. |
190 WEBKIT_CHILD_EXPORT virtual ~ResourceLoaderBridge(); | 199 WEBKIT_CHILD_EXPORT virtual ~ResourceLoaderBridge(); |
191 | 200 |
192 // Call this method before calling Start() to set the request body. | 201 // Call this method before calling Start() to set the request body. |
193 // May only be used with HTTP(S) POST requests. | 202 // May only be used with HTTP(S) POST requests. |
(...skipping 11 matching lines...) Expand all Loading... |
205 | 214 |
206 // Call this method to suspend or resume a load that is in progress. This | 215 // Call this method to suspend or resume a load that is in progress. This |
207 // method may only be called after a successful call to the Start method. | 216 // method may only be called after a successful call to the Start method. |
208 virtual void SetDefersLoading(bool value) = 0; | 217 virtual void SetDefersLoading(bool value) = 0; |
209 | 218 |
210 // Call this method when the priority of the requested resource changes after | 219 // Call this method when the priority of the requested resource changes after |
211 // Start() has been called. This method may only be called after a successful | 220 // Start() has been called. This method may only be called after a successful |
212 // call to the Start method. | 221 // call to the Start method. |
213 virtual void DidChangePriority(net::RequestPriority new_priority) = 0; | 222 virtual void DidChangePriority(net::RequestPriority new_priority) = 0; |
214 | 223 |
| 224 // Call this method to request an implementation of WebParserResourceBridge |
| 225 // which will be used to interact with the parser thread. |
| 226 virtual blink::WebParserResourceBridge* ConstructParserResourceBridge() = 0; |
| 227 |
215 // Call this method to load the resource synchronously (i.e., in one shot). | 228 // Call this method to load the resource synchronously (i.e., in one shot). |
216 // This is an alternative to the Start method. Be warned that this method | 229 // This is an alternative to the Start method. Be warned that this method |
217 // will block the calling thread until the resource is fully downloaded or an | 230 // will block the calling thread until the resource is fully downloaded or an |
218 // error occurs. It could block the calling thread for a long time, so only | 231 // error occurs. It could block the calling thread for a long time, so only |
219 // use this if you really need it! There is also no way for the caller to | 232 // use this if you really need it! There is also no way for the caller to |
220 // interrupt this method. Errors are reported via the status field of the | 233 // interrupt this method. Errors are reported via the status field of the |
221 // response parameter. | 234 // response parameter. |
222 virtual void SyncLoad(SyncLoadResponse* response) = 0; | 235 virtual void SyncLoad(SyncLoadResponse* response) = 0; |
223 | 236 |
224 protected: | 237 protected: |
225 // Construction must go through | 238 // Construction must go through |
226 // WebKitPlatformSupportImpl::CreateResourceLoader() | 239 // WebKitPlatformSupportImpl::CreateResourceLoader() |
227 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload | 240 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload |
228 // methods may be called to construct the body of the request. | 241 // methods may be called to construct the body of the request. |
229 WEBKIT_CHILD_EXPORT ResourceLoaderBridge(); | 242 WEBKIT_CHILD_EXPORT ResourceLoaderBridge(); |
230 | 243 |
231 private: | 244 private: |
232 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 245 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
233 }; | 246 }; |
234 | 247 |
235 } // namespace webkit_glue | 248 } // namespace webkit_glue |
236 | 249 |
237 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ | 250 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ |
OLD | NEW |