Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: content/common/resource_dispatcher.cc

Issue 10640019: Remove the HANDLED_EXTERNALLY status code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: revert removing DCHECK from URLRequest::DoCancel Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/common/resource_dispatcher.h" 7 #include "content/common/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 NOTREACHED() << "Trying to (un)defer an unstarted request"; 218 NOTREACHED() << "Trying to (un)defer an unstarted request";
219 return; 219 return;
220 } 220 }
221 221
222 dispatcher_->SetDefersLoading(request_id_, value); 222 dispatcher_->SetDefersLoading(request_id_, value);
223 } 223 }
224 224
225 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { 225 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
226 if (request_id_ != -1) { 226 if (request_id_ != -1) {
227 NOTREACHED() << "Starting a request twice"; 227 NOTREACHED() << "Starting a request twice";
228 response->status.set_status(net::URLRequestStatus::FAILED); 228 response->error_code = net::ERR_FAILED;
229 return; 229 return;
230 } 230 }
231 231
232 request_id_ = MakeRequestID(); 232 request_id_ = MakeRequestID();
233 is_synchronous_request_ = true; 233 is_synchronous_request_ = true;
234 234
235 SyncLoadResult result; 235 SyncLoadResult result;
236 IPC::SyncMessage* msg = new ResourceHostMsg_SyncLoad(routing_id_, request_id_, 236 IPC::SyncMessage* msg = new ResourceHostMsg_SyncLoad(routing_id_, request_id_,
237 request_, &result); 237 request_, &result);
238 // NOTE: This may pump events (see RenderThread::Send). 238 // NOTE: This may pump events (see RenderThread::Send).
239 if (!dispatcher_->message_sender()->Send(msg)) { 239 if (!dispatcher_->message_sender()->Send(msg)) {
240 response->status.set_status(net::URLRequestStatus::FAILED); 240 response->error_code = net::ERR_FAILED;
241 return; 241 return;
242 } 242 }
243 243
244 response->status = result.status; 244 response->error_code = result.error_code;
245 response->url = result.final_url; 245 response->url = result.final_url;
246 response->headers = result.headers; 246 response->headers = result.headers;
247 response->mime_type = result.mime_type; 247 response->mime_type = result.mime_type;
248 response->charset = result.charset; 248 response->charset = result.charset;
249 response->request_time = result.request_time; 249 response->request_time = result.request_time;
250 response->response_time = result.response_time; 250 response->response_time = result.response_time;
251 response->encoded_data_length = result.encoded_data_length; 251 response->encoded_data_length = result.encoded_data_length;
252 response->connection_id = result.connection_id; 252 response->connection_id = result.connection_id;
253 response->connection_reused = result.connection_reused; 253 response->connection_reused = result.connection_reused;
254 response->load_timing = result.load_timing; 254 response->load_timing = result.load_timing;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void ResourceDispatcher::FollowPendingRedirect( 439 void ResourceDispatcher::FollowPendingRedirect(
440 int request_id, 440 int request_id,
441 PendingRequestInfo& request_info) { 441 PendingRequestInfo& request_info) {
442 IPC::Message* msg = request_info.pending_redirect_message.release(); 442 IPC::Message* msg = request_info.pending_redirect_message.release();
443 if (msg) 443 if (msg)
444 message_sender()->Send(msg); 444 message_sender()->Send(msg);
445 } 445 }
446 446
447 void ResourceDispatcher::OnRequestComplete( 447 void ResourceDispatcher::OnRequestComplete(
448 int request_id, 448 int request_id,
449 const net::URLRequestStatus& status, 449 int error_code,
450 bool is_handled_externally,
450 const std::string& security_info, 451 const std::string& security_info,
451 const base::TimeTicks& browser_completion_time) { 452 const base::TimeTicks& browser_completion_time) {
452 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 453 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
453 if (!request_info) 454 if (!request_info)
454 return; 455 return;
455 request_info->completion_time = base::TimeTicks::Now(); 456 request_info->completion_time = base::TimeTicks::Now();
456 457
457 ResourceLoaderBridge::Peer* peer = request_info->peer; 458 ResourceLoaderBridge::Peer* peer = request_info->peer;
458 459
459 if (delegate_) { 460 if (delegate_) {
460 ResourceLoaderBridge::Peer* new_peer = 461 ResourceLoaderBridge::Peer* new_peer =
461 delegate_->OnRequestComplete( 462 delegate_->OnRequestComplete(
462 request_info->peer, request_info->resource_type, status); 463 request_info->peer, request_info->resource_type, error_code);
463 if (new_peer) 464 if (new_peer)
464 request_info->peer = new_peer; 465 request_info->peer = new_peer;
465 } 466 }
466 467
467 base::TimeTicks renderer_completion_time = ToRendererCompletionTime( 468 base::TimeTicks renderer_completion_time = ToRendererCompletionTime(
468 *request_info, browser_completion_time); 469 *request_info, browser_completion_time);
469 // The request ID will be removed from our pending list in the destructor. 470 // The request ID will be removed from our pending list in the destructor.
470 // Normally, dispatching this message causes the reference-counted request to 471 // Normally, dispatching this message causes the reference-counted request to
471 // die immediately. 472 // die immediately.
472 peer->OnCompletedRequest(status, security_info, renderer_completion_time); 473 peer->OnCompletedRequest(error_code, is_handled_externally, security_info,
474 renderer_completion_time);
473 } 475 }
474 476
475 int ResourceDispatcher::AddPendingRequest( 477 int ResourceDispatcher::AddPendingRequest(
476 ResourceLoaderBridge::Peer* callback, 478 ResourceLoaderBridge::Peer* callback,
477 ResourceType::Type resource_type, 479 ResourceType::Type resource_type,
478 const GURL& request_url) { 480 const GURL& request_url) {
479 // Compute a unique request_id for this renderer process. 481 // Compute a unique request_id for this renderer process.
480 int id = MakeRequestID(); 482 int id = MakeRequestID();
481 pending_requests_[id] = 483 pending_requests_[id] =
482 PendingRequestInfo(callback, resource_type, request_url); 484 PendingRequestInfo(callback, resource_type, request_url);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 686 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
685 while (!queue->empty()) { 687 while (!queue->empty()) {
686 IPC::Message* message = queue->front(); 688 IPC::Message* message = queue->front();
687 ReleaseResourcesInDataMessage(*message); 689 ReleaseResourcesInDataMessage(*message);
688 queue->pop_front(); 690 queue->pop_front();
689 delete message; 691 delete message;
690 } 692 }
691 } 693 }
692 694
693 } // namespace content 695 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698