| 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 #ifndef NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ | 5 #ifndef NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ |
| 6 #define NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ | 6 #define NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/base/upload_data_stream.h" | 15 #include "net/base/upload_data_stream.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class DrainableIOBuffer; | 19 class DrainableIOBuffer; |
| 20 class IOBuffer; | 20 class IOBuffer; |
| 21 class UploadElementReader; | 21 class UploadElementReader; |
| 22 | 22 |
| 23 // A non-chunked UploadDataStream consisting of one or more UploadElements. | 23 // A non-chunked UploadDataStream consisting of one or more UploadElements. |
| 24 class NET_EXPORT ElementsUploadDataStream : public UploadDataStream { | 24 class NET_EXPORT ElementsUploadDataStream : public UploadDataStream { |
| 25 public: | 25 public: |
| 26 ElementsUploadDataStream(ScopedVector<UploadElementReader> element_readers, | 26 ElementsUploadDataStream(ScopedVector<UploadElementReader> element_readers, |
| 27 int64 identifier); | 27 int64_t identifier); |
| 28 | 28 |
| 29 ~ElementsUploadDataStream() override; | 29 ~ElementsUploadDataStream() override; |
| 30 | 30 |
| 31 // Creates an ElementsUploadDataStream with a single reader. Returns a | 31 // Creates an ElementsUploadDataStream with a single reader. Returns a |
| 32 // scoped_ptr<UploadDataStream> for ease of use. | 32 // scoped_ptr<UploadDataStream> for ease of use. |
| 33 static scoped_ptr<UploadDataStream> CreateWithReader( | 33 static scoped_ptr<UploadDataStream> CreateWithReader( |
| 34 scoped_ptr<UploadElementReader> reader, | 34 scoped_ptr<UploadElementReader> reader, |
| 35 int64 identifier); | 35 int64_t identifier); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // UploadDataStream implementation. | 38 // UploadDataStream implementation. |
| 39 bool IsInMemory() const override; | 39 bool IsInMemory() const override; |
| 40 const ScopedVector<UploadElementReader>* GetElementReaders() const override; | 40 const ScopedVector<UploadElementReader>* GetElementReaders() const override; |
| 41 int InitInternal() override; | 41 int InitInternal() override; |
| 42 int ReadInternal(IOBuffer* buf, int buf_len) override; | 42 int ReadInternal(IOBuffer* buf, int buf_len) override; |
| 43 void ResetInternal() override; | 43 void ResetInternal() override; |
| 44 | 44 |
| 45 // Runs Init() for all element readers. | 45 // Runs Init() for all element readers. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 76 bool read_failed_; | 76 bool read_failed_; |
| 77 | 77 |
| 78 base::WeakPtrFactory<ElementsUploadDataStream> weak_ptr_factory_; | 78 base::WeakPtrFactory<ElementsUploadDataStream> weak_ptr_factory_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ElementsUploadDataStream); | 80 DISALLOW_COPY_AND_ASSIGN(ElementsUploadDataStream); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace net | 83 } // namespace net |
| 84 | 84 |
| 85 #endif // NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ | 85 #endif // NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ |
| OLD | NEW |