| 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 | |
| 89 // Message response handlers, called by the message handler for this process. | 85 // Message response handlers, called by the message handler for this process. |
| 90 void OnUploadProgress( | 86 void OnUploadProgress( |
| 91 const IPC::Message& message, | 87 const IPC::Message& message, |
| 92 int request_id, | 88 int request_id, |
| 93 int64 position, | 89 int64 position, |
| 94 int64 size); | 90 int64 size); |
| 95 void OnReceivedResponse(int request_id, const ResourceResponseHead&); | 91 void OnReceivedResponse(int request_id, const ResourceResponseHead&); |
| 96 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); | 92 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); |
| 97 void OnReceivedRedirect( | 93 void OnReceivedRedirect( |
| 98 const IPC::Message& message, | 94 const IPC::Message& message, |
| 99 int request_id, | 95 int request_id, |
| 100 const GURL& new_url, | 96 const GURL& new_url, |
| 101 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info); | 97 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info); |
| 102 void OnReceivedData( | 98 void OnReceivedData( |
| 103 const IPC::Message& message, | 99 const IPC::Message& message, |
| 104 int request_id, | 100 int request_id, |
| 105 base::SharedMemoryHandle data, | 101 base::SharedMemoryHandle data, |
| 106 int data_len); | 102 int data_len); |
| 107 void OnDownloadedData( | |
| 108 const IPC::Message& message, | |
| 109 int request_id, | |
| 110 int data_len); | |
| 111 void OnRequestComplete( | 103 void OnRequestComplete( |
| 112 int request_id, | 104 int request_id, |
| 113 const URLRequestStatus& status, | 105 const URLRequestStatus& status, |
| 114 const std::string& security_info, | 106 const std::string& security_info, |
| 115 const base::Time& completion_time); | 107 const base::Time& completion_time); |
| 116 | 108 |
| 117 // Dispatch the message to one of the message response handlers. | 109 // Dispatch the message to one of the message response handlers. |
| 118 void DispatchMessage(const IPC::Message& message); | 110 void DispatchMessage(const IPC::Message& message); |
| 119 | 111 |
| 120 // Dispatch any deferred messages for the given request, provided it is not | 112 // Dispatch any deferred messages for the given request, provided it is not |
| (...skipping 18 matching lines...) Expand all Loading... |
| 139 | 131 |
| 140 // All pending requests issued to the host | 132 // All pending requests issued to the host |
| 141 PendingRequestList pending_requests_; | 133 PendingRequestList pending_requests_; |
| 142 | 134 |
| 143 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; | 135 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; |
| 144 | 136 |
| 145 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 137 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 146 }; | 138 }; |
| 147 | 139 |
| 148 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 140 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| OLD | NEW |