aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkWeakRefCnt.h
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 15:27:39 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 15:27:39 +0000
commitd9947f605a335363b0a0541d6d8cb7a7113ed788 (patch)
treeadfece12609a5ca87c8e2ea387c0dba31699f2b6 /include/core/SkWeakRefCnt.h
parente2380570de11226a93362d017e93c4790641c027 (diff)
Split atomic and mutex implementations and make inlinable.
Skia cannot use Chromium's implementation of mutex (Lock) due to static initializers. However, we would like to be able to use Chromium's implementation of atomics. This motivates the split of implementation. Skia's atomic and mutex calls should be inlinable, especially the atomics. These calls often compile down to very few instructions, and we currently have the overhead of a function call. This motivates the header implementation. There is still a desire for the build system to select the implementation, so the SK_XXX_PLATFORM_H pattern for header files is introduced. This allows the build system to control which platform specific header files are chosen. The Chromium side changes (most of which will need to go in before this change can be found at https://codereview.chromium.org/19477005/ . The Chromium side changes after this lands can be seen at https://codereview.chromium.org/98073013 . Review URL: https://codereview.chromium.org/19808007 git-svn-id: http://skia.googlecode.com/svn/trunk@12738 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkWeakRefCnt.h')
-rw-r--r--include/core/SkWeakRefCnt.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/core/SkWeakRefCnt.h b/include/core/SkWeakRefCnt.h
index e2a7308443..210dcc9f1c 100644
--- a/include/core/SkWeakRefCnt.h
+++ b/include/core/SkWeakRefCnt.h
@@ -89,9 +89,9 @@ public:
*/
bool SK_WARN_UNUSED_RESULT try_ref() const {
if (sk_atomic_conditional_inc(&fRefCnt) != 0) {
- // Aquire barrier (L/SL), if not provided above.
+ // Acquire barrier (L/SL), if not provided above.
// Prevents subsequent code from happening before the increment.
- sk_membar_aquire__after_atomic_conditional_inc();
+ sk_membar_acquire__after_atomic_conditional_inc();
return true;
}
return false;
@@ -115,9 +115,9 @@ public:
SkASSERT(fWeakCnt > 0);
// Release barrier (SL/S), if not provided below.
if (sk_atomic_dec(&fWeakCnt) == 1) {
- // Aquire barrier (L/SL), if not provided above.
+ // Acquire barrier (L/SL), if not provided above.
// Prevents code in destructor from happening before the decrement.
- sk_membar_aquire__after_atomic_dec();
+ sk_membar_acquire__after_atomic_dec();
#ifdef SK_DEBUG
// so our destructor won't complain
fWeakCnt = 1;