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 "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Returns true if all data has been consumed from this upload data | 87 // Returns true if all data has been consumed from this upload data |
88 // stream. | 88 // stream. |
89 bool IsEOF() const; | 89 bool IsEOF() const; |
90 | 90 |
91 // Returns true if the upload data in the stream is entirely in memory. | 91 // Returns true if the upload data in the stream is entirely in memory. |
92 bool IsInMemory() const; | 92 bool IsInMemory() const; |
93 | 93 |
94 // Adds the given chunk of bytes to be sent with chunked transfer encoding. | 94 // Adds the given chunk of bytes to be sent with chunked transfer encoding. |
95 void AppendChunk(const char* bytes, int bytes_len, bool is_last_chunk); | 95 void AppendChunk(const char* bytes, int bytes_len, bool is_last_chunk); |
96 | 96 |
97 private: | |
98 // Resets this instance to the uninitialized state. | 97 // Resets this instance to the uninitialized state. |
99 void Reset(); | 98 void Reset(); |
100 | 99 |
| 100 private: |
101 // Runs Init() for all element readers. | 101 // Runs Init() for all element readers. |
102 // This method is used to implement Init(). | 102 // This method is used to implement Init(). |
103 int InitInternal(int start_index, const CompletionCallback& callback); | 103 int InitInternal(int start_index, const CompletionCallback& callback); |
104 | 104 |
105 // Resumes initialization and runs callback with the result when necessary. | 105 // Resumes initialization and runs callback with the result when necessary. |
106 void ResumePendingInit(int start_index, | 106 void ResumePendingInit(int start_index, |
107 const CompletionCallback& callback, | 107 const CompletionCallback& callback, |
108 int previous_result); | 108 int previous_result); |
109 | 109 |
110 // Reads data from the element readers. | 110 // Reads data from the element readers. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 base::Closure pending_chunked_read_callback_; | 149 base::Closure pending_chunked_read_callback_; |
150 | 150 |
151 base::WeakPtrFactory<UploadDataStream> weak_ptr_factory_; | 151 base::WeakPtrFactory<UploadDataStream> weak_ptr_factory_; |
152 | 152 |
153 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); | 153 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace net | 156 } // namespace net |
157 | 157 |
158 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ | 158 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ |
OLD | NEW |