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

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

Issue 13901012: Remove OS(WINCE) as blink and chromium does not support WinCe. (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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include <atomic.h> 69 #include <atomic.h>
70 #elif OS(ANDROID) 70 #elif OS(ANDROID)
71 #include <sys/atomics.h> 71 #include <sys/atomics.h>
72 #endif 72 #endif
73 73
74 namespace WTF { 74 namespace WTF {
75 75
76 #if OS(WINDOWS) 76 #if OS(WINDOWS)
77 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1 77 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
78 78
79 #if OS(WINCE) 79 #if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER)
80 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)); }
82 #elif COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER)
83 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpre t_cast<long*>(addend)); } 80 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpre t_cast<long*>(addend)); }
84 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpre t_cast<long*>(addend)); } 81 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpre t_cast<long*>(addend)); }
85 82
86 inline int64_t atomicIncrement(int64_t* addend) { return InterlockedIncrement64( reinterpret_cast<long long*>(addend)); } 83 inline int64_t atomicIncrement(int64_t* addend) { return InterlockedIncrement64( reinterpret_cast<long long*>(addend)); }
87 inline int64_t atomicDecrement(int64_t* addend) { return InterlockedDecrement64( reinterpret_cast<long long*>(addend)); } 84 inline int64_t atomicDecrement(int64_t* addend) { return InterlockedDecrement64( reinterpret_cast<long long*>(addend)); }
88 #else 85 #else
89 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r einterpret_cast<long volatile*>(addend)); } 86 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r einterpret_cast<long volatile*>(addend)); }
90 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r einterpret_cast<long volatile*>(addend)); } 87 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r einterpret_cast<long volatile*>(addend)); }
91 88
92 inline int64_t atomicIncrement(int64_t volatile* addend) { return InterlockedInc rement64(reinterpret_cast<long long volatile*>(addend)); } 89 inline int64_t atomicIncrement(int64_t volatile* addend) { return InterlockedInc rement64(reinterpret_cast<long long volatile*>(addend)); }
(...skipping 21 matching lines...) Expand all
114 inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(a ddend, 1); } 111 inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(a ddend, 1); }
115 112
116 inline int64_t atomicIncrement(int64_t volatile* addend) { return __sync_add_and _fetch(addend, 1); } 113 inline int64_t atomicIncrement(int64_t volatile* addend) { return __sync_add_and _fetch(addend, 1); }
117 inline int64_t atomicDecrement(int64_t volatile* addend) { return __sync_sub_and _fetch(addend, 1); } 114 inline int64_t atomicDecrement(int64_t volatile* addend) { return __sync_sub_and _fetch(addend, 1); }
118 115
119 #endif 116 #endif
120 117
121 #if OS(WINDOWS) 118 #if OS(WINDOWS)
122 inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, u nsigned newValue) 119 inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, u nsigned newValue)
123 { 120 {
124 #if OS(WINCE)
125 return InterlockedCompareExchange(reinterpret_cast<LONG*>(const_cast<unsigne d*>(location)), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == sta tic_cast<LONG>(expected);
126 #else
127 return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location) , static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG> (expected); 121 return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location) , static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG> (expected);
128 #endif
129 } 122 }
130 123
131 inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* ne wValue) 124 inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* ne wValue)
132 { 125 {
133 return InterlockedCompareExchangePointer(location, newValue, expected) == ex pected; 126 return InterlockedCompareExchangePointer(location, newValue, expected) == ex pected;
134 } 127 }
135 #else // OS(WINDOWS) --> not windows 128 #else // OS(WINDOWS) --> not windows
136 #if COMPILER(GCC) && !COMPILER(CLANG) // Work around a gcc bug 129 #if COMPILER(GCC) && !COMPILER(CLANG) // Work around a gcc bug
137 inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, u nsigned newValue) 130 inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, u nsigned newValue)
138 #else 131 #else
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #endif 220 #endif
228 221
229 } // namespace WTF 222 } // namespace WTF
230 223
231 #if USE(LOCKFREE_THREADSAFEREFCOUNTED) 224 #if USE(LOCKFREE_THREADSAFEREFCOUNTED)
232 using WTF::atomicDecrement; 225 using WTF::atomicDecrement;
233 using WTF::atomicIncrement; 226 using WTF::atomicIncrement;
234 #endif 227 #endif
235 228
236 #endif // Atomics_h 229 #endif // Atomics_h
OLDNEW
« no previous file with comments | « Source/wtf/Assertions.cpp ('k') | Source/wtf/DataLog.cpp » ('j') | Source/wtf/OSAllocator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698