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

Side by Side Diff: content/browser/renderer_host/async_resource_handler.cc

Issue 10640019: Remove the HANDLED_EXTERNALLY status code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add a DCHECK to async_resource_handler 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
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 #include "content/browser/renderer_host/async_resource_handler.h" 5 #include "content/browser/renderer_host/async_resource_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 // TODO(gavinp): Remove this CHECK when we figure out the cause of 303 // TODO(gavinp): Remove this CHECK when we figure out the cause of
304 // http://crbug.com/124680 . This check mirrors closely check in 304 // http://crbug.com/124680 . This check mirrors closely check in
305 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore 305 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore
306 // ResourceHandleInternal which asserts on its state and crashes. By crashing 306 // ResourceHandleInternal which asserts on its state and crashes. By crashing
307 // when the message is sent, we should get better crash reports. 307 // when the message is sent, we should get better crash reports.
308 CHECK(status.status() != net::URLRequestStatus::SUCCESS || 308 CHECK(status.status() != net::URLRequestStatus::SUCCESS ||
309 sent_received_response_msg_); 309 sent_received_response_msg_);
310 310
311 TimeTicks completion_time = TimeTicks::Now(); 311 TimeTicks completion_time = TimeTicks::Now();
312
313 int error_code = status.error();
314 if (status.status() == net::URLRequestStatus::IO_PENDING)
darin (slow to review) 2012/08/30 16:15:18 It should not be possible for status.status() to b
mkosiba (inactive) 2012/08/31 14:45:10 Done.
315 error_code = net::ERR_IO_PENDING;
316 else if (status.status() == net::URLRequestStatus::CANCELED &&
317 error_code == net::OK)
318 error_code = net::ERR_ABORTED;
319 else if (status.status() == net::URLRequestStatus::FAILED &&
320 error_code == net::OK)
321 error_code = net::ERR_FAILED;
darin (slow to review) 2012/08/30 16:15:18 I think you should take error_code from status.err
mkosiba (inactive) 2012/08/31 14:45:10 This only fixes up cases where code uses URLReques
322
323 ResourceRequestInfoImpl* info =
324 ResourceRequestInfoImpl::ForRequest(request_);
325 // If this check fails, then we're in an inconsistent state because all
mkosiba (inactive) 2012/08/30 15:29:43 not sure if this is the best place to put the chec
326 // requests ignored by the handler should be canceled (which should result in
327 // the ERR_ABORTED error code.
328 DCHECK(!info || !info->WasIgnoredByHandler() ||
darin (slow to review) 2012/08/30 16:15:18 I recommend saving WasIgnoredByHandler to a variab
mkosiba (inactive) 2012/08/31 14:45:10 Done.
329 error_code == net::ERR_ABORTED);
330
312 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, 331 filter_->Send(new ResourceMsg_RequestComplete(routing_id_,
313 request_id, 332 request_id,
314 status, 333 error_code,
334 info->WasIgnoredByHandler(),
315 security_info, 335 security_info,
316 completion_time)); 336 completion_time));
317 337
318 // If we still have a read buffer, then see about caching it for later... 338 // If we still have a read buffer, then see about caching it for later...
319 // Note that we have to make sure the buffer is not still being used, so we 339 // Note that we have to make sure the buffer is not still being used, so we
320 // have to perform an explicit check on the status code. 340 // have to perform an explicit check on the status code.
321 if (g_spare_read_buffer || 341 if (g_spare_read_buffer ||
322 net::URLRequestStatus::SUCCESS != status.status()) { 342 net::URLRequestStatus::SUCCESS != status.status()) {
323 read_buffer_ = NULL; 343 read_buffer_ = NULL;
324 } else if (read_buffer_.get()) { 344 } else if (read_buffer_.get()) {
(...skipping 27 matching lines...) Expand all
352 } 372 }
353 373
354 void AsyncResourceHandler::ResumeIfDeferred() { 374 void AsyncResourceHandler::ResumeIfDeferred() {
355 if (did_defer_) { 375 if (did_defer_) {
356 did_defer_ = false; 376 did_defer_ = false;
357 controller()->Resume(); 377 controller()->Resume();
358 } 378 }
359 } 379 }
360 380
361 } // namespace content 381 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698