OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/devtools_network_transaction.h" | 5 #include "chrome/browser/devtools/devtools_network_transaction.h" |
6 | 6 |
| 7 #include "base/profiler/scoped_tracker.h" |
7 #include "chrome/browser/devtools/devtools_network_controller.h" | 8 #include "chrome/browser/devtools/devtools_network_controller.h" |
8 #include "chrome/browser/devtools/devtools_network_interceptor.h" | 9 #include "chrome/browser/devtools/devtools_network_interceptor.h" |
9 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
10 #include "net/base/upload_progress.h" | 11 #include "net/base/upload_progress.h" |
11 #include "net/http/http_network_transaction.h" | 12 #include "net/http/http_network_transaction.h" |
12 #include "net/http/http_request_info.h" | 13 #include "net/http/http_request_info.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Keep in sync with kDevToolsRequestInitiator and | 17 // Keep in sync with kDevToolsRequestInitiator and |
(...skipping 30 matching lines...) Expand all Loading... |
47 if (callback_type_ == START) | 48 if (callback_type_ == START) |
48 throttled_byte_count_ += network_transaction_->GetTotalReceivedBytes(); | 49 throttled_byte_count_ += network_transaction_->GetTotalReceivedBytes(); |
49 if (result > 0) | 50 if (result > 0) |
50 throttled_byte_count_ += result; | 51 throttled_byte_count_ += result; |
51 | 52 |
52 if (interceptor_) | 53 if (interceptor_) |
53 interceptor_->ThrottleTransaction(this, callback_type_ == START); | 54 interceptor_->ThrottleTransaction(this, callback_type_ == START); |
54 } | 55 } |
55 | 56 |
56 void DevToolsNetworkTransaction::OnCallback(int rv) { | 57 void DevToolsNetworkTransaction::OnCallback(int rv) { |
| 58 // TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed. |
| 59 tracked_objects::ScopedTracker tracking_profile( |
| 60 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 61 "424359 DevToolsNetworkTransaction::OnCallback")); |
| 62 |
57 if (failed_) | 63 if (failed_) |
58 return; | 64 return; |
59 DCHECK(!callback_.is_null()); | 65 DCHECK(!callback_.is_null()); |
60 if (callback_type_ == START || callback_type_ == READ) { | 66 if (callback_type_ == START || callback_type_ == READ) { |
61 if (interceptor_ && interceptor_->ShouldThrottle(this)) { | 67 if (interceptor_ && interceptor_->ShouldThrottle(this)) { |
62 Throttle(rv); | 68 Throttle(rv); |
63 return; | 69 return; |
64 } | 70 } |
65 } | 71 } |
66 net::CompletionCallback callback = callback_; | 72 net::CompletionCallback callback = callback_; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 275 } |
270 | 276 |
271 void DevToolsNetworkTransaction::FireThrottledCallback() { | 277 void DevToolsNetworkTransaction::FireThrottledCallback() { |
272 DCHECK(!callback_.is_null()); | 278 DCHECK(!callback_.is_null()); |
273 DCHECK(callback_type_ == READ || callback_type_ == START); | 279 DCHECK(callback_type_ == READ || callback_type_ == START); |
274 net::CompletionCallback callback = callback_; | 280 net::CompletionCallback callback = callback_; |
275 callback_.Reset(); | 281 callback_.Reset(); |
276 callback_type_ = NONE; | 282 callback_type_ = NONE; |
277 callback.Run(throttled_result_); | 283 callback.Run(throttled_result_); |
278 } | 284 } |
OLD | NEW |