| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "chrome/browser/devtools/devtools_network_controller.h" | 10 #include "chrome/browser/devtools/devtools_network_controller.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const net::CompletionCallback& callback, bool start, int result) { | 53 const net::CompletionCallback& callback, bool start, int result) { |
| 54 if (failed_) | 54 if (failed_) |
| 55 return net::ERR_INTERNET_DISCONNECTED; | 55 return net::ERR_INTERNET_DISCONNECTED; |
| 56 if (!interceptor_ || result < 0) | 56 if (!interceptor_ || result < 0) |
| 57 return result; | 57 return result; |
| 58 | 58 |
| 59 base::TimeTicks send_end; | 59 base::TimeTicks send_end; |
| 60 if (start) { | 60 if (start) { |
| 61 throttled_byte_count_ += network_transaction_->GetTotalReceivedBytes(); | 61 throttled_byte_count_ += network_transaction_->GetTotalReceivedBytes(); |
| 62 net::LoadTimingInfo load_timing_info; | 62 net::LoadTimingInfo load_timing_info; |
| 63 if (GetLoadTimingInfo(&load_timing_info)) | 63 if (GetLoadTimingInfo(&load_timing_info)) { |
| 64 send_end = load_timing_info.send_end; | 64 send_end = load_timing_info.send_end; |
| 65 if (!load_timing_info.push_start.is_null()) |
| 66 start = false; |
| 67 } |
| 65 if (send_end.is_null()) | 68 if (send_end.is_null()) |
| 66 send_end = base::TimeTicks::Now(); | 69 send_end = base::TimeTicks::Now(); |
| 67 } | 70 } |
| 68 if (result > 0) | 71 if (result > 0) |
| 69 throttled_byte_count_ += result; | 72 throttled_byte_count_ += result; |
| 70 | 73 |
| 71 throttle_callback_ = base::Bind(&DevToolsNetworkTransaction::ThrottleCallback, | 74 throttle_callback_ = base::Bind(&DevToolsNetworkTransaction::ThrottleCallback, |
| 72 base::Unretained(this), callback); | 75 base::Unretained(this), callback); |
| 73 int rv = interceptor_->StartThrottle(result, throttled_byte_count_, send_end, | 76 int rv = interceptor_->StartThrottle(result, throttled_byte_count_, send_end, |
| 74 start, false, throttle_callback_); | 77 start, false, throttle_callback_); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (CheckFailed()) | 299 if (CheckFailed()) |
| 297 return net::ERR_INTERNET_DISCONNECTED; | 300 return net::ERR_INTERNET_DISCONNECTED; |
| 298 return network_transaction_->ResumeNetworkStart(); | 301 return network_transaction_->ResumeNetworkStart(); |
| 299 } | 302 } |
| 300 | 303 |
| 301 void | 304 void |
| 302 DevToolsNetworkTransaction::GetConnectionAttempts(net::ConnectionAttempts* out) | 305 DevToolsNetworkTransaction::GetConnectionAttempts(net::ConnectionAttempts* out) |
| 303 const { | 306 const { |
| 304 network_transaction_->GetConnectionAttempts(out); | 307 network_transaction_->GetConnectionAttempts(out); |
| 305 } | 308 } |
| OLD | NEW |