| 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/public/browser/resource_throttle.h" | 7 #include "content/public/browser/resource_throttle.h" |
| 8 #include "content/public/common/resource_response.h" | 8 #include "content/public/common/resource_response.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 deferred_response_ = response; | 94 deferred_response_ = response; |
| 95 return true; // Do not cancel. | 95 return true; // Do not cancel. |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 index_ = 0; // Reset for next time. | 99 index_ = 0; // Reset for next time. |
| 100 | 100 |
| 101 return next_handler_->OnResponseStarted(request_id, response, defer); | 101 return next_handler_->OnResponseStarted(request_id, response, defer); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ThrottlingResourceHandler::OnRequestPriorityChanged(int request_id) { |
| 105 for (size_t i = 0; i < throttles_.size(); ++i) { |
| 106 throttles_[i]->OnRequestPriorityChanged(); |
| 107 } |
| 108 next_handler_->OnRequestPriorityChanged(request_id); |
| 109 } |
| 110 |
| 104 void ThrottlingResourceHandler::Cancel() { | 111 void ThrottlingResourceHandler::Cancel() { |
| 105 cancelled_by_resource_throttle_ = true; | 112 cancelled_by_resource_throttle_ = true; |
| 106 controller()->Cancel(); | 113 controller()->Cancel(); |
| 107 } | 114 } |
| 108 | 115 |
| 109 void ThrottlingResourceHandler::CancelAndIgnore() { | 116 void ThrottlingResourceHandler::CancelAndIgnore() { |
| 110 cancelled_by_resource_throttle_ = true; | 117 cancelled_by_resource_throttle_ = true; |
| 111 controller()->CancelAndIgnore(); | 118 controller()->CancelAndIgnore(); |
| 112 } | 119 } |
| 113 | 120 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 182 |
| 176 bool defer = false; | 183 bool defer = false; |
| 177 if (!OnResponseStarted(request_id_, response, &defer)) { | 184 if (!OnResponseStarted(request_id_, response, &defer)) { |
| 178 controller()->Cancel(); | 185 controller()->Cancel(); |
| 179 } else if (!defer) { | 186 } else if (!defer) { |
| 180 controller()->Resume(); | 187 controller()->Resume(); |
| 181 } | 188 } |
| 182 } | 189 } |
| 183 | 190 |
| 184 } // namespace content | 191 } // namespace content |
| OLD | NEW |