| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 UI_GFX_SHARED_EVENT_H_ | 5 #ifndef UI_GFX_SHARED_EVENT_H_ |
| 6 #define UI_GFX_SHARED_EVENT_H_ | 6 #define UI_GFX_SHARED_EVENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Create a new SharedEvent object from an existing, platform-specific | 24 // Create a new SharedEvent object from an existing, platform-specific |
| 25 // OS primitive. | 25 // OS primitive. |
| 26 explicit SharedEvent(const SharedEventHandle& handle); | 26 explicit SharedEvent(const SharedEventHandle& handle); |
| 27 | 27 |
| 28 // Creates a new event which can be used in a remote process. Returns a | 28 // Creates a new event which can be used in a remote process. Returns a |
| 29 // platform-specific OS primitive for the new event. The caller is | 29 // platform-specific OS primitive for the new event. The caller is |
| 30 // responsible for destroying the OS primitive. | 30 // responsible for destroying the OS primitive. |
| 31 static SharedEventHandle CreateForProcess(base::ProcessHandle process); | 31 static SharedEventHandle CreateForProcess(base::ProcessHandle process); |
| 32 | 32 |
| 33 // Return true iff the given handle is valid (i.e. not the distingished |
| 34 // invalid value; NULL for a HANDLE and -1 for a file descriptor) |
| 35 static bool IsHandleValid(const SharedEventHandle& handle); |
| 36 |
| 33 // Duplicates the underlying OS primitive. The caller is responsible for | 37 // Duplicates the underlying OS primitive. The caller is responsible for |
| 34 // destroying the duplicated OS primitive. | 38 // destroying the duplicated OS primitive. |
| 35 static SharedEventHandle DuplicateHandle(const SharedEventHandle& handle); | 39 static SharedEventHandle DuplicateHandle(const SharedEventHandle& handle); |
| 36 | 40 |
| 37 // Put the event in the un-signaled state. | 41 // Put the event in the un-signaled state. |
| 38 void Reset(); | 42 void Reset(); |
| 39 | 43 |
| 40 // Put the event in the signaled state. Causing any thread blocked on Wait | 44 // Put the event in the signaled state. Causing any thread blocked on Wait |
| 41 // to be woken up. | 45 // to be woken up. |
| 42 void Signal(); | 46 void Signal(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 return reinterpret_cast<int32_t*>(shared_memory_.memory()); | 67 return reinterpret_cast<int32_t*>(shared_memory_.memory()); |
| 64 } | 68 } |
| 65 base::SharedMemory shared_memory_; | 69 base::SharedMemory shared_memory_; |
| 66 | 70 |
| 67 DISALLOW_COPY_AND_ASSIGN(SharedEvent); | 71 DISALLOW_COPY_AND_ASSIGN(SharedEvent); |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 } // namespace gfx | 74 } // namespace gfx |
| 71 | 75 |
| 72 #endif // UI_GFX_SHARED_EVENT_H_ | 76 #endif // UI_GFX_SHARED_EVENT_H_ |
| OLD | NEW |