OLD | NEW |
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/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // with a status() != SUCCESS and an error_code() == net::OK. | 344 // with a status() != SUCCESS and an error_code() == net::OK. |
345 if (status.status() == net::URLRequestStatus::CANCELED && | 345 if (status.status() == net::URLRequestStatus::CANCELED && |
346 error_code == net::OK) { | 346 error_code == net::OK) { |
347 error_code = net::ERR_ABORTED; | 347 error_code = net::ERR_ABORTED; |
348 } else if (status.status() == net::URLRequestStatus::FAILED && | 348 } else if (status.status() == net::URLRequestStatus::FAILED && |
349 error_code == net::OK) { | 349 error_code == net::OK) { |
350 error_code = net::ERR_FAILED; | 350 error_code = net::ERR_FAILED; |
351 } | 351 } |
352 | 352 |
353 info->filter()->Send( | 353 info->filter()->Send( |
354 new ResourceMsg_RequestComplete(request_id, | 354 new ResourceMsg_RequestComplete( |
355 error_code, | 355 request_id, error_code, was_ignored_by_handler, |
356 was_ignored_by_handler, | 356 request()->response_info().was_cached, |
357 security_info, | 357 security_info, completion_time)); |
358 completion_time)); | |
359 } | 358 } |
360 | 359 |
361 bool AsyncResourceHandler::EnsureResourceBufferIsInitialized() { | 360 bool AsyncResourceHandler::EnsureResourceBufferIsInitialized() { |
362 if (buffer_.get() && buffer_->IsInitialized()) | 361 if (buffer_.get() && buffer_->IsInitialized()) |
363 return true; | 362 return true; |
364 | 363 |
365 if (!has_checked_for_sufficient_resources_) { | 364 if (!has_checked_for_sufficient_resources_) { |
366 has_checked_for_sufficient_resources_ = true; | 365 has_checked_for_sufficient_resources_ = true; |
367 if (!rdh_->HasSufficientResourcesForRequest(request())) { | 366 if (!rdh_->HasSufficientResourcesForRequest(request())) { |
368 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); | 367 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); |
(...skipping 13 matching lines...) Expand all Loading... |
382 request()->LogUnblocked(); | 381 request()->LogUnblocked(); |
383 controller()->Resume(); | 382 controller()->Resume(); |
384 } | 383 } |
385 } | 384 } |
386 | 385 |
387 void AsyncResourceHandler::OnDefer() { | 386 void AsyncResourceHandler::OnDefer() { |
388 request()->LogBlockedBy("AsyncResourceHandler"); | 387 request()->LogBlockedBy("AsyncResourceHandler"); |
389 } | 388 } |
390 | 389 |
391 } // namespace content | 390 } // namespace content |
OLD | NEW |