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 "chrome/browser/download/download_resource_throttle.h" | 5 #include "chrome/browser/download/download_resource_throttle.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/profiler/scoped_tracker.h" | |
9 #include "chrome/browser/download/download_stats.h" | 8 #include "chrome/browser/download/download_stats.h" |
10 #include "content/public/browser/resource_controller.h" | 9 #include "content/public/browser/resource_controller.h" |
11 | 10 |
12 DownloadResourceThrottle::DownloadResourceThrottle( | 11 DownloadResourceThrottle::DownloadResourceThrottle( |
13 DownloadRequestLimiter* limiter, | 12 DownloadRequestLimiter* limiter, |
14 int render_process_id, | 13 int render_process_id, |
15 int render_view_id, | 14 int render_view_id, |
16 const GURL& url, | 15 const GURL& url, |
17 const std::string& request_method) | 16 const std::string& request_method) |
18 : querying_limiter_(true), | 17 : querying_limiter_(true), |
(...skipping 15 matching lines...) Expand all Loading... |
34 WillDownload(defer); | 33 WillDownload(defer); |
35 } | 34 } |
36 | 35 |
37 void DownloadResourceThrottle::WillRedirectRequest( | 36 void DownloadResourceThrottle::WillRedirectRequest( |
38 const net::RedirectInfo& redirect_info, | 37 const net::RedirectInfo& redirect_info, |
39 bool* defer) { | 38 bool* defer) { |
40 WillDownload(defer); | 39 WillDownload(defer); |
41 } | 40 } |
42 | 41 |
43 void DownloadResourceThrottle::WillProcessResponse(bool* defer) { | 42 void DownloadResourceThrottle::WillProcessResponse(bool* defer) { |
44 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | |
45 tracked_objects::ScopedTracker tracking_profile( | |
46 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
47 "422516 DownloadResourceThrottle::WillProcessResponse")); | |
48 | |
49 WillDownload(defer); | 43 WillDownload(defer); |
50 } | 44 } |
51 | 45 |
52 const char* DownloadResourceThrottle::GetNameForLogging() const { | 46 const char* DownloadResourceThrottle::GetNameForLogging() const { |
53 return "DownloadResourceThrottle"; | 47 return "DownloadResourceThrottle"; |
54 } | 48 } |
55 | 49 |
56 void DownloadResourceThrottle::WillDownload(bool* defer) { | 50 void DownloadResourceThrottle::WillDownload(bool* defer) { |
57 DCHECK(!request_deferred_); | 51 DCHECK(!request_deferred_); |
58 | 52 |
(...skipping 22 matching lines...) Expand all Loading... |
81 | 75 |
82 if (request_deferred_) { | 76 if (request_deferred_) { |
83 request_deferred_ = false; | 77 request_deferred_ = false; |
84 if (allow) { | 78 if (allow) { |
85 controller()->Resume(); | 79 controller()->Resume(); |
86 } else { | 80 } else { |
87 controller()->Cancel(); | 81 controller()->Cancel(); |
88 } | 82 } |
89 } | 83 } |
90 } | 84 } |
OLD | NEW |