Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "../private/SkSemaphore.h" | 8 #include "../private/SkSemaphore.h" |
| 9 #include "../private/SkLeanWindows.h" | |
|
bungeman-skia
2016/06/06 18:11:59
nit: up one line
hal.canary
2016/06/06 18:22:32
Done.
| |
| 9 | 10 |
| 10 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 11 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 11 #include <mach/mach.h> | 12 #include <mach/mach.h> |
| 12 struct SkBaseSemaphore::OSSemaphore { | 13 struct SkBaseSemaphore::OSSemaphore { |
| 13 semaphore_t fSemaphore; | 14 semaphore_t fSemaphore; |
| 14 | 15 |
| 15 OSSemaphore() { | 16 OSSemaphore() { |
| 16 semaphore_create(mach_task_self(), &fSemaphore, SYNC_POLICY_LIFO, 0/ *initial count*/); | 17 semaphore_create(mach_task_self(), &fSemaphore, SYNC_POLICY_LIFO, 0/ *initial count*/); |
| 17 } | 18 } |
| 18 ~OSSemaphore() { semaphore_destroy(mach_task_self(), fSemaphore); } | 19 ~OSSemaphore() { semaphore_destroy(mach_task_self(), fSemaphore); } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 64 } |
| 64 | 65 |
| 65 void SkBaseSemaphore::osWait() { | 66 void SkBaseSemaphore::osWait() { |
| 66 fOSSemaphoreOnce([this] { fOSSemaphore = new OSSemaphore; }); | 67 fOSSemaphoreOnce([this] { fOSSemaphore = new OSSemaphore; }); |
| 67 fOSSemaphore->wait(); | 68 fOSSemaphore->wait(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void SkBaseSemaphore::cleanup() { | 71 void SkBaseSemaphore::cleanup() { |
| 71 delete fOSSemaphore; | 72 delete fOSSemaphore; |
| 72 } | 73 } |
| OLD | NEW |