OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_STREAMS_STREAM_H_ | 5 #ifndef CONTENT_BROWSER_STREAMS_STREAM_H_ |
6 #define CONTENT_BROWSER_STREAMS_STREAM_H_ | 6 #define CONTENT_BROWSER_STREAMS_STREAM_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Notifies this stream that it will not be receiving any more data. | 71 // Notifies this stream that it will not be receiving any more data. |
72 void Finalize(); | 72 void Finalize(); |
73 | 73 |
74 // Reads a maximum of |buf_size| from the stream into |buf|. Sets | 74 // Reads a maximum of |buf_size| from the stream into |buf|. Sets |
75 // |*bytes_read| to the number of bytes actually read. | 75 // |*bytes_read| to the number of bytes actually read. |
76 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read, | 76 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read, |
77 // and STREAM_COMPLETE if the stream is finalized and all data has been read. | 77 // and STREAM_COMPLETE if the stream is finalized and all data has been read. |
78 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); | 78 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); |
79 | 79 |
80 scoped_ptr<StreamHandle> CreateHandle(const GURL& original_url, | 80 scoped_ptr<StreamHandle> CreateHandle(const GURL& original_url, |
81 const std::string& mime_type); | 81 const std::string& mime_type, |
| 82 const std::string& response_headers); |
82 void CloseHandle(); | 83 void CloseHandle(); |
83 | 84 |
84 // Indicates whether there is space in the buffer to add more data. | 85 // Indicates whether there is space in the buffer to add more data. |
85 bool can_add_data() const { return can_add_data_; } | 86 bool can_add_data() const { return can_add_data_; } |
86 | 87 |
87 const GURL& url() const { return url_; } | 88 const GURL& url() const { return url_; } |
88 | 89 |
89 // For StreamRegistry to remember the last memory usage reported to it. | 90 // For StreamRegistry to remember the last memory usage reported to it. |
90 size_t last_total_buffered_bytes() const { | 91 size_t last_total_buffered_bytes() const { |
91 return last_total_buffered_bytes_; | 92 return last_total_buffered_bytes_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 StreamHandleImpl* stream_handle_; | 130 StreamHandleImpl* stream_handle_; |
130 | 131 |
131 base::WeakPtrFactory<Stream> weak_ptr_factory_; | 132 base::WeakPtrFactory<Stream> weak_ptr_factory_; |
132 DISALLOW_COPY_AND_ASSIGN(Stream); | 133 DISALLOW_COPY_AND_ASSIGN(Stream); |
133 }; | 134 }; |
134 | 135 |
135 } // namespace content | 136 } // namespace content |
136 | 137 |
137 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_ | 138 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_ |
OLD | NEW |