Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: net/base/upload_data_stream.h

Issue 9384: UploadDataStream::Reset should call FillBuf to return... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/upload_data_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "net/base/file_stream.h" 8 #include "net/base/file_stream.h"
9 #include "net/base/upload_data.h" 9 #include "net/base/upload_data.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 class UploadDataStream { 13 class UploadDataStream {
14 public: 14 public:
15 UploadDataStream(const UploadData* data); 15 explicit UploadDataStream(const UploadData* data);
16 ~UploadDataStream(); 16 ~UploadDataStream();
17 17
18 // Returns the stream's buffer and buffer length. 18 // Returns the stream's buffer and buffer length.
19 const char* buf() const { return buf_; } 19 const char* buf() const { return buf_; }
20 size_t buf_len() const { return buf_len_; } 20 size_t buf_len() const { return buf_len_; }
21 21
22 // Call to indicate that a portion of the stream's buffer was consumed. This 22 // Call to indicate that a portion of the stream's buffer was consumed. This
23 // call modifies the stream's buffer so that it contains the next segment of 23 // call modifies the stream's buffer so that it contains the next segment of
24 // the upload data to be consumed. 24 // the upload data to be consumed.
25 void DidConsume(size_t num_bytes); 25 void DidConsume(size_t num_bytes);
26 26
27 // Call to reset the stream position to the beginning.
28 void Reset();
29
30 // Returns the total size of the data stream and the current position. 27 // Returns the total size of the data stream and the current position.
31 uint64 size() const { return total_size_; } 28 uint64 size() const { return total_size_; }
32 uint64 position() const { return current_position_; } 29 uint64 position() const { return current_position_; }
33 30
34 private: 31 private:
35 void FillBuf(); 32 void FillBuf();
36 33
37 const UploadData* data_; 34 const UploadData* data_;
38 35
39 // This buffer is filled with data to be uploaded. The data to be sent is 36 // This buffer is filled with data to be uploaded. The data to be sent is
(...skipping 23 matching lines...) Expand all
63 uint64 total_size_; 60 uint64 total_size_;
64 uint64 current_position_; 61 uint64 current_position_;
65 62
66 DISALLOW_EVIL_CONSTRUCTORS(UploadDataStream); 63 DISALLOW_EVIL_CONSTRUCTORS(UploadDataStream);
67 }; 64 };
68 65
69 } // namespace net 66 } // namespace net
70 67
71 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ 68 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_
72 69
OLDNEW
« no previous file with comments | « no previous file | net/base/upload_data_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698