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

Unified Diff: src/ports/SkBarriers_arm.h

Issue 304593003: Add SkBarriers to ports. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix order Created 6 years, 7 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: src/ports/SkBarriers_arm.h
diff --git a/src/ports/SkBarriers_arm.h b/src/ports/SkBarriers_arm.h
new file mode 100644
index 0000000000000000000000000000000000000000..e093a5ed2e4ce33da13447c36e4a4437d9a4e441
--- /dev/null
+++ b/src/ports/SkBarriers_arm.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkBarriers_arm_DEFINED
+#define SkBarriers_arm_DEFINED
+
+static inline void sk_compiler_barrier() { asm volatile("" : : : "memory"); }
+
+template <typename T>
+T sk_acquire_load(T* ptr) {
+ T val = *ptr;
+ __sync_synchronize(); // Issue a full barrier.
+ return val;
+}
+
+template <typename T>
bungeman-skia 2014/05/29 18:02:52 We should doc that T needs to be atomically read-w
mtklein 2014/05/29 18:04:44 Done.
+void sk_release_store(T* ptr, T val) {
+ __sync_synchronize(); // Issue a full barrier.
+ *ptr = val;
+}
+
+#endif//SkBarriers_x86_DEFINED

Powered by Google App Engine
This is Rietveld 408576698