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

Unified Diff: src/inspector/Atomics.h

Issue 2292573002: [inspector] Initial import of v8_inspector. (Closed)
Patch Set: format the code, disable cpplint Created 4 years, 3 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
« no previous file with comments | « src/inspector/Allocator.h ('k') | src/inspector/DebuggerScript.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/Atomics.h
diff --git a/src/inspector/Atomics.h b/src/inspector/Atomics.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed7458fcf49128c756d065cefea929809e169f84
--- /dev/null
+++ b/src/inspector/Atomics.h
@@ -0,0 +1,35 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_INSPECTOR_ATOMICS_H_
+#define V8_INSPECTOR_ATOMICS_H_
+
+#include <stdint.h>
+
+#if defined(_MSC_VER)
+#include <windows.h>
+#endif
+
+namespace v8_inspector {
+
+#if defined(_MSC_VER)
+
+inline int atomicIncrement(int volatile* addend) {
+ return InterlockedIncrement(reinterpret_cast<long volatile*>(addend));
+}
+
+#else
+
+inline int atomicAdd(int volatile* addend, int increment) {
+ return __sync_add_and_fetch(addend, increment);
+}
+inline int atomicIncrement(int volatile* addend) {
+ return atomicAdd(addend, 1);
+}
+
+#endif
+
+} // namespace v8_inspector
+
+#endif // V8_INSPECTOR_ATOMICS_H_
« no previous file with comments | « src/inspector/Allocator.h ('k') | src/inspector/DebuggerScript.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698