aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--gyp/ports.gyp6
-rw-r--r--gyp/tools.gyp7
-rw-r--r--include/config/SkUserConfig.h10
-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
-rw-r--r--include/ports/SkAtomics_sync.h (renamed from src/ports/SkAtomics_sync.h)0
-rw-r--r--include/ports/SkAtomics_win.h (renamed from src/ports/SkAtomics_win.h)0
-rw-r--r--include/ports/SkBarriers_arm.h (renamed from src/ports/SkBarriers_arm.h)0
-rw-r--r--include/ports/SkBarriers_tsan.h (renamed from src/ports/SkBarriers_tsan.h)0
-rw-r--r--include/ports/SkBarriers_x86.h (renamed from src/ports/SkBarriers_x86.h)0
-rw-r--r--include/ports/SkMutex_pthread.h (renamed from src/ports/SkMutex_pthread.h)0
-rw-r--r--include/ports/SkMutex_win.h (renamed from src/ports/SkMutex_win.h)0
16 files changed, 56 insertions, 69 deletions
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index 6d2a96882b..6fe52632cd 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -22,10 +22,6 @@
'../src/utils',
],
'sources': [
- '../src/ports/SkAtomics_sync.h',
- '../src/ports/SkAtomics_win.h',
- '../src/ports/SkMutex_pthread.h',
- '../src/ports/SkMutex_win.h',
'../src/ports/SkDebug_nacl.cpp',
'../src/ports/SkDebug_stdio.cpp',
'../src/ports/SkDebug_win.cpp',
@@ -44,8 +40,6 @@
'../src/ports/SkGlobalInitialization_default.cpp',
'../src/ports/SkMemory_malloc.cpp',
- '../src/ports/SkMutex_pthread.h',
- '../src/ports/SkMutex_win.h',
'../src/ports/SkOSFile_posix.cpp',
'../src/ports/SkOSFile_stdio.cpp',
'../src/ports/SkOSFile_win.cpp',
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 7c3cc2a217..1b196a75b1 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -607,6 +607,13 @@
],
'paths_to_ignore': [
'<(skia_include_path)/gpu/gl/GrGLConfig_chrome.h',
+ '<(skia_include_path)/ports/SkAtomics_sync.h',
+ '<(skia_include_path)/ports/SkAtomics_win.h',
+ '<(skia_include_path)/ports/SkBarriers_arm.h',
+ '<(skia_include_path)/ports/SkBarriers_tsan.h',
+ '<(skia_include_path)/ports/SkBarriers_x86.h',
+ '<(skia_include_path)/ports/SkMutex_pthread.h',
+ '<(skia_include_path)/ports/SkMutex_win.h',
'<(skia_include_path)/ports/SkTypeface_mac.h',
'<(skia_include_path)/ports/SkTypeface_win.h',
'<(skia_include_path)/utils/ios',
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index 5f59b9131c..92e2b90762 100644
--- a/include/config/SkUserConfig.h
+++ b/include/config/SkUserConfig.h
@@ -168,14 +168,4 @@
*/
//#define SK_PDF_USE_PATHOPS
-/* Skia uses these defines as the target of include preprocessor directives.
- * The header files pointed to by these defines provide declarations and
- * possibly inline implementations of threading primitives.
- *
- * See SkThread.h for documentation on what these includes must contain.
- */
-//#define SK_ATOMICS_PLATFORM_H "SkAtomics_xxx.h"
-//#define SK_MUTEX_PLATFORM_H "SkMutex_xxx.h"
-//#define SK_BARRIERS_PLATFORM_H "SkBarriers_xxx.h"
-
#endif
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
diff --git a/src/ports/SkAtomics_sync.h b/include/ports/SkAtomics_sync.h
index 9389c00103..9389c00103 100644
--- a/src/ports/SkAtomics_sync.h
+++ b/include/ports/SkAtomics_sync.h
diff --git a/src/ports/SkAtomics_win.h b/include/ports/SkAtomics_win.h
index a1876d269b..a1876d269b 100644
--- a/src/ports/SkAtomics_win.h
+++ b/include/ports/SkAtomics_win.h
diff --git a/src/ports/SkBarriers_arm.h b/include/ports/SkBarriers_arm.h
index 386294e9b1..386294e9b1 100644
--- a/src/ports/SkBarriers_arm.h
+++ b/include/ports/SkBarriers_arm.h
diff --git a/src/ports/SkBarriers_tsan.h b/include/ports/SkBarriers_tsan.h
index d72dbfd390..d72dbfd390 100644
--- a/src/ports/SkBarriers_tsan.h
+++ b/include/ports/SkBarriers_tsan.h
diff --git a/src/ports/SkBarriers_x86.h b/include/ports/SkBarriers_x86.h
index 56e2658e97..56e2658e97 100644
--- a/src/ports/SkBarriers_x86.h
+++ b/include/ports/SkBarriers_x86.h
diff --git a/src/ports/SkMutex_pthread.h b/include/ports/SkMutex_pthread.h
index 7452ece610..7452ece610 100644
--- a/src/ports/SkMutex_pthread.h
+++ b/include/ports/SkMutex_pthread.h
diff --git a/src/ports/SkMutex_win.h b/include/ports/SkMutex_win.h
index fe06336a90..fe06336a90 100644
--- a/src/ports/SkMutex_win.h
+++ b/include/ports/SkMutex_win.h