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/elements_upload_data_stream.h" | 5 #include "net/base/elements_upload_data_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 weak_ptr_factory_(this) { | 24 weak_ptr_factory_(this) { |
25 } | 25 } |
26 | 26 |
27 ElementsUploadDataStream::~ElementsUploadDataStream() { | 27 ElementsUploadDataStream::~ElementsUploadDataStream() { |
28 } | 28 } |
29 | 29 |
30 scoped_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( | 30 scoped_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( |
31 scoped_ptr<UploadElementReader> reader, | 31 scoped_ptr<UploadElementReader> reader, |
32 int64 identifier) { | 32 int64 identifier) { |
33 ScopedVector<UploadElementReader> readers; | 33 ScopedVector<UploadElementReader> readers; |
34 readers.push_back(reader.release()); | 34 readers.push_back(reader.Pass()); |
35 return scoped_ptr<UploadDataStream>( | 35 return scoped_ptr<UploadDataStream>( |
36 new ElementsUploadDataStream(readers.Pass(), identifier)); | 36 new ElementsUploadDataStream(readers.Pass(), identifier)); |
37 } | 37 } |
38 | 38 |
39 int ElementsUploadDataStream::InitInternal() { | 39 int ElementsUploadDataStream::InitInternal() { |
40 return InitElements(0); | 40 return InitElements(0); |
41 } | 41 } |
42 | 42 |
43 int ElementsUploadDataStream::ReadInternal( | 43 int ElementsUploadDataStream::ReadInternal( |
44 IOBuffer* buf, | 44 IOBuffer* buf, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 DCHECK(!read_failed_); | 157 DCHECK(!read_failed_); |
158 | 158 |
159 if (result >= 0) { | 159 if (result >= 0) { |
160 buf->DidConsume(result); | 160 buf->DidConsume(result); |
161 } else { | 161 } else { |
162 read_failed_ = true; | 162 read_failed_ = true; |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 } // namespace net | 166 } // namespace net |
OLD | NEW |