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

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: rebase + fix nits Created 8 years, 3 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
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 NOTREACHED() << "Trying to (un)defer an unstarted request"; 178 NOTREACHED() << "Trying to (un)defer an unstarted request";
179 return; 179 return;
180 } 180 }
181 181
182 dispatcher_->SetDefersLoading(request_id_, value); 182 dispatcher_->SetDefersLoading(request_id_, value);
183 } 183 }
184 184
185 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { 185 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
186 if (request_id_ != -1) { 186 if (request_id_ != -1) {
187 NOTREACHED() << "Starting a request twice"; 187 NOTREACHED() << "Starting a request twice";
188 response->status.set_status(net::URLRequestStatus::FAILED); 188 response->error_code = net::ERR_FAILED;
189 return; 189 return;
190 } 190 }
191 191
192 request_id_ = MakeRequestID(); 192 request_id_ = MakeRequestID();
193 is_synchronous_request_ = true; 193 is_synchronous_request_ = true;
194 194
195 SyncLoadResult result; 195 SyncLoadResult result;
196 IPC::SyncMessage* msg = new ResourceHostMsg_SyncLoad(routing_id_, request_id_, 196 IPC::SyncMessage* msg = new ResourceHostMsg_SyncLoad(routing_id_, request_id_,
197 request_, &result); 197 request_, &result);
198 // NOTE: This may pump events (see RenderThread::Send). 198 // NOTE: This may pump events (see RenderThread::Send).
199 if (!dispatcher_->message_sender()->Send(msg)) { 199 if (!dispatcher_->message_sender()->Send(msg)) {
200 response->status.set_status(net::URLRequestStatus::FAILED); 200 response->error_code = net::ERR_FAILED;
201 return; 201 return;
202 } 202 }
203 203
204 response->status = result.status; 204 response->error_code = result.error_code;
205 response->url = result.final_url; 205 response->url = result.final_url;
206 response->headers = result.headers; 206 response->headers = result.headers;
207 response->mime_type = result.mime_type; 207 response->mime_type = result.mime_type;
208 response->charset = result.charset; 208 response->charset = result.charset;
209 response->request_time = result.request_time; 209 response->request_time = result.request_time;
210 response->response_time = result.response_time; 210 response->response_time = result.response_time;
211 response->encoded_data_length = result.encoded_data_length; 211 response->encoded_data_length = result.encoded_data_length;
212 response->connection_id = result.connection_id; 212 response->connection_id = result.connection_id;
213 response->connection_reused = result.connection_reused; 213 response->connection_reused = result.connection_reused;
214 response->load_timing = result.load_timing; 214 response->load_timing = result.load_timing;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 void ResourceDispatcher::FollowPendingRedirect( 399 void ResourceDispatcher::FollowPendingRedirect(
400 int request_id, 400 int request_id,
401 PendingRequestInfo& request_info) { 401 PendingRequestInfo& request_info) {
402 IPC::Message* msg = request_info.pending_redirect_message.release(); 402 IPC::Message* msg = request_info.pending_redirect_message.release();
403 if (msg) 403 if (msg)
404 message_sender()->Send(msg); 404 message_sender()->Send(msg);
405 } 405 }
406 406
407 void ResourceDispatcher::OnRequestComplete( 407 void ResourceDispatcher::OnRequestComplete(
408 int request_id, 408 int request_id,
409 const net::URLRequestStatus& status, 409 int error_code,
410 bool was_ignored_by_handler,
410 const std::string& security_info, 411 const std::string& security_info,
411 const base::TimeTicks& browser_completion_time) { 412 const base::TimeTicks& browser_completion_time) {
412 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 413 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
413 if (!request_info) 414 if (!request_info)
414 return; 415 return;
415 request_info->completion_time = base::TimeTicks::Now(); 416 request_info->completion_time = base::TimeTicks::Now();
416 417
417 ResourceLoaderBridge::Peer* peer = request_info->peer; 418 ResourceLoaderBridge::Peer* peer = request_info->peer;
418 419
419 if (delegate_) { 420 if (delegate_) {
420 ResourceLoaderBridge::Peer* new_peer = 421 ResourceLoaderBridge::Peer* new_peer =
421 delegate_->OnRequestComplete( 422 delegate_->OnRequestComplete(
422 request_info->peer, request_info->resource_type, status); 423 request_info->peer, request_info->resource_type, error_code);
423 if (new_peer) 424 if (new_peer)
424 request_info->peer = new_peer; 425 request_info->peer = new_peer;
425 } 426 }
426 427
427 base::TimeTicks renderer_completion_time = ToRendererCompletionTime( 428 base::TimeTicks renderer_completion_time = ToRendererCompletionTime(
428 *request_info, browser_completion_time); 429 *request_info, browser_completion_time);
429 // The request ID will be removed from our pending list in the destructor. 430 // The request ID will be removed from our pending list in the destructor.
430 // Normally, dispatching this message causes the reference-counted request to 431 // Normally, dispatching this message causes the reference-counted request to
431 // die immediately. 432 // die immediately.
432 peer->OnCompletedRequest(status, security_info, renderer_completion_time); 433 peer->OnCompletedRequest(error_code, was_ignored_by_handler, security_info,
434 renderer_completion_time);
433 } 435 }
434 436
435 int ResourceDispatcher::AddPendingRequest( 437 int ResourceDispatcher::AddPendingRequest(
436 ResourceLoaderBridge::Peer* callback, 438 ResourceLoaderBridge::Peer* callback,
437 ResourceType::Type resource_type, 439 ResourceType::Type resource_type,
438 const GURL& request_url) { 440 const GURL& request_url) {
439 // Compute a unique request_id for this renderer process. 441 // Compute a unique request_id for this renderer process.
440 int id = MakeRequestID(); 442 int id = MakeRequestID();
441 pending_requests_[id] = 443 pending_requests_[id] =
442 PendingRequestInfo(callback, resource_type, request_url); 444 PendingRequestInfo(callback, resource_type, request_url);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 666 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
665 while (!queue->empty()) { 667 while (!queue->empty()) {
666 IPC::Message* message = queue->front(); 668 IPC::Message* message = queue->front();
667 ReleaseResourcesInDataMessage(*message); 669 ReleaseResourcesInDataMessage(*message);
668 queue->pop_front(); 670 queue->pop_front();
669 delete message; 671 delete message;
670 } 672 }
671 } 673 }
672 674
673 } // namespace content 675 } // namespace content
OLDNEW
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698