OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ | 5 #ifndef MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ |
6 #define MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ | 6 #define MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/aligned_memory.h" | 9 #include "base/memory/aligned_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Get the maximum (single) write/read size right now (in number of elements); | 76 // Get the maximum (single) write/read size right now (in number of elements); |
77 // result fits in a |uint32_t|. | 77 // result fits in a |uint32_t|. |
78 size_t GetMaxNumBytesToWrite(); | 78 size_t GetMaxNumBytesToWrite(); |
79 size_t GetMaxNumBytesToRead(); | 79 size_t GetMaxNumBytesToRead(); |
80 | 80 |
81 // Marks the given number of bytes as consumed/discarded. |num_bytes| must be | 81 // Marks the given number of bytes as consumed/discarded. |num_bytes| must be |
82 // no greater than |current_num_bytes_|. | 82 // no greater than |current_num_bytes_|. |
83 void MarkDataAsConsumed(size_t num_bytes); | 83 void MarkDataAsConsumed(size_t num_bytes); |
84 | 84 |
85 // Converts queued data to messages (leaves |buffer_| empty). | |
86 void ConvertDataToMessages(MessageInTransitQueue* message_queue); | |
87 | |
88 scoped_ptr<char, base::AlignedFreeDeleter> buffer_; | 85 scoped_ptr<char, base::AlignedFreeDeleter> buffer_; |
89 // Circular buffer. | 86 // Circular buffer. |
90 size_t start_index_; | 87 size_t start_index_; |
91 size_t current_num_bytes_; | 88 size_t current_num_bytes_; |
92 | 89 |
93 DISALLOW_COPY_AND_ASSIGN(LocalDataPipeImpl); | 90 DISALLOW_COPY_AND_ASSIGN(LocalDataPipeImpl); |
94 }; | 91 }; |
95 | 92 |
96 } // namespace system | 93 } // namespace system |
97 } // namespace mojo | 94 } // namespace mojo |
98 | 95 |
99 #endif // MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ | 96 #endif // MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_ |
OLD | NEW |