| 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 // 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 CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 7 #ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| 8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 ~PendingRequestInfo() { } | 76 ~PendingRequestInfo() { } |
| 77 webkit_glue::ResourceLoaderBridge::Peer* peer; | 77 webkit_glue::ResourceLoaderBridge::Peer* peer; |
| 78 ResourceType::Type resource_type; | 78 ResourceType::Type resource_type; |
| 79 MessageQueue deferred_message_queue; | 79 MessageQueue deferred_message_queue; |
| 80 bool is_deferred; | 80 bool is_deferred; |
| 81 GURL url; | 81 GURL url; |
| 82 }; | 82 }; |
| 83 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; | 83 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; |
| 84 | 84 |
| 85 // Helper to lookup the info based on the request_id. |
| 86 // May return NULL if the request as been canceled from the client side. |
| 87 PendingRequestInfo* GetPendingRequestInfo(int request_id); |
| 88 |
| 85 // Message response handlers, called by the message handler for this process. | 89 // Message response handlers, called by the message handler for this process. |
| 86 void OnUploadProgress( | 90 void OnUploadProgress( |
| 87 const IPC::Message& message, | 91 const IPC::Message& message, |
| 88 int request_id, | 92 int request_id, |
| 89 int64 position, | 93 int64 position, |
| 90 int64 size); | 94 int64 size); |
| 91 void OnReceivedResponse(int request_id, const ResourceResponseHead&); | 95 void OnReceivedResponse(int request_id, const ResourceResponseHead&); |
| 92 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); | 96 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); |
| 93 void OnReceivedRedirect( | 97 void OnReceivedRedirect( |
| 94 const IPC::Message& message, | 98 const IPC::Message& message, |
| 95 int request_id, | 99 int request_id, |
| 96 const GURL& new_url, | 100 const GURL& new_url, |
| 97 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info); | 101 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info); |
| 98 void OnReceivedData( | 102 void OnReceivedData( |
| 99 const IPC::Message& message, | 103 const IPC::Message& message, |
| 100 int request_id, | 104 int request_id, |
| 101 base::SharedMemoryHandle data, | 105 base::SharedMemoryHandle data, |
| 102 int data_len); | 106 int data_len); |
| 107 void OnDownloadedData( |
| 108 const IPC::Message& message, |
| 109 int request_id, |
| 110 int data_len); |
| 103 void OnRequestComplete( | 111 void OnRequestComplete( |
| 104 int request_id, | 112 int request_id, |
| 105 const URLRequestStatus& status, | 113 const URLRequestStatus& status, |
| 106 const std::string& security_info, | 114 const std::string& security_info, |
| 107 const base::Time& completion_time); | 115 const base::Time& completion_time); |
| 108 | 116 |
| 109 // Dispatch the message to one of the message response handlers. | 117 // Dispatch the message to one of the message response handlers. |
| 110 void DispatchMessage(const IPC::Message& message); | 118 void DispatchMessage(const IPC::Message& message); |
| 111 | 119 |
| 112 // Dispatch any deferred messages for the given request, provided it is not | 120 // Dispatch any deferred messages for the given request, provided it is not |
| (...skipping 18 matching lines...) Expand all Loading... |
| 131 | 139 |
| 132 // All pending requests issued to the host | 140 // All pending requests issued to the host |
| 133 PendingRequestList pending_requests_; | 141 PendingRequestList pending_requests_; |
| 134 | 142 |
| 135 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; | 143 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; |
| 136 | 144 |
| 137 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 145 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 138 }; | 146 }; |
| 139 | 147 |
| 140 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 148 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| OLD | NEW |