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

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

Issue 15817013: Add Stream support to WebBlobRegistry and FileAPIMessageFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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) 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 bool SetReadObserver(StreamReadObserver* observer); 49 bool SetReadObserver(StreamReadObserver* observer);
50 50
51 // Removes the read observer. |observer| must be the current observer. 51 // Removes the read observer. |observer| must be the current observer.
52 void RemoveReadObserver(StreamReadObserver* observer); 52 void RemoveReadObserver(StreamReadObserver* observer);
53 53
54 // Removes the write observer. |observer| must be the current observer. 54 // Removes the write observer. |observer| must be the current observer.
55 void RemoveWriteObserver(StreamWriteObserver* observer); 55 void RemoveWriteObserver(StreamWriteObserver* observer);
56 56
57 // Adds the data in |buffer| to the stream. Takes ownership of |buffer|. 57 // Adds the data in |buffer| to the stream. Takes ownership of |buffer|.
58 void AddData(scoped_refptr<net::IOBuffer> buffer, size_t size); 58 void AddData(scoped_refptr<net::IOBuffer> buffer, size_t size);
59 // Adds data of |size| at |data| to the stream. This method creates a copy
60 // of the data, and then passes it to |writer_|.
61 void AddData(const char* data, size_t size);
59 62
60 // Notifies this stream that it will not be receiving any more data. 63 // Notifies this stream that it will not be receiving any more data.
61 void Finalize(); 64 void Finalize();
62 65
63 // Reads a maximum of |buf_size| from the stream into |buf|. Sets 66 // Reads a maximum of |buf_size| from the stream into |buf|. Sets
64 // |*bytes_read| to the number of bytes actually read. 67 // |*bytes_read| to the number of bytes actually read.
65 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read, 68 // Returns STREAM_HAS_DATA if data was read, STREAM_EMPTY if no data was read,
66 // and STREAM_COMPLETE if the stream is finalized and all data has been read. 69 // and STREAM_COMPLETE if the stream is finalized and all data has been read.
67 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); 70 StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
68 71
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 106
104 StreamHandleImpl* stream_handle_; 107 StreamHandleImpl* stream_handle_;
105 108
106 base::WeakPtrFactory<Stream> weak_ptr_factory_; 109 base::WeakPtrFactory<Stream> weak_ptr_factory_;
107 DISALLOW_COPY_AND_ASSIGN(Stream); 110 DISALLOW_COPY_AND_ASSIGN(Stream);
108 }; 111 };
109 112
110 } // namespace content 113 } // namespace content
111 114
112 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_ 115 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698