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 #include "mojo/edk/system/data_pipe.h" | 5 #include "mojo/edk/system/data_pipe.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "mojo/edk/system/constants.h" | 14 #include "mojo/edk/system/constants.h" |
15 #include "mojo/edk/system/memory.h" | 15 #include "mojo/edk/system/memory.h" |
16 #include "mojo/edk/system/options_validation.h" | 16 #include "mojo/edk/system/options_validation.h" |
17 #include "mojo/edk/system/waiter_list.h" | 17 #include "mojo/edk/system/waiter_list.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace system { | 20 namespace system { |
21 | 21 |
22 // static | 22 // static |
23 const MojoCreateDataPipeOptions DataPipe::kDefaultCreateOptions = { | 23 const MojoCreateDataPipeOptions DataPipe::kDefaultCreateOptions = { |
24 static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)), | 24 static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)), |
25 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, 1u, | 25 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, |
| 26 1u, |
26 static_cast<uint32_t>(kDefaultDataPipeCapacityBytes)}; | 27 static_cast<uint32_t>(kDefaultDataPipeCapacityBytes)}; |
27 | 28 |
28 // static | 29 // static |
29 MojoResult DataPipe::ValidateCreateOptions( | 30 MojoResult DataPipe::ValidateCreateOptions( |
30 UserPointer<const MojoCreateDataPipeOptions> in_options, | 31 UserPointer<const MojoCreateDataPipeOptions> in_options, |
31 MojoCreateDataPipeOptions* out_options) { | 32 MojoCreateDataPipeOptions* out_options) { |
32 const MojoCreateDataPipeOptionsFlags kKnownFlags = | 33 const MojoCreateDataPipeOptionsFlags kKnownFlags = |
33 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD; | 34 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD; |
34 | 35 |
35 *out_options = kDefaultCreateOptions; | 36 *out_options = kDefaultCreateOptions; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 void DataPipe::AwakeConsumerWaitersForStateChangeNoLock( | 465 void DataPipe::AwakeConsumerWaitersForStateChangeNoLock( |
465 const HandleSignalsState& new_consumer_state) { | 466 const HandleSignalsState& new_consumer_state) { |
466 lock_.AssertAcquired(); | 467 lock_.AssertAcquired(); |
467 if (!has_local_consumer_no_lock()) | 468 if (!has_local_consumer_no_lock()) |
468 return; | 469 return; |
469 consumer_waiter_list_->AwakeWaitersForStateChange(new_consumer_state); | 470 consumer_waiter_list_->AwakeWaitersForStateChange(new_consumer_state); |
470 } | 471 } |
471 | 472 |
472 } // namespace system | 473 } // namespace system |
473 } // namespace mojo | 474 } // namespace mojo |
OLD | NEW |