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/throttling_resource_handler.h" | 5 #include "content/browser/loader/throttling_resource_handler.h" |
6 | 6 |
7 #include "content/browser/loader/resource_request_info_impl.h" | 7 #include "content/browser/loader/resource_request_info_impl.h" |
8 #include "content/public/browser/resource_throttle.h" | 8 #include "content/public/browser/resource_throttle.h" |
9 #include "content/public/common/resource_response.h" | 9 #include "content/public/common/resource_response.h" |
10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return next_handler_->OnWillStart(url, defer); | 80 return next_handler_->OnWillStart(url, defer); |
81 } | 81 } |
82 | 82 |
83 bool ThrottlingResourceHandler::OnBeforeNetworkStart(const GURL& url, | 83 bool ThrottlingResourceHandler::OnBeforeNetworkStart(const GURL& url, |
84 bool* defer) { | 84 bool* defer) { |
85 DCHECK(!cancelled_by_resource_throttle_); | 85 DCHECK(!cancelled_by_resource_throttle_); |
86 | 86 |
87 *defer = false; | 87 *defer = false; |
88 while (next_index_ < throttles_.size()) { | 88 while (next_index_ < throttles_.size()) { |
89 int index = next_index_; | 89 int index = next_index_; |
90 throttles_[index]->OnBeforeNetworkStart(defer); | 90 throttles_[index]->WillStartUsingNetwork(defer); |
91 next_index_++; | 91 next_index_++; |
92 if (cancelled_by_resource_throttle_) | 92 if (cancelled_by_resource_throttle_) |
93 return false; | 93 return false; |
94 if (*defer) { | 94 if (*defer) { |
95 OnRequestDefered(index); | 95 OnRequestDefered(index); |
96 deferred_stage_ = DEFERRED_NETWORK_START; | 96 deferred_stage_ = DEFERRED_NETWORK_START; |
97 deferred_url_ = url; | 97 deferred_url_ = url; |
98 return true; // Do not cancel. | 98 return true; // Do not cancel. |
99 } | 99 } |
100 } | 100 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } else if (!defer) { | 224 } else if (!defer) { |
225 controller()->Resume(); | 225 controller()->Resume(); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void ThrottlingResourceHandler::OnRequestDefered(int throttle_index) { | 229 void ThrottlingResourceHandler::OnRequestDefered(int throttle_index) { |
230 request()->LogBlockedBy(throttles_[throttle_index]->GetNameForLogging()); | 230 request()->LogBlockedBy(throttles_[throttle_index]->GetNameForLogging()); |
231 } | 231 } |
232 | 232 |
233 } // namespace content | 233 } // namespace content |
OLD | NEW |