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 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // to a piece of shared memory of size sizeof(FlagArray) and be able to | 126 // to a piece of shared memory of size sizeof(FlagArray) and be able to |
127 // use the class. No vtables etc. | 127 // use the class. No vtables etc. |
128 // TODO(tommi): Move this to its own header when we start using it for signaling | 128 // TODO(tommi): Move this to its own header when we start using it for signaling |
129 // audio devices. As is, it's just here for perf comparison against the | 129 // audio devices. As is, it's just here for perf comparison against the |
130 // "multiple notifiers" approach. | 130 // "multiple notifiers" approach. |
131 struct FlagArray { | 131 struct FlagArray { |
132 public: | 132 public: |
133 FlagArray() : flags_() {} | 133 FlagArray() : flags_() {} |
134 | 134 |
135 bool is_set(size_t index) const { | 135 bool is_set(size_t index) const { |
136 return (flags_[index >> 5] & (1 << (index & 31))) ? true : false; | 136 return (flags_[index >> 5] & (1 << (index & 31))); |
137 } | 137 } |
138 | 138 |
139 void set(size_t index) { | 139 void set(size_t index) { |
140 flags_[index >> 5] |= (1U << (static_cast<uint32>(index) & 31)); | 140 flags_[index >> 5] |= (1U << (static_cast<uint32>(index) & 31)); |
141 } | 141 } |
142 | 142 |
143 void clear(size_t index) { | 143 void clear(size_t index) { |
144 flags_[index >> 5] &= ~(1U << (static_cast<uint32>(index) & 31)); | 144 flags_[index >> 5] &= ~(1U << (static_cast<uint32>(index) & 31)); |
145 } | 145 } |
146 | 146 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 ipc->ready = true; | 456 ipc->ready = true; |
457 | 457 |
458 a.Signal(); | 458 a.Signal(); |
459 a.Wait(); | 459 a.Wait(); |
460 | 460 |
461 int exit_code = -1; | 461 int exit_code = -1; |
462 base::WaitForExitCode(process, &exit_code); | 462 base::WaitForExitCode(process, &exit_code); |
463 EXPECT_EQ(0, exit_code); | 463 EXPECT_EQ(0, exit_code); |
464 } | 464 } |
OLD | NEW |