1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE.chromium file.
5 #ifndef ATOM_COMMON_API_LOCKER_H_
6 #define ATOM_COMMON_API_LOCKER_H_
10 #include "base/macros.h"
11 #include "tizen/common/env_variables.h"
12 #include "v8/include/v8.h"
16 // Only lock when lockers are used in current thread.
19 explicit Locker(v8::Isolate* isolate);
22 // Returns whether current process is browser process, currently we detect it
23 // by checking whether current has used V8 Lock, but it might be a bad idea.
24 static inline bool IsBrowserProcess() { if (::tizen::is_single_process) return true; return v8::Locker::IsActive(); }
27 void* operator new(size_t size);
28 void operator delete(void*, size_t);
30 std::unique_ptr<v8::Locker> locker_;
32 DISALLOW_COPY_AND_ASSIGN(Locker);
37 #endif // ATOM_COMMON_API_LOCKER_H_