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_UPLOAD_DATA_STREAM_H_ | 5 #ifndef NET_BASE_UPLOAD_DATA_STREAM_H_ |
6 #define NET_BASE_UPLOAD_DATA_STREAM_H_ | 6 #define NET_BASE_UPLOAD_DATA_STREAM_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
12 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
13 | 15 |
14 namespace net { | 16 namespace net { |
15 | 17 |
16 class DrainableIOBuffer; | 18 class DrainableIOBuffer; |
17 class IOBuffer; | 19 class IOBuffer; |
18 class UploadElementReader; | 20 class UploadElementReader; |
19 | 21 |
20 // A class for retrieving all data to be sent as a request body. Supports both | 22 // A class for retrieving all data to be sent as a request body. Supports both |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // being read to is not safe for future use, as it may be in use on another | 81 // being read to is not safe for future use, as it may be in use on another |
80 // thread. | 82 // thread. |
81 void Reset(); | 83 void Reset(); |
82 | 84 |
83 // Returns true if the upload data in the stream is entirely in memory, and | 85 // Returns true if the upload data in the stream is entirely in memory, and |
84 // all read requests will succeed synchronously. Expected to return false for | 86 // all read requests will succeed synchronously. Expected to return false for |
85 // chunked requests. | 87 // chunked requests. |
86 virtual bool IsInMemory() const; | 88 virtual bool IsInMemory() const; |
87 | 89 |
88 // Returns a list of element readers owned by |this|, if it has any. | 90 // Returns a list of element readers owned by |this|, if it has any. |
89 virtual const ScopedVector<UploadElementReader>* | 91 virtual const std::vector<scoped_ptr<UploadElementReader>>* |
90 GetElementReaders() const; | 92 GetElementReaders() const; |
91 | 93 |
92 protected: | 94 protected: |
93 // Must be called by subclasses when InitInternal and ReadInternal complete | 95 // Must be called by subclasses when InitInternal and ReadInternal complete |
94 // asynchronously. | 96 // asynchronously. |
95 void OnInitCompleted(int result); | 97 void OnInitCompleted(int result); |
96 void OnReadCompleted(int result); | 98 void OnReadCompleted(int result); |
97 | 99 |
98 // Must be called before InitInternal completes, for non-chunked uploads. | 100 // Must be called before InitInternal completes, for non-chunked uploads. |
99 // Must not be called for chunked uploads. | 101 // Must not be called for chunked uploads. |
100 void SetSize(uint64_t size); | 102 void SetSize(uint64_t size); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool is_eof_; | 136 bool is_eof_; |
135 | 137 |
136 CompletionCallback callback_; | 138 CompletionCallback callback_; |
137 | 139 |
138 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); | 140 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); |
139 }; | 141 }; |
140 | 142 |
141 } // namespace net | 143 } // namespace net |
142 | 144 |
143 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ | 145 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ |
OLD | NEW |