| 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> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so | 38 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so |
| 39 // this can be tested regardless of the ResourceLoaderBridge::Create | 39 // this can be tested regardless of the ResourceLoaderBridge::Create |
| 40 // implementation. | 40 // implementation. |
| 41 webkit_glue::ResourceLoaderBridge* CreateBridge( | 41 webkit_glue::ResourceLoaderBridge* CreateBridge( |
| 42 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); | 42 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); |
| 43 | 43 |
| 44 // Adds a request from the pending_requests_ list, returning the new | 44 // Adds a request from the pending_requests_ list, returning the new |
| 45 // requests' ID | 45 // requests' ID |
| 46 int AddPendingRequest(webkit_glue::ResourceLoaderBridge::Peer* callback, | 46 int AddPendingRequest(webkit_glue::ResourceLoaderBridge::Peer* callback, |
| 47 ResourceType::Type resource_type, | 47 ResourceType::Type resource_type, |
| 48 const GURL& frame_origin, |
| 48 const GURL& request_url); | 49 const GURL& request_url); |
| 49 | 50 |
| 50 // Removes a request from the pending_requests_ list, returning true if the | 51 // Removes a request from the pending_requests_ list, returning true if the |
| 51 // request was found and removed. | 52 // request was found and removed. |
| 52 bool RemovePendingRequest(int request_id); | 53 bool RemovePendingRequest(int request_id); |
| 53 | 54 |
| 54 // Cancels a request in the pending_requests_ list. | 55 // Cancels a request in the pending_requests_ list. |
| 55 void CancelPendingRequest(int routing_id, int request_id); | 56 void CancelPendingRequest(int routing_id, int request_id); |
| 56 | 57 |
| 57 IPC::Sender* message_sender() const { | 58 IPC::Sender* message_sender() const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 friend class ResourceDispatcherTest; | 81 friend class ResourceDispatcherTest; |
| 81 | 82 |
| 82 typedef std::deque<IPC::Message*> MessageQueue; | 83 typedef std::deque<IPC::Message*> MessageQueue; |
| 83 struct PendingRequestInfo { | 84 struct PendingRequestInfo { |
| 84 PendingRequestInfo(); | 85 PendingRequestInfo(); |
| 85 | 86 |
| 86 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer, | 87 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 87 ResourceType::Type resource_type, | 88 ResourceType::Type resource_type, |
| 89 const GURL& frame_origin, |
| 88 const GURL& request_url); | 90 const GURL& request_url); |
| 89 | 91 |
| 90 ~PendingRequestInfo(); | 92 ~PendingRequestInfo(); |
| 91 | 93 |
| 92 webkit_glue::ResourceLoaderBridge::Peer* peer; | 94 webkit_glue::ResourceLoaderBridge::Peer* peer; |
| 93 ResourceType::Type resource_type; | 95 ResourceType::Type resource_type; |
| 94 MessageQueue deferred_message_queue; | 96 MessageQueue deferred_message_queue; |
| 95 bool is_deferred; | 97 bool is_deferred; |
| 98 // Original requested url. |
| 96 GURL url; | 99 GURL url; |
| 100 // The security origin of the frame that initiates this request. |
| 101 GURL frame_origin; |
| 102 // The url of the latest response even in case of redirection. |
| 103 GURL response_url; |
| 97 linked_ptr<IPC::Message> pending_redirect_message; | 104 linked_ptr<IPC::Message> pending_redirect_message; |
| 98 base::TimeTicks request_start; | 105 base::TimeTicks request_start; |
| 99 base::TimeTicks response_start; | 106 base::TimeTicks response_start; |
| 100 base::TimeTicks completion_time; | 107 base::TimeTicks completion_time; |
| 101 linked_ptr<base::SharedMemory> buffer; | 108 linked_ptr<base::SharedMemory> buffer; |
| 102 int buffer_size; | 109 int buffer_size; |
| 103 }; | 110 }; |
| 104 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; | 111 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; |
| 105 | 112 |
| 106 // Helper to lookup the info based on the request_id. | 113 // Helper to lookup the info based on the request_id. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 199 |
| 193 // IO thread timestamp for ongoing IPC message. | 200 // IO thread timestamp for ongoing IPC message. |
| 194 base::TimeTicks io_timestamp_; | 201 base::TimeTicks io_timestamp_; |
| 195 | 202 |
| 196 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 203 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 197 }; | 204 }; |
| 198 | 205 |
| 199 } // namespace content | 206 } // namespace content |
| 200 | 207 |
| 201 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 208 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |