Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/core/SkSharedMutex.h

Issue 2135453002: Promote the GCC/libc++/<memory> 'typedef float float32_t' workaround to SkTypes.h (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SkSharedLock_DEFINED 8 #ifndef SkSharedLock_DEFINED
9 #define SkSharedLock_DEFINED 9 #define SkSharedLock_DEFINED
10 10
11 #include "SkAtomics.h" 11 #include "SkAtomics.h"
12 #include "SkSemaphore.h" 12 #include "SkSemaphore.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 14
15 #ifdef SK_DEBUG 15 #ifdef SK_DEBUG
16 #include "SkMutex.h" 16 #include "SkMutex.h"
17
18 // On GCC 4.8, targeting ARMv7 with NEON, using libc++, we need to typedef f loat float32_t,
19 // (or include <arm_neon.h> which does that) before #including <memory> here .
20 // This makes no sense. I'm not very interested in understanding why... thi s is an old,
21 // bizarre platform configuration that we should just let die.
22 #include <ciso646> // Include something innocuous to define _LIBCPP_VERISON if it's libc++.
23 #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8 \
24 && defined(SK_CPU_ARM32) && defined(SK_ARM_HAS_NEON) \
25 && defined(_LIBCPP_VERSION)
26 typedef float float32_t;
27 #endif
28
29 #include <memory> 17 #include <memory>
30 #endif // SK_DEBUG 18 #endif // SK_DEBUG
31 19
32 // There are two shared lock implementations one debug the other is high perform ance. They implement 20 // There are two shared lock implementations one debug the other is high perform ance. They implement
33 // an interface similar to pthread's rwlocks. 21 // an interface similar to pthread's rwlocks.
34 // This is a shared lock implementation similar to pthreads rwlocks. The high pe rformance 22 // This is a shared lock implementation similar to pthreads rwlocks. The high pe rformance
35 // implementation is cribbed from Preshing's article: 23 // implementation is cribbed from Preshing's article:
36 // http://preshing.com/20150316/semaphores-are-surprisingly-versatile/ 24 // http://preshing.com/20150316/semaphores-are-surprisingly-versatile/
37 // 25 //
38 // This lock does not obey strict queue ordering. It will always alternate betwe en readers and 26 // This lock does not obey strict queue ordering. It will always alternate betwe en readers and
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 public: 73 public:
86 SkAutoSharedMutexShared(SkSharedMutex& lock) : fLock(lock) { lock.acquireSha red(); } 74 SkAutoSharedMutexShared(SkSharedMutex& lock) : fLock(lock) { lock.acquireSha red(); }
87 ~SkAutoSharedMutexShared() { fLock.releaseShared(); } 75 ~SkAutoSharedMutexShared() { fLock.releaseShared(); }
88 private: 76 private:
89 SkSharedMutex& fLock; 77 SkSharedMutex& fLock;
90 }; 78 };
91 79
92 #define SkAutoSharedMutexShared(...) SK_REQUIRE_LOCAL_VAR(SkAutoSharedMutexShare d) 80 #define SkAutoSharedMutexShared(...) SK_REQUIRE_LOCAL_VAR(SkAutoSharedMutexShare d)
93 81
94 #endif // SkSharedLock_DEFINED 82 #endif // SkSharedLock_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698