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 "net/base/upload_data_stream.h" | 5 #include "net/base/upload_data_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 identifier_(identifier), | 45 identifier_(identifier), |
46 is_chunked_(is_chunked), | 46 is_chunked_(is_chunked), |
47 initialized_successfully_(false), | 47 initialized_successfully_(false), |
48 is_eof_(false) { | 48 is_eof_(false) { |
49 } | 49 } |
50 | 50 |
51 UploadDataStream::~UploadDataStream() { | 51 UploadDataStream::~UploadDataStream() { |
52 } | 52 } |
53 | 53 |
54 int UploadDataStream::Init(const CompletionCallback& callback, | 54 int UploadDataStream::Init(const CompletionCallback& callback, |
55 const BoundNetLog& net_log) { | 55 const NetLogWithSource& net_log) { |
56 Reset(); | 56 Reset(); |
57 DCHECK(!initialized_successfully_); | 57 DCHECK(!initialized_successfully_); |
58 DCHECK(callback_.is_null()); | 58 DCHECK(callback_.is_null()); |
59 DCHECK(!callback.is_null() || IsInMemory()); | 59 DCHECK(!callback.is_null() || IsInMemory()); |
60 net_log_ = net_log; | 60 net_log_ = net_log; |
61 net_log_.BeginEvent(NetLogEventType::UPLOAD_DATA_STREAM_INIT); | 61 net_log_.BeginEvent(NetLogEventType::UPLOAD_DATA_STREAM_INIT); |
62 | 62 |
63 int result = InitInternal(net_log_); | 63 int result = InitInternal(net_log_); |
64 if (result == ERR_IO_PENDING) { | 64 if (result == ERR_IO_PENDING) { |
65 DCHECK(!IsInMemory()); | 65 DCHECK(!IsInMemory()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 UploadProgress UploadDataStream::GetUploadProgress() const { | 191 UploadProgress UploadDataStream::GetUploadProgress() const { |
192 // While initialization / rewinding is in progress, return nothing. | 192 // While initialization / rewinding is in progress, return nothing. |
193 if (!initialized_successfully_) | 193 if (!initialized_successfully_) |
194 return UploadProgress(); | 194 return UploadProgress(); |
195 | 195 |
196 return UploadProgress(current_position_, total_size_); | 196 return UploadProgress(current_position_, total_size_); |
197 } | 197 } |
198 | 198 |
199 } // namespace net | 199 } // namespace net |
OLD | NEW |