| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // IPC::Listener implementation. | 65 // IPC::Listener implementation. |
| 66 bool OnMessageReceived(const IPC::Message& message) override; | 66 bool OnMessageReceived(const IPC::Message& message) override; |
| 67 | 67 |
| 68 // Call this method to load the resource synchronously (i.e., in one shot). | 68 // Call this method to load the resource synchronously (i.e., in one shot). |
| 69 // This is an alternative to the StartAsync method. Be warned that this method | 69 // This is an alternative to the StartAsync method. Be warned that this method |
| 70 // will block the calling thread until the resource is fully downloaded or an | 70 // will block the calling thread until the resource is fully downloaded or an |
| 71 // error occurs. It could block the calling thread for a long time, so only | 71 // error occurs. It could block the calling thread for a long time, so only |
| 72 // use this if you really need it! There is also no way for the caller to | 72 // use this if you really need it! There is also no way for the caller to |
| 73 // interrupt this method. Errors are reported via the status field of the | 73 // interrupt this method. Errors are reported via the status field of the |
| 74 // response parameter. | 74 // response parameter. |
| 75 virtual void StartSync(const RequestInfo& request_info, | 75 // |
| 76 ResourceRequestBodyImpl* request_body, | 76 // |routing_id| is used to associated the bridge with a frame's network |
| 77 // context. |
| 78 virtual void StartSync(std::unique_ptr<ResourceRequest> request, |
| 79 int routing_id, |
| 77 SyncLoadResponse* response, | 80 SyncLoadResponse* response, |
| 78 blink::WebURLRequest::LoadingIPCType ipc_type, | 81 blink::WebURLRequest::LoadingIPCType ipc_type, |
| 79 mojom::URLLoaderFactory* url_loader_factory); | 82 mojom::URLLoaderFactory* url_loader_factory); |
| 80 | 83 |
| 81 // Call this method to initiate the request. If this method succeeds, then | 84 // Call this method to initiate the request. If this method succeeds, then |
| 82 // the peer's methods will be called asynchronously to report various events. | 85 // the peer's methods will be called asynchronously to report various events. |
| 83 // Returns the request id. |url_loader_factory| must be non-null if and only | 86 // Returns the request id. |url_loader_factory| must be non-null if and only |
| 84 // if |ipc_type| is LoadingIPCType::Mojo. | 87 // if |ipc_type| is LoadingIPCType::Mojo. |
| 85 virtual int StartAsync(const RequestInfo& request_info, | 88 // |
| 86 ResourceRequestBodyImpl* request_body, | 89 // |routing_id| is used to associated the bridge with a frame's network |
| 87 std::unique_ptr<RequestPeer> peer, | 90 // context. |
| 88 blink::WebURLRequest::LoadingIPCType ipc_type, | 91 // |
| 89 mojom::URLLoaderFactory* url_loader_factory); | 92 // You can pass an optional argument |loading_task_runner| to specify task |
| 93 // queue to execute loading tasks on. |
| 94 virtual int StartAsync( |
| 95 std::unique_ptr<ResourceRequest> request, |
| 96 int routing_id, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, |
| 98 const GURL& frame_origin, |
| 99 std::unique_ptr<RequestPeer> peer, |
| 100 blink::WebURLRequest::LoadingIPCType ipc_type, |
| 101 mojom::URLLoaderFactory* url_loader_factory); |
| 90 | 102 |
| 91 // Removes a request from the |pending_requests_| list, returning true if the | 103 // Removes a request from the |pending_requests_| list, returning true if the |
| 92 // request was found and removed. | 104 // request was found and removed. |
| 93 bool RemovePendingRequest(int request_id); | 105 bool RemovePendingRequest(int request_id); |
| 94 | 106 |
| 95 // Cancels a request in the |pending_requests_| list. The request will be | 107 // Cancels a request in the |pending_requests_| list. The request will be |
| 96 // removed from the dispatcher as well. | 108 // removed from the dispatcher as well. |
| 97 virtual void Cancel(int request_id); | 109 virtual void Cancel(int request_id); |
| 98 | 110 |
| 99 // Toggles the is_deferred attribute for the specified request. | 111 // Toggles the is_deferred attribute for the specified request. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; | 271 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; |
| 260 | 272 |
| 261 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 273 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
| 262 | 274 |
| 263 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 275 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 264 }; | 276 }; |
| 265 | 277 |
| 266 } // namespace content | 278 } // namespace content |
| 267 | 279 |
| 268 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 280 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |