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_DATA_PIPE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "mojo/edk/embedder/platform_handle_vector.h" | 13 #include "mojo/edk/embedder/platform_handle_vector.h" |
14 #include "mojo/edk/system/channel_endpoint_client.h" | 14 #include "mojo/edk/system/channel_endpoint_client.h" |
15 #include "mojo/edk/system/handle_signals_state.h" | 15 #include "mojo/edk/system/handle_signals_state.h" |
16 #include "mojo/edk/system/memory.h" | 16 #include "mojo/edk/system/memory.h" |
17 #include "mojo/edk/system/mutex.h" | 17 #include "mojo/edk/util/mutex.h" |
18 #include "mojo/edk/system/thread_annotations.h" | |
19 #include "mojo/edk/util/ref_ptr.h" | 18 #include "mojo/edk/util/ref_ptr.h" |
| 19 #include "mojo/edk/util/thread_annotations.h" |
20 #include "mojo/public/c/system/data_pipe.h" | 20 #include "mojo/public/c/system/data_pipe.h" |
21 #include "mojo/public/c/system/types.h" | 21 #include "mojo/public/c/system/types.h" |
22 #include "mojo/public/cpp/system/macros.h" | 22 #include "mojo/public/cpp/system/macros.h" |
23 | 23 |
24 namespace mojo { | 24 namespace mojo { |
25 namespace system { | 25 namespace system { |
26 | 26 |
27 class Awakable; | 27 class Awakable; |
28 class AwakableList; | 28 class AwakableList; |
29 class Channel; | 29 class Channel; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 return !!producer_awakable_list_; | 258 return !!producer_awakable_list_; |
259 } | 259 } |
260 bool has_local_consumer_no_lock() const MOJO_SHARED_LOCKS_REQUIRED(mutex_) { | 260 bool has_local_consumer_no_lock() const MOJO_SHARED_LOCKS_REQUIRED(mutex_) { |
261 mutex_.AssertHeld(); | 261 mutex_.AssertHeld(); |
262 return !!consumer_awakable_list_; | 262 return !!consumer_awakable_list_; |
263 } | 263 } |
264 | 264 |
265 MSVC_SUPPRESS_WARNING(4324) | 265 MSVC_SUPPRESS_WARNING(4324) |
266 const MojoCreateDataPipeOptions validated_options_; | 266 const MojoCreateDataPipeOptions validated_options_; |
267 | 267 |
268 mutable Mutex mutex_; | 268 mutable util::Mutex mutex_; |
269 // *Known* state of producer or consumer. | 269 // *Known* state of producer or consumer. |
270 bool producer_open_ MOJO_GUARDED_BY(mutex_); | 270 bool producer_open_ MOJO_GUARDED_BY(mutex_); |
271 bool consumer_open_ MOJO_GUARDED_BY(mutex_); | 271 bool consumer_open_ MOJO_GUARDED_BY(mutex_); |
272 // Non-null only if the producer or consumer, respectively, is local. | 272 // Non-null only if the producer or consumer, respectively, is local. |
273 std::unique_ptr<AwakableList> producer_awakable_list_ MOJO_GUARDED_BY(mutex_); | 273 std::unique_ptr<AwakableList> producer_awakable_list_ MOJO_GUARDED_BY(mutex_); |
274 std::unique_ptr<AwakableList> consumer_awakable_list_ MOJO_GUARDED_BY(mutex_); | 274 std::unique_ptr<AwakableList> consumer_awakable_list_ MOJO_GUARDED_BY(mutex_); |
275 // These are nonzero if and only if a two-phase write/read is in progress. | 275 // These are nonzero if and only if a two-phase write/read is in progress. |
276 uint32_t producer_two_phase_max_num_bytes_written_ MOJO_GUARDED_BY(mutex_); | 276 uint32_t producer_two_phase_max_num_bytes_written_ MOJO_GUARDED_BY(mutex_); |
277 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); | 277 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); |
278 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); | 278 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); |
279 | 279 |
280 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); | 280 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); |
281 }; | 281 }; |
282 | 282 |
283 } // namespace system | 283 } // namespace system |
284 } // namespace mojo | 284 } // namespace mojo |
285 | 285 |
286 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 286 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |