2015-08-07 11:34:00 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE.chromium file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_LOCKER_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_HELPER_LOCKER_H_
|
2015-08-07 11:34:00 +00:00
|
|
|
|
2016-05-23 01:59:39 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2015-08-07 11:34:00 +00:00
|
|
|
#include "v8/include/v8.h"
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
namespace gin_helper {
|
2015-08-07 11:34:00 +00:00
|
|
|
|
|
|
|
// Only lock when lockers are used in current thread.
|
|
|
|
class Locker {
|
|
|
|
public:
|
|
|
|
explicit Locker(v8::Isolate* isolate);
|
|
|
|
~Locker();
|
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
Locker(const Locker&) = delete;
|
|
|
|
Locker& operator=(const Locker&) = delete;
|
|
|
|
|
2015-08-07 11:34:00 +00:00
|
|
|
private:
|
2023-09-12 23:53:20 +00:00
|
|
|
const std::unique_ptr<v8::Locker> locker_;
|
2015-08-07 11:34:00 +00:00
|
|
|
};
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
} // namespace gin_helper
|
2015-08-07 11:34:00 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_LOCKER_H_
|