| 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 <deque> | 10 #include <deque> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
| 20 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 21 #include "ipc/ipc_sender.h" | 21 #include "ipc/ipc_sender.h" |
| 22 #include "net/base/request_priority.h" | 22 #include "net/base/request_priority.h" |
| 23 #include "url/gurl.h" |
| 23 | 24 |
| 24 struct ResourceMsg_RequestCompleteData; | 25 struct ResourceMsg_RequestCompleteData; |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 class WebThreadedDataReceiver; | 28 class WebThreadedDataReceiver; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace webkit_glue { | 31 namespace webkit_glue { |
| 31 class ResourceLoaderBridge; | 32 class ResourceLoaderBridge; |
| 32 } | 33 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so | 55 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so |
| 55 // this can be tested regardless of the ResourceLoaderBridge::Create | 56 // this can be tested regardless of the ResourceLoaderBridge::Create |
| 56 // implementation. Virtual for tests. | 57 // implementation. Virtual for tests. |
| 57 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( | 58 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( |
| 58 const RequestInfo& request_info); | 59 const RequestInfo& request_info); |
| 59 | 60 |
| 60 // Adds a request from the |pending_requests_| list, returning the new | 61 // Adds a request from the |pending_requests_| list, returning the new |
| 61 // requests' ID. | 62 // requests' ID. |
| 62 int AddPendingRequest(RequestPeer* callback, | 63 int AddPendingRequest(RequestPeer* callback, |
| 63 ResourceType::Type resource_type, | 64 ResourceType resource_type, |
| 64 int origin_pid, | 65 int origin_pid, |
| 65 const GURL& frame_origin, | 66 const GURL& frame_origin, |
| 66 const GURL& request_url, | 67 const GURL& request_url, |
| 67 bool download_to_file); | 68 bool download_to_file); |
| 68 | 69 |
| 69 // Removes a request from the |pending_requests_| list, returning true if the | 70 // Removes a request from the |pending_requests_| list, returning true if the |
| 70 // request was found and removed. | 71 // request was found and removed. |
| 71 bool RemovePendingRequest(int request_id); | 72 bool RemovePendingRequest(int request_id); |
| 72 | 73 |
| 73 // Cancels a request in the |pending_requests_| list. The request will be | 74 // Cancels a request in the |pending_requests_| list. The request will be |
| (...skipping 27 matching lines...) Expand all Loading... |
| 101 } | 102 } |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 friend class ResourceDispatcherTest; | 105 friend class ResourceDispatcherTest; |
| 105 | 106 |
| 106 typedef std::deque<IPC::Message*> MessageQueue; | 107 typedef std::deque<IPC::Message*> MessageQueue; |
| 107 struct PendingRequestInfo { | 108 struct PendingRequestInfo { |
| 108 PendingRequestInfo(); | 109 PendingRequestInfo(); |
| 109 | 110 |
| 110 PendingRequestInfo(RequestPeer* peer, | 111 PendingRequestInfo(RequestPeer* peer, |
| 111 ResourceType::Type resource_type, | 112 ResourceType resource_type, |
| 112 int origin_pid, | 113 int origin_pid, |
| 113 const GURL& frame_origin, | 114 const GURL& frame_origin, |
| 114 const GURL& request_url, | 115 const GURL& request_url, |
| 115 bool download_to_file); | 116 bool download_to_file); |
| 116 | 117 |
| 117 ~PendingRequestInfo(); | 118 ~PendingRequestInfo(); |
| 118 | 119 |
| 119 RequestPeer* peer; | 120 RequestPeer* peer; |
| 120 ThreadedDataProvider* threaded_data_provider; | 121 ThreadedDataProvider* threaded_data_provider; |
| 121 ResourceType::Type resource_type; | 122 ResourceType resource_type; |
| 122 // The PID of the original process which issued this request. This gets | 123 // The PID of the original process which issued this request. This gets |
| 123 // non-zero only for a request proxied by another renderer, particularly | 124 // non-zero only for a request proxied by another renderer, particularly |
| 124 // requests from plugins. | 125 // requests from plugins. |
| 125 int origin_pid; | 126 int origin_pid; |
| 126 MessageQueue deferred_message_queue; | 127 MessageQueue deferred_message_queue; |
| 127 bool is_deferred; | 128 bool is_deferred; |
| 128 // Original requested url. | 129 // Original requested url. |
| 129 GURL url; | 130 GURL url; |
| 130 // The security origin of the frame that initiates this request. | 131 // The security origin of the frame that initiates this request. |
| 131 GURL frame_origin; | 132 GURL frame_origin; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 // IO thread timestamp for ongoing IPC message. | 218 // IO thread timestamp for ongoing IPC message. |
| 218 base::TimeTicks io_timestamp_; | 219 base::TimeTicks io_timestamp_; |
| 219 | 220 |
| 220 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 221 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 } // namespace content | 224 } // namespace content |
| 224 | 225 |
| 225 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 226 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |