OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/common/resource_dispatcher.h" | 7 #include "chrome/common/resource_dispatcher.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (request_id_ != -1) { | 203 if (request_id_ != -1) { |
204 NOTREACHED() << "Starting a request twice"; | 204 NOTREACHED() << "Starting a request twice"; |
205 response->status.set_status(URLRequestStatus::FAILED); | 205 response->status.set_status(URLRequestStatus::FAILED); |
206 return; | 206 return; |
207 } | 207 } |
208 | 208 |
209 RESOURCE_LOG("Making sync request for " << url_); | 209 RESOURCE_LOG("Making sync request for " << url_); |
210 | 210 |
211 request_id_ = MakeRequestID(); | 211 request_id_ = MakeRequestID(); |
212 | 212 |
213 ViewHostMsg_SyncLoad_Result result; | 213 SyncLoadResult result; |
214 IPC::Message::Sender* sender = dispatcher_->message_sender(); | 214 IPC::Message::Sender* sender = dispatcher_->message_sender(); |
215 | 215 |
216 if (sender) { | 216 if (sender) { |
217 IPC::Message* msg = new ViewHostMsg_SyncLoad(MSG_ROUTING_NONE, request_id_, | 217 IPC::Message* msg = new ViewHostMsg_SyncLoad(MSG_ROUTING_NONE, request_id_, |
218 request_, &result); | 218 request_, &result); |
219 if (!sender->Send(msg)) { | 219 if (!sender->Send(msg)) { |
220 response->status.set_status(URLRequestStatus::FAILED); | 220 response->status.set_status(URLRequestStatus::FAILED); |
221 return; | 221 return; |
222 } | 222 } |
223 } | 223 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 request_info.peer->OnUploadProgress(position, size); | 296 request_info.peer->OnUploadProgress(position, size); |
297 | 297 |
298 // Acknowlegde reciept | 298 // Acknowlegde reciept |
299 IPC::Message::Sender* sender = message_sender(); | 299 IPC::Message::Sender* sender = message_sender(); |
300 if (sender) | 300 if (sender) |
301 sender->Send( | 301 sender->Send( |
302 new ViewHostMsg_UploadProgress_ACK(MSG_ROUTING_NONE, request_id)); | 302 new ViewHostMsg_UploadProgress_ACK(MSG_ROUTING_NONE, request_id)); |
303 } | 303 } |
304 | 304 |
305 void ResourceDispatcher::OnReceivedResponse( | 305 void ResourceDispatcher::OnReceivedResponse( |
306 int request_id, | 306 int request_id, const ResourceResponseHead& response_head) { |
307 const ViewMsg_Resource_ResponseHead& response_head) { | |
308 PendingRequestList::iterator it = pending_requests_.find(request_id); | 307 PendingRequestList::iterator it = pending_requests_.find(request_id); |
309 if (it == pending_requests_.end()) { | 308 if (it == pending_requests_.end()) { |
310 // This might happen for kill()ed requests on the webkit end, so perhaps it | 309 // This might happen for kill()ed requests on the webkit end, so perhaps it |
311 // shouldn't be a warning... | 310 // shouldn't be a warning... |
312 DLOG(WARNING) << "Got response for a nonexistant or finished request"; | 311 DLOG(WARNING) << "Got response for a nonexistant or finished request"; |
313 return; | 312 return; |
314 } | 313 } |
315 | 314 |
316 PendingRequestInfo& request_info = it->second; | 315 PendingRequestInfo& request_info = it->second; |
317 request_info.filter_policy = response_head.filter_policy; | 316 request_info.filter_policy = response_head.filter_policy; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 case ViewMsg_Resource_RequestComplete::ID: | 511 case ViewMsg_Resource_RequestComplete::ID: |
513 return true; | 512 return true; |
514 | 513 |
515 default: | 514 default: |
516 break; | 515 break; |
517 } | 516 } |
518 | 517 |
519 return false; | 518 return false; |
520 } | 519 } |
521 | 520 |
OLD | NEW |