| 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 #include "base/atomicops.h" | 5 #include "base/atomicops.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/process/memory.h" | 7 #include "base/process/memory.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "ui/gfx/gfx_export.h" | 9 #include "ui/gfx/gfx_export.h" |
| 10 #include "ui/gfx/shared_event.h" | 10 #include "ui/gfx/shared_event.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 SharedEventHandle SharedEvent::CreateForProcess(base::ProcessHandle process) { | 41 SharedEventHandle SharedEvent::CreateForProcess(base::ProcessHandle process) { |
| 42 base::SharedMemory shared_memory; | 42 base::SharedMemory shared_memory; |
| 43 if (!shared_memory.CreateAnonymous(kSharedMemorySize)) | 43 if (!shared_memory.CreateAnonymous(kSharedMemorySize)) |
| 44 return SharedEventHandle(); | 44 return SharedEventHandle(); |
| 45 base::SharedMemoryHandle handle; | 45 base::SharedMemoryHandle handle; |
| 46 shared_memory.GiveToProcess(process, &handle); | 46 shared_memory.GiveToProcess(process, &handle); |
| 47 return handle; | 47 return handle; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 bool SharedEvent::IsHandleValid(const SharedEventHandle& handle) { |
| 52 return base::SharedMemory::IsHandleValid(handle); |
| 53 } |
| 54 |
| 55 // static |
| 51 SharedEventHandle SharedEvent::DuplicateHandle( | 56 SharedEventHandle SharedEvent::DuplicateHandle( |
| 52 const SharedEventHandle& handle) { | 57 const SharedEventHandle& handle) { |
| 53 return base::SharedMemory::DuplicateHandle(handle); | 58 return base::SharedMemory::DuplicateHandle(handle); |
| 54 } | 59 } |
| 55 | 60 |
| 56 void SharedEvent::Reset() { | 61 void SharedEvent::Reset() { |
| 57 // Change state to un-signaled iff event is currently in signaled state. | 62 // Change state to un-signaled iff event is currently in signaled state. |
| 58 base::subtle::NoBarrier_CompareAndSwap(uaddr(), SIGNALED, NOT_SIGNALED); | 63 base::subtle::NoBarrier_CompareAndSwap(uaddr(), SIGNALED, NOT_SIGNALED); |
| 59 } | 64 } |
| 60 | 65 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 116 |
| 112 SharedEventHandle SharedEvent::GetHandle() const { | 117 SharedEventHandle SharedEvent::GetHandle() const { |
| 113 return shared_memory_.handle(); | 118 return shared_memory_.handle(); |
| 114 } | 119 } |
| 115 | 120 |
| 116 void SharedEvent::Close() { | 121 void SharedEvent::Close() { |
| 117 shared_memory_.Close(); | 122 shared_memory_.Close(); |
| 118 } | 123 } |
| 119 | 124 |
| 120 } // namespace gfx | 125 } // namespace gfx |
| OLD | NEW |