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

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

Issue 9270030: net: Don't merge HTTP headers and body if the body is not in memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 years, 11 months 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
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Returns whether there is no more data to read, regardless of whether 59 // Returns whether there is no more data to read, regardless of whether
60 // position < size. 60 // position < size.
61 bool eof() const { return eof_; } 61 bool eof() const { return eof_; }
62 62
63 // Returns whether the data available in buf() includes the last chunk in a 63 // Returns whether the data available in buf() includes the last chunk in a
64 // chunked data stream. This method returns true once the final chunk has been 64 // chunked data stream. This method returns true once the final chunk has been
65 // placed in the IOBuffer returned by buf(), in contrast to eof() which 65 // placed in the IOBuffer returned by buf(), in contrast to eof() which
66 // returns true only after the data in buf() has been consumed. 66 // returns true only after the data in buf() has been consumed.
67 bool IsOnLastChunk() const; 67 bool IsOnLastChunk() const;
68 68
69 // Returns true if the upload data in the stream is entirely in memory.
70 bool IsInMemory() const;
71
69 // This method is provided only to be used by unit tests. 72 // This method is provided only to be used by unit tests.
70 static void set_merge_chunks(bool merge) { merge_chunks_ = merge; } 73 static void set_merge_chunks(bool merge) { merge_chunks_ = merge; }
71 74
72 private: 75 private:
73 // Protects from public access since now we have a static creator function 76 // Protects from public access since now we have a static creator function
74 // which will do both creation and initialization and might return an error. 77 // which will do both creation and initialization and might return an error.
75 explicit UploadDataStream(UploadData* data); 78 explicit UploadDataStream(UploadData* data);
76 79
77 // Fills the buffer with any remaining data and sets eof_ if there was nothing 80 // Fills the buffer with any remaining data and sets eof_ if there was nothing
78 // left to fill the buffer with. 81 // left to fill the buffer with.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 static bool merge_chunks_; 118 static bool merge_chunks_;
116 // The size of the stream's buffer pointed by buf_. 119 // The size of the stream's buffer pointed by buf_.
117 static const size_t kBufferSize; 120 static const size_t kBufferSize;
118 121
119 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); 122 DISALLOW_COPY_AND_ASSIGN(UploadDataStream);
120 }; 123 };
121 124
122 } // namespace net 125 } // namespace net
123 126
124 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ 127 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698