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

Side by Side Diff: Source/wtf/Atomics.h

Issue 14482004: Remove OS(QNX) support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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 | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/wtf/DateMath.cpp » ('j') | 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 (C) 2007, 2008, 2010, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 #ifndef Atomics_h 59 #ifndef Atomics_h
60 #define Atomics_h 60 #define Atomics_h
61 61
62 #include <wtf/Platform.h> 62 #include <wtf/Platform.h>
63 #include <wtf/StdLibExtras.h> 63 #include <wtf/StdLibExtras.h>
64 #include <wtf/UnusedParam.h> 64 #include <wtf/UnusedParam.h>
65 65
66 #if OS(WINDOWS) 66 #if OS(WINDOWS)
67 #include <windows.h> 67 #include <windows.h>
68 #elif OS(QNX)
69 #include <atomic.h>
70 #elif OS(ANDROID) 68 #elif OS(ANDROID)
71 #include <sys/atomics.h> 69 #include <sys/atomics.h>
72 #endif 70 #endif
73 71
74 namespace WTF { 72 namespace WTF {
75 73
76 #if OS(WINDOWS) 74 #if OS(WINDOWS)
77 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1 75 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
78 76
79 #if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER) 77 #if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER)
80 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpre t_cast<long*>(addend)); } 78 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpre t_cast<long*>(addend)); }
81 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpre t_cast<long*>(addend)); } 79 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpre t_cast<long*>(addend)); }
82 80
83 inline int64_t atomicIncrement(int64_t* addend) { return InterlockedIncrement64( reinterpret_cast<long long*>(addend)); } 81 inline int64_t atomicIncrement(int64_t* addend) { return InterlockedIncrement64( reinterpret_cast<long long*>(addend)); }
84 inline int64_t atomicDecrement(int64_t* addend) { return InterlockedDecrement64( reinterpret_cast<long long*>(addend)); } 82 inline int64_t atomicDecrement(int64_t* addend) { return InterlockedDecrement64( reinterpret_cast<long long*>(addend)); }
85 #else 83 #else
86 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r einterpret_cast<long volatile*>(addend)); } 84 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r einterpret_cast<long volatile*>(addend)); }
87 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r einterpret_cast<long volatile*>(addend)); } 85 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r einterpret_cast<long volatile*>(addend)); }
88 86
89 inline int64_t atomicIncrement(int64_t volatile* addend) { return InterlockedInc rement64(reinterpret_cast<long long volatile*>(addend)); } 87 inline int64_t atomicIncrement(int64_t volatile* addend) { return InterlockedInc rement64(reinterpret_cast<long long volatile*>(addend)); }
90 inline int64_t atomicDecrement(int64_t volatile* addend) { return InterlockedDec rement64(reinterpret_cast<long long volatile*>(addend)); } 88 inline int64_t atomicDecrement(int64_t volatile* addend) { return InterlockedDec rement64(reinterpret_cast<long long volatile*>(addend)); }
91 #endif 89 #endif
92 90
93 #elif OS(QNX)
94 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
95
96 // Note, atomic_{add, sub}_value() return the previous value of addend's content .
97 inline int atomicIncrement(int volatile* addend) { return static_cast<int>(atomi c_add_value(reinterpret_cast<unsigned volatile*>(addend), 1)) + 1; }
98 inline int atomicDecrement(int volatile* addend) { return static_cast<int>(atomi c_sub_value(reinterpret_cast<unsigned volatile*>(addend), 1)) - 1; }
99
100 #elif OS(ANDROID) 91 #elif OS(ANDROID)
101 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1 92 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
102 93
103 // Note, __atomic_{inc, dec}() return the previous value of addend's content. 94 // Note, __atomic_{inc, dec}() return the previous value of addend's content.
104 inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend) + 1; } 95 inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend) + 1; }
105 inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend) - 1; } 96 inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend) - 1; }
106 97
107 #elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on s parc64 gcc 98 #elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on s parc64 gcc
108 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1 99 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
109 100
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 #endif 211 #endif
221 212
222 } // namespace WTF 213 } // namespace WTF
223 214
224 #if USE(LOCKFREE_THREADSAFEREFCOUNTED) 215 #if USE(LOCKFREE_THREADSAFEREFCOUNTED)
225 using WTF::atomicDecrement; 216 using WTF::atomicDecrement;
226 using WTF::atomicIncrement; 217 using WTF::atomicIncrement;
227 #endif 218 #endif
228 219
229 #endif // Atomics_h 220 #endif // Atomics_h
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/wtf/DateMath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698