| 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/download/download_resource_handler.h" | 5 #include "content/browser/download/download_resource_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (!was_deferred_) | 405 if (!was_deferred_) |
| 406 return; | 406 return; |
| 407 if (pause_count_ > 0) | 407 if (pause_count_ > 0) |
| 408 return; | 408 return; |
| 409 | 409 |
| 410 was_deferred_ = false; | 410 was_deferred_ = false; |
| 411 if (!last_stream_pause_time_.is_null()) { | 411 if (!last_stream_pause_time_.is_null()) { |
| 412 total_pause_time_ += (base::TimeTicks::Now() - last_stream_pause_time_); | 412 total_pause_time_ += (base::TimeTicks::Now() - last_stream_pause_time_); |
| 413 last_stream_pause_time_ = base::TimeTicks(); | 413 last_stream_pause_time_ = base::TimeTicks(); |
| 414 } | 414 } |
| 415 ResourceDispatcherHostImpl::Get()->ResumeDeferredRequest( | 415 |
| 416 global_id_.child_id, | 416 controller()->Resume(); |
| 417 global_id_.request_id); | |
| 418 } | 417 } |
| 419 | 418 |
| 420 void DownloadResourceHandler::CancelRequest() { | 419 void DownloadResourceHandler::CancelRequest() { |
| 421 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 420 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 422 | 421 |
| 423 ResourceDispatcherHostImpl::Get()->CancelRequest( | 422 ResourceDispatcherHostImpl::Get()->CancelRequest( |
| 424 global_id_.child_id, | 423 global_id_.child_id, |
| 425 global_id_.request_id, | 424 global_id_.request_id, |
| 426 false); | 425 false); |
| 427 } | 426 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 453 // false somewhere in the chain of resource handlers. | 452 // false somewhere in the chain of resource handlers. |
| 454 CallStartedCB(DownloadId(), net::ERR_ACCESS_DENIED); | 453 CallStartedCB(DownloadId(), net::ERR_ACCESS_DENIED); |
| 455 | 454 |
| 456 // Remove output stream callback if a stream exists. | 455 // Remove output stream callback if a stream exists. |
| 457 if (stream_writer_.get()) | 456 if (stream_writer_.get()) |
| 458 stream_writer_->RegisterCallback(base::Closure()); | 457 stream_writer_->RegisterCallback(base::Closure()); |
| 459 | 458 |
| 460 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 459 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
| 461 base::TimeTicks::Now() - download_start_time_); | 460 base::TimeTicks::Now() - download_start_time_); |
| 462 } | 461 } |
| 463 | |
| OLD | NEW |