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

Side by Side Diff: content/browser/streams/stream.h

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/browser/storage_partition_impl_unittest.cc ('k') | content/browser/streams/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) 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Notifies this stream that it will not be receiving any more data. 76 // Notifies this stream that it will not be receiving any more data.
77 void Finalize(); 77 void Finalize();
78 78
79 // Reads a maximum of |buf_size| from the stream into |buf|. Sets 79 // Reads a maximum of |buf_size| from the stream into |buf|. Sets
80 // |*bytes_read| to the number of bytes actually read. 80 // |*bytes_read| to the number of bytes actually read.
81 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read, 81 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read,
82 // and STREAM_COMPLETE if the stream is finalized and all data has been read. 82 // and STREAM_COMPLETE if the stream is finalized and all data has been read.
83 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); 83 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
84 84
85 scoped_ptr<StreamHandle> CreateHandle(); 85 std::unique_ptr<StreamHandle> CreateHandle();
86 void CloseHandle(); 86 void CloseHandle();
87 87
88 // Indicates whether there is space in the buffer to add more data. 88 // Indicates whether there is space in the buffer to add more data.
89 bool can_add_data() const { return can_add_data_; } 89 bool can_add_data() const { return can_add_data_; }
90 90
91 const GURL& url() const { return url_; } 91 const GURL& url() const { return url_; }
92 92
93 // For StreamRegistry to remember the last memory usage reported to it. 93 // For StreamRegistry to remember the last memory usage reported to it.
94 size_t last_total_buffered_bytes() const { 94 size_t last_total_buffered_bytes() const {
95 return last_total_buffered_bytes_; 95 return last_total_buffered_bytes_;
(...skipping 20 matching lines...) Expand all
116 // Number of bytes read from |reader_| into |data_| including bytes already 116 // Number of bytes read from |reader_| into |data_| including bytes already
117 // read out. 117 // read out.
118 size_t data_length_; 118 size_t data_length_;
119 // Number of bytes in |data_| that are already read out. 119 // Number of bytes in |data_| that are already read out.
120 size_t data_bytes_read_; 120 size_t data_bytes_read_;
121 121
122 // Last value returned by writer_->TotalBufferedBytes() in AddData(). Stored 122 // Last value returned by writer_->TotalBufferedBytes() in AddData(). Stored
123 // in order to check memory usage. 123 // in order to check memory usage.
124 size_t last_total_buffered_bytes_; 124 size_t last_total_buffered_bytes_;
125 125
126 scoped_ptr<ByteStreamWriter> writer_; 126 std::unique_ptr<ByteStreamWriter> writer_;
127 scoped_ptr<ByteStreamReader> reader_; 127 std::unique_ptr<ByteStreamReader> reader_;
128 128
129 StreamRegistry* registry_; 129 StreamRegistry* registry_;
130 StreamReadObserver* read_observer_; 130 StreamReadObserver* read_observer_;
131 StreamWriteObserver* write_observer_; 131 StreamWriteObserver* write_observer_;
132 132
133 StreamHandleImpl* stream_handle_; 133 StreamHandleImpl* stream_handle_;
134 134
135 base::WeakPtrFactory<Stream> weak_ptr_factory_; 135 base::WeakPtrFactory<Stream> weak_ptr_factory_;
136 DISALLOW_COPY_AND_ASSIGN(Stream); 136 DISALLOW_COPY_AND_ASSIGN(Stream);
137 }; 137 };
138 138
139 } // namespace content 139 } // namespace content
140 140
141 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_ 141 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_unittest.cc ('k') | content/browser/streams/stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698