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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 int signaled = waiter.Wait(); | 108 int signaled = waiter.Wait(); |
109 ++shared_data_[signaled]; | 109 ++shared_data_[signaled]; |
110 (*notifiers_)[signaled]->Signal(); | 110 (*notifiers_)[signaled]->Signal(); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 private: | 114 private: |
115 size_t* shared_data_; | 115 size_t* shared_data_; |
116 size_t repeats_; | 116 size_t repeats_; |
117 const CrossProcessNotification::Notifications* notifiers_; | 117 const CrossProcessNotification::Notifications* notifiers_; |
118 size_t count_; | |
119 DISALLOW_COPY_AND_ASSIGN(MultiNotifierWorker); | 118 DISALLOW_COPY_AND_ASSIGN(MultiNotifierWorker); |
120 }; | 119 }; |
121 | 120 |
122 // A fixed array of bool flags. Each flag uses 1 bit. Use sizeof(FlagArray) | 121 // A fixed array of bool flags. Each flag uses 1 bit. Use sizeof(FlagArray) |
123 // to determine how much memory you need. The number of flags will therefore | 122 // to determine how much memory you need. The number of flags will therefore |
124 // be sizeof(FlagArray) * 8. | 123 // be sizeof(FlagArray) * 8. |
125 // We use 'struct' to signify that this structures represents compiler | 124 // We use 'struct' to signify that this structures represents compiler |
126 // independent structured data. I.e. you must be able to map this class | 125 // independent structured data. I.e. you must be able to map this class |
127 // 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 |
128 // use the class. No vtables etc. | 127 // use the class. No vtables etc. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 455 |
457 ipc->ready = true; | 456 ipc->ready = true; |
458 | 457 |
459 a.Signal(); | 458 a.Signal(); |
460 a.Wait(); | 459 a.Wait(); |
461 | 460 |
462 int exit_code = -1; | 461 int exit_code = -1; |
463 base::WaitForExitCode(process, &exit_code); | 462 base::WaitForExitCode(process, &exit_code); |
464 EXPECT_EQ(0, exit_code); | 463 EXPECT_EQ(0, exit_code); |
465 } | 464 } |
OLD | NEW |