Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 // class to prevent registered callbacks from being called after any | 49 // class to prevent registered callbacks from being called after any |
| 50 // objects to which they may refer have been destroyed. It is the | 50 // objects to which they may refer have been destroyed. It is the |
| 51 // responsibility of the callers to avoid use-after-free references. | 51 // responsibility of the callers to avoid use-after-free references. |
| 52 // This may be done by any of several mechanisms, including weak | 52 // This may be done by any of several mechanisms, including weak |
| 53 // pointers, scoped_refptr references, or calling the registration | 53 // pointers, scoped_refptr references, or calling the registration |
| 54 // function with a null callback from a destructor. To enable the null | 54 // function with a null callback from a destructor. To enable the null |
| 55 // callback strategy, callbacks will not be stored between retrieval and | 55 // callback strategy, callbacks will not be stored between retrieval and |
| 56 // evaluation, so setting a null callback will guarantee that the | 56 // evaluation, so setting a null callback will guarantee that the |
| 57 // previous callback will not be executed after setting. | 57 // previous callback will not be executed after setting. |
| 58 // | 58 // |
| 59 // Class methods are virtual to allow mocking for tests; these classes | 59 // Class methods are virtual to allow mocking for tests; these classes |
|
erikmc
2012/06/18 19:25:44
Please include sample usage in the comments.
http
Randy Smith (Not in Mondays)
2012/06/18 20:38:24
Tug on a string :-}. This may have added 50% to t
erikmc
2012/06/21 17:39:44
Adding useful comment lines at the top of the file
| |
| 60 // aren't intended to be base classes for other classes. | 60 // aren't intended to be base classes for other classes. |
| 61 class CONTENT_EXPORT ByteStreamWriter { | 61 class CONTENT_EXPORT ByteStreamWriter { |
| 62 public: | 62 public: |
| 63 virtual ~ByteStreamWriter() = 0; | 63 virtual ~ByteStreamWriter() = 0; |
| 64 | 64 |
| 65 // Always adds the data passed into the ByteStream. Returns true | 65 // Always adds the data passed into the ByteStream. Returns true |
| 66 // if more data may be added without exceeding the class limit | 66 // if more data may be added without exceeding the class limit |
| 67 // on data. Takes ownership of |buffer|. | 67 // on data. Takes ownership of |buffer|. |
| 68 virtual bool Write(scoped_refptr<net::IOBuffer> buffer, | 68 virtual bool Write(scoped_refptr<net::IOBuffer> buffer, |
| 69 size_t byte_count) = 0; | 69 size_t byte_count) = 0; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 CONTENT_EXPORT void CreateByteStream( | 117 CONTENT_EXPORT void CreateByteStream( |
| 118 scoped_refptr<base::SequencedTaskRunner> input_task_runner, | 118 scoped_refptr<base::SequencedTaskRunner> input_task_runner, |
| 119 scoped_refptr<base::SequencedTaskRunner> output_task_runner, | 119 scoped_refptr<base::SequencedTaskRunner> output_task_runner, |
| 120 size_t buffer_size, | 120 size_t buffer_size, |
| 121 scoped_ptr<ByteStreamWriter>* input, | 121 scoped_ptr<ByteStreamWriter>* input, |
| 122 scoped_ptr<ByteStreamReader>* output); | 122 scoped_ptr<ByteStreamReader>* output); |
| 123 | 123 |
| 124 } // namespace content | 124 } // namespace content |
| 125 | 125 |
| 126 #endif // CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ | 126 #endif // CONTENT_BROWSER_DOWNLOAD_BYTE_STREAM_H_ |
| 127 | |
| OLD | NEW |