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

Unified Diff: Source/wtf/Atomics.h

Issue 439923006: Prioritizing input and compositor tasks in the blink scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/wtf/Atomics.h
diff --git a/Source/wtf/Atomics.h b/Source/wtf/Atomics.h
index 82113f4abaa3ef8c16e71f8a4bfaefda56f44436..1c86065b4c9cf9e901835c7f8ed8bae7753ef6f1 100644
--- a/Source/wtf/Atomics.h
+++ b/Source/wtf/Atomics.h
@@ -78,6 +78,16 @@ ALWAYS_INLINE void atomicSetOneToZero(int volatile* ptr)
InterlockedExchange(reinterpret_cast<long volatile*>(ptr), 0);
}
+ALWAYS_INLINE void* atomicTestAndSwap(void* volatile* ptr, void* comprand, void* replacement)
+{
+ return InterlockedCompareExchangePointer(ptr, replacement, comprand);
+}
+
+ALWAYS_INLINE void* atomicExchange(void* volatile* ptr, void* value)
+{
+ return InterlockedExchangePointer(ptr, value);
+}
+
#else
// atomicAdd returns the result of the addition.
@@ -103,6 +113,17 @@ ALWAYS_INLINE void atomicSetOneToZero(int volatile* ptr)
ASSERT(*ptr == 1);
__sync_lock_release(ptr);
}
+
+ALWAYS_INLINE void* atomicTestAndSwap(void *volatile* ptr, void* comprand, void* replacement)
+{
+ return __sync_val_compare_and_swap(ptr, comprand, replacement);
+}
+
+ALWAYS_INLINE void* atomicExchange(void *volatile* ptr, void* value)
+{
+ return __sync_lock_test_and_set(ptr, value);
+}
+
#endif
#if defined(THREAD_SANITIZER)
@@ -163,10 +184,12 @@ ALWAYS_INLINE int acquireLoad(volatile const int* ptr)
} // namespace WTF
using WTF::atomicAdd;
-using WTF::atomicSubtract;
using WTF::atomicDecrement;
+using WTF::atomicExchange;
using WTF::atomicIncrement;
using WTF::atomicTestAndSetToOne;
+using WTF::atomicTestAndSwap;
+using WTF::atomicSubtract;
using WTF::atomicSetOneToZero;
using WTF::acquireLoad;
using WTF::releaseStore;
« Source/platform/scheduler/Scheduler.cpp ('K') | « Source/platform/scheduler/Scheduler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698