Commit 3195ab9b authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] replaced inspector/Atomics.h with base atomicops.h

BUG=chromium:635948
R=dgozman@chromium.org,alph@chromium.org

Review-Url: https://codereview.chromium.org/2340763003
Cr-Commit-Position: refs/heads/master@{#39453}
parent 94492437
// 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_
......@@ -135,7 +135,6 @@ v8_source_set("inspector") {
sources += get_target_outputs(":inspector_debugger_script")
sources += [
"Allocator.h",
"Atomics.h",
"InjectedScript.cpp",
"InjectedScript.h",
"InjectedScriptNative.cpp",
......
include_rules = [
"-src",
"+src/inspector",
"+src/base/atomicops.h",
"+src/base/macros.h",
"+src/base/logging.h",
"+src/base/platform/platform.h"
"+src/base/platform/platform.h",
]
......@@ -4,7 +4,7 @@
#include "src/inspector/V8ProfilerAgentImpl.h"
#include "src/inspector/Atomics.h"
#include "src/base/atomicops.h"
#include "src/inspector/StringUtil.h"
#include "src/inspector/V8Debugger.h"
#include "src/inspector/V8InspectorImpl.h"
......@@ -279,7 +279,8 @@ void V8ProfilerAgentImpl::stop(
}
String16 V8ProfilerAgentImpl::nextProfileId() {
return String16::fromInteger(atomicIncrement(&s_lastProfileId));
return String16::fromInteger(
v8::base::NoBarrier_AtomicIncrement(&s_lastProfileId, 1));
}
void V8ProfilerAgentImpl::startProfiling(const String16& title) {
......
......@@ -37,7 +37,6 @@
'../../include/v8-inspector.h',
'../../include/v8-inspector-protocol.h',
'inspector/Allocator.h',
'inspector/Atomics.h',
'inspector/InjectedScript.cpp',
'inspector/InjectedScript.h',
'inspector/InjectedScriptNative.cpp',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment