| 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_BYTE_STREAM_H_ | 5 #ifndef CONTENT_BROWSER_BYTE_STREAM_H_ |
| 6 #define CONTENT_BROWSER_BYTE_STREAM_H_ | 6 #define CONTENT_BROWSER_BYTE_STREAM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Class methods are virtual to allow mocking for tests; these classes | 59 // Class methods are virtual to allow mocking for tests; these classes |
| 60 // aren't intended to be base classes for other classes. | 60 // aren't intended to be base classes for other classes. |
| 61 // | 61 // |
| 62 // Sample usage (note that this does not show callback usage): | 62 // Sample usage (note that this does not show callback usage): |
| 63 // | 63 // |
| 64 // void OriginatingClass::Initialize() { | 64 // void OriginatingClass::Initialize() { |
| 65 // // Create a stream for sending bytes from IO->FILE threads. | 65 // // Create a stream for sending bytes from IO->FILE threads. |
| 66 // std::unique_ptr<ByteStreamWriter> writer; | 66 // std::unique_ptr<ByteStreamWriter> writer; |
| 67 // std::unique_ptr<ByteStreamReader> reader; | 67 // std::unique_ptr<ByteStreamReader> reader; |
| 68 // CreateByteStream( | 68 // CreateByteStream( |
| 69 // BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 69 // BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 70 // BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 70 // BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 71 // kStreamBufferSize /* e.g. 10240. */, | 71 // kStreamBufferSize /* e.g. 10240. */, |
| 72 // &writer, | 72 // &writer, |
| 73 // &reader); // Presumed passed to FILE thread for reading. | 73 // &reader); // Presumed passed to FILE thread for reading. |
| 74 // | 74 // |
| 75 // // Setup callback for writing. | 75 // // Setup callback for writing. |
| 76 // writer->RegisterCallback(base::Bind(&SpaceAvailable, this)); | 76 // writer->RegisterCallback(base::Bind(&SpaceAvailable, this)); |
| 77 // | 77 // |
| 78 // // Do initial round of writing. | 78 // // Do initial round of writing. |
| 79 // SpaceAvailable(); | 79 // SpaceAvailable(); |
| 80 // } | 80 // } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 CONTENT_EXPORT void CreateByteStream( | 197 CONTENT_EXPORT void CreateByteStream( |
| 198 scoped_refptr<base::SequencedTaskRunner> input_task_runner, | 198 scoped_refptr<base::SequencedTaskRunner> input_task_runner, |
| 199 scoped_refptr<base::SequencedTaskRunner> output_task_runner, | 199 scoped_refptr<base::SequencedTaskRunner> output_task_runner, |
| 200 size_t buffer_size, | 200 size_t buffer_size, |
| 201 std::unique_ptr<ByteStreamWriter>* input, | 201 std::unique_ptr<ByteStreamWriter>* input, |
| 202 std::unique_ptr<ByteStreamReader>* output); | 202 std::unique_ptr<ByteStreamReader>* output); |
| 203 | 203 |
| 204 } // namespace content | 204 } // namespace content |
| 205 | 205 |
| 206 #endif // CONTENT_BROWSER_BYTE_STREAM_H_ | 206 #endif // CONTENT_BROWSER_BYTE_STREAM_H_ |
| OLD | NEW |