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/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 CancelRequest(false); | 475 CancelRequest(false); |
476 } | 476 } |
477 | 477 |
478 void ResourceLoader::StartRequestInternal() { | 478 void ResourceLoader::StartRequestInternal() { |
479 DCHECK(!request_->is_pending()); | 479 DCHECK(!request_->is_pending()); |
480 | 480 |
481 if (!request_->status().is_success()) { | 481 if (!request_->status().is_success()) { |
482 return; | 482 return; |
483 } | 483 } |
484 | 484 |
485 base::WeakPtr<ResourceLoader> weak_self = weak_ptr_factory_.GetWeakPtr(); | |
485 started_request_ = true; | 486 started_request_ = true; |
486 request_->Start(); | 487 request_->Start(); |
487 | 488 |
488 delegate_->DidStartRequest(this); | 489 // Starting the request may have lead to the deletion of this ResourceLoader |
490 // if an error occured when calling NetworkDelegate::NotifyBeforeURLRequest. | |
491 if (weak_self.get()) | |
nasko
2016/09/22 18:32:50
This seems like a generic issue unrelated to the g
clamy
2016/09/26 15:37:51
Done.
| |
492 delegate_->DidStartRequest(this); | |
489 } | 493 } |
490 | 494 |
491 void ResourceLoader::CancelRequestInternal(int error, bool from_renderer) { | 495 void ResourceLoader::CancelRequestInternal(int error, bool from_renderer) { |
492 DVLOG(1) << "CancelRequestInternal: " << request_->url().spec(); | 496 DVLOG(1) << "CancelRequestInternal: " << request_->url().spec(); |
493 | 497 |
494 ResourceRequestInfoImpl* info = GetRequestInfo(); | 498 ResourceRequestInfoImpl* info = GetRequestInfo(); |
495 | 499 |
496 // WebKit will send us a cancel for downloads since it no longer handles | 500 // WebKit will send us a cancel for downloads since it no longer handles |
497 // them. In this case, ignore the cancel since we handle downloads in the | 501 // them. In this case, ignore the cancel since we handle downloads in the |
498 // browser. | 502 // browser. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
717 } | 721 } |
718 | 722 |
719 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 723 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
720 } else if (request_->response_info().unused_since_prefetch) { | 724 } else if (request_->response_info().unused_since_prefetch) { |
721 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 725 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
722 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 726 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
723 } | 727 } |
724 } | 728 } |
725 | 729 |
726 } // namespace content | 730 } // namespace content |
OLD | NEW |