| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_upload_data_stream.h" | 5 #include "chrome/browser/devtools/devtools_network_upload_data_stream.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 | 8 |
| 9 DevToolsNetworkUploadDataStream::DevToolsNetworkUploadDataStream( | 9 DevToolsNetworkUploadDataStream::DevToolsNetworkUploadDataStream( |
| 10 net::UploadDataStream* upload_data_stream) | 10 net::UploadDataStream* upload_data_stream) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DCHECK(!interceptor_); | 27 DCHECK(!interceptor_); |
| 28 if (interceptor) | 28 if (interceptor) |
| 29 interceptor_ = interceptor->GetWeakPtr(); | 29 interceptor_ = interceptor->GetWeakPtr(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool DevToolsNetworkUploadDataStream::IsInMemory() const { | 32 bool DevToolsNetworkUploadDataStream::IsInMemory() const { |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 int DevToolsNetworkUploadDataStream::InitInternal( | 36 int DevToolsNetworkUploadDataStream::InitInternal( |
| 37 const net::BoundNetLog& net_log) { | 37 const net::NetLogWithSource& net_log) { |
| 38 throttled_byte_count_ = 0; | 38 throttled_byte_count_ = 0; |
| 39 int result = upload_data_stream_->Init( | 39 int result = upload_data_stream_->Init( |
| 40 base::Bind(&DevToolsNetworkUploadDataStream::StreamInitCallback, | 40 base::Bind(&DevToolsNetworkUploadDataStream::StreamInitCallback, |
| 41 base::Unretained(this)), | 41 base::Unretained(this)), |
| 42 net_log); | 42 net_log); |
| 43 if (result == net::OK && !is_chunked()) | 43 if (result == net::OK && !is_chunked()) |
| 44 SetSize(upload_data_stream_->size()); | 44 SetSize(upload_data_stream_->size()); |
| 45 return result; | 45 return result; |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 throttled_byte_count_ = bytes; | 83 throttled_byte_count_ = bytes; |
| 84 OnReadCompleted(result); | 84 OnReadCompleted(result); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void DevToolsNetworkUploadDataStream::ResetInternal() { | 87 void DevToolsNetworkUploadDataStream::ResetInternal() { |
| 88 upload_data_stream_->Reset(); | 88 upload_data_stream_->Reset(); |
| 89 throttled_byte_count_ = 0; | 89 throttled_byte_count_ = 0; |
| 90 if (interceptor_) | 90 if (interceptor_) |
| 91 interceptor_->StopThrottle(throttle_callback_); | 91 interceptor_->StopThrottle(throttle_callback_); |
| 92 } | 92 } |
| OLD | NEW |