aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-01-21 13:13:31 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-21 13:13:31 -0800
commita64c48f4f929775f9c203aae809f440ac01d2c64 (patch)
tree1727c7454e008f8dfd54e4b3891e230c315bb07c /include/core
parente6ea244717feda4265b7062a0462267a0d9e1753 (diff)
Move sync code to include/, switch from using platform define to a proxy header in core/
This fixes two problems: 1) #include SK_SOME_DEFINE doesn't work well for all our clients. 2) Things in include/ are #including things in src/, which we don't like. TBR=reed@google.com BUG=skia: Review URL: https://codereview.chromium.org/862983002
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkAtomics.h13
-rw-r--r--include/core/SkBarriers.h15
-rw-r--r--include/core/SkMutex.h13
-rw-r--r--include/core/SkPostConfig.h28
-rw-r--r--include/core/SkThread.h25
-rw-r--r--include/core/SkThreadPriv.h8
6 files changed, 49 insertions, 53 deletions
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h
new file mode 100644
index 0000000000..ed19533163
--- /dev/null
+++ b/include/core/SkAtomics.h
@@ -0,0 +1,13 @@
+#ifndef SkAtomics_DEFINED
+#define SkAtomics_DEFINED
+
+// This file is not part of the public Skia API.
+#include "SkTypes.h"
+
+#if defined(_MSC_VER)
+ #include "../ports/SkAtomics_win.h"
+#else
+ #include "../ports/SkAtomics_sync.h"
+#endif
+
+#endif//SkAtomics_DEFINED
diff --git a/include/core/SkBarriers.h b/include/core/SkBarriers.h
new file mode 100644
index 0000000000..2067a829a3
--- /dev/null
+++ b/include/core/SkBarriers.h
@@ -0,0 +1,15 @@
+#ifndef SkBarriers_DEFINED
+#define SkBarriers_DEFINED
+
+// This file is not part of the public Skia API.
+#include "SkTypes.h"
+
+#if SK_HAS_COMPILER_FEATURE(thread_sanitizer)
+ #include "../ports/SkBarriers_tsan.h"
+#elif defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
+ #include "../ports/SkBarriers_arm.h"
+#else
+ #include "../ports/SkBarriers_x86.h"
+#endif
+
+#endif//SkBarriers_DEFINED
diff --git a/include/core/SkMutex.h b/include/core/SkMutex.h
new file mode 100644
index 0000000000..7dbe957d8b
--- /dev/null
+++ b/include/core/SkMutex.h
@@ -0,0 +1,13 @@
+#ifndef SkMutex_DEFINED
+#define SkMutex_DEFINED
+
+// This file is not part of the public Skia API.
+#include "SkTypes.h"
+
+#if defined(SK_BUILD_FOR_WIN)
+ #include "../ports/SkMutex_win.h"
+#else
+ #include "../ports/SkMutex_pthread.h"
+#endif
+
+#endif//SkMutex_DEFINED
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index 2d6ab44b65..de63c671bd 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -385,34 +385,6 @@
//////////////////////////////////////////////////////////////////////
-#ifndef SK_ATOMICS_PLATFORM_H
-# if defined(_MSC_VER)
-# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_win.h"
-# else
-# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_sync.h"
-# endif
-#endif
-
-#ifndef SK_MUTEX_PLATFORM_H
-# if defined(SK_BUILD_FOR_WIN)
-# define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_win.h"
-# else
-# define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"
-# endif
-#endif
-
-#ifndef SK_BARRIERS_PLATFORM_H
-# if SK_HAS_COMPILER_FEATURE(thread_sanitizer)
-# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_tsan.h"
-# elif defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
-# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_arm.h"
-# else
-# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_x86.h"
-# endif
-#endif
-
-//////////////////////////////////////////////////////////////////////
-
#ifndef SK_EGL
# if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
# define SK_EGL 1
diff --git a/include/core/SkThread.h b/include/core/SkThread.h
index fffe787e71..8d7fb3912c 100644
--- a/include/core/SkThread.h
+++ b/include/core/SkThread.h
@@ -10,7 +10,7 @@
#include "SkTypes.h"
-// SK_ATOMICS_PLATFORM_H must provide inline implementations for the following declarations.
+// SkAtomics.h must provide inline implementations for the following declarations.
/** Atomically adds one to the int referenced by addr and returns the previous value.
* No additional memory barrier is required; this must act as a compiler barrier.
@@ -44,11 +44,7 @@ static void sk_membar_acquire__after_atomic_dec();
*/
static void sk_membar_acquire__after_atomic_conditional_inc();
-#ifdef GOOGLE3
- #include "SkAtomics_sync.h"
-#else
- #include SK_ATOMICS_PLATFORM_H
-#endif
+#include "SkAtomics.h"
/** Atomically adds one to the int referenced by addr iff the referenced int was not 0
* and returns the previous value.
@@ -65,7 +61,7 @@ template<typename INT_TYPE> static inline INT_TYPE sk_atomic_conditional_inc(INT
return prev;
}
-// SK_BARRIERS_PLATFORM_H must provide implementations for the following declarations:
+// SkBarriers.h must provide implementations for the following declarations:
/** Prevent the compiler from reordering across this barrier. */
static void sk_compiler_barrier();
@@ -82,13 +78,9 @@ template <typename T> T sk_acquire_load(T*);
*/
template <typename T> void sk_release_store(T*, T);
-#ifdef GOOGLE3
- #include "SkBarriers_x86.h"
-#else
- #include SK_BARRIERS_PLATFORM_H
-#endif
+#include "SkBarriers.h"
-/** SK_MUTEX_PLATFORM_H must provide the following (or equivalent) declarations.
+/** SkMutex.h must provide the following (or equivalent) declarations.
class SkBaseMutex {
public:
@@ -106,12 +98,7 @@ public:
#define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name = ...
*/
-#ifdef GOOGLE3
- #include "SkMutex_pthread.h"
-#else
- #include SK_MUTEX_PLATFORM_H
-#endif
-
+#include "SkMutex.h"
class SkAutoMutexAcquire : SkNoncopyable {
public:
diff --git a/include/core/SkThreadPriv.h b/include/core/SkThreadPriv.h
index ab40731dc0..09d5a669f1 100644
--- a/include/core/SkThreadPriv.h
+++ b/include/core/SkThreadPriv.h
@@ -10,7 +10,7 @@
#include "SkTypes.h"
-// SK_ATOMICS_PLATFORM_H must provide inline implementations for the following declarations.
+// SkAtomics.h must provide inline implementations for the following declarations.
/** Atomic compare and set, for pointers.
* If *addr == before, set *addr to after. Always returns previous value of *addr.
@@ -18,10 +18,6 @@
*/
static void* sk_atomic_cas(void** addr, void* before, void* after);
-#ifdef GOOGLE3
- #include "SkAtomics_sync.h"
-#else
- #include SK_ATOMICS_PLATFORM_H
-#endif
+#include "SkAtomics.h"
#endif//SkThreadPriv_DEFINED