| 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 "third_party/skia/include/core/SkThread.h" | 5 #include "third_party/skia/include/core/SkThread.h" |
| 6 | 6 |
| 7 #include <new> | 7 #include <new> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 */ | 44 */ |
| 45 int32_t sk_atomic_conditional_inc(int32_t* addr) { | 45 int32_t sk_atomic_conditional_inc(int32_t* addr) { |
| 46 int32_t value = *addr; | 46 int32_t value = *addr; |
| 47 | 47 |
| 48 while (true) { | 48 while (true) { |
| 49 if (value == 0) { | 49 if (value == 0) { |
| 50 return 0; | 50 return 0; |
| 51 } | 51 } |
| 52 | 52 |
| 53 int32_t before; | 53 int32_t before; |
| 54 before = base::subtle::Aquire_CompareAndSwap(addr, value, value + 1); | 54 before = base::subtle::Acquire_CompareAndSwap(addr, value, value + 1); |
| 55 | 55 |
| 56 if (before == value) { | 56 if (before == value) { |
| 57 return value; | 57 return value; |
| 58 } else { | 58 } else { |
| 59 value = before; | 59 value = before; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 /** If sk_atomic_conditional_inc does not act as an aquire (L/SL) barrier, this | 63 /** If sk_atomic_conditional_inc does not act as an aquire (L/SL) barrier, this |
| 64 is expected to act as an aquire (L/SL) memory barrier and as a compiler | 64 is expected to act as an aquire (L/SL) memory barrier and as a compiler |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 void SkMutex::acquire() { | 80 void SkMutex::acquire() { |
| 81 base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); | 81 base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); |
| 82 lock->Acquire(); | 82 lock->Acquire(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SkMutex::release() { | 85 void SkMutex::release() { |
| 86 base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); | 86 base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); |
| 87 lock->Release(); | 87 lock->Release(); |
| 88 } | 88 } |
| OLD | NEW |