diff --git a/shell/browser/javascript_environment.h b/shell/browser/javascript_environment.h index 937b0f976415..adb7be448cee 100644 --- a/shell/browser/javascript_environment.h +++ b/shell/browser/javascript_environment.h @@ -49,7 +49,7 @@ class JavascriptEnvironment { const raw_ptr isolate_; // depends-on: isolate_ - v8::Locker locker_; + const v8::Locker locker_; std::unique_ptr microtasks_runner_; }; diff --git a/shell/common/gin_helper/event_emitter_caller.cc b/shell/common/gin_helper/event_emitter_caller.cc index 41b0c7b35575..468f0d854f01 100644 --- a/shell/common/gin_helper/event_emitter_caller.cc +++ b/shell/common/gin_helper/event_emitter_caller.cc @@ -4,7 +4,6 @@ #include "shell/common/gin_helper/event_emitter_caller.h" -#include "shell/common/gin_helper/locker.h" #include "shell/common/gin_helper/microtasks_scope.h" #include "shell/common/node_includes.h" diff --git a/shell/common/gin_helper/locker.cc b/shell/common/gin_helper/locker.cc index 84740204ebb2..27b9f0306b21 100644 --- a/shell/common/gin_helper/locker.cc +++ b/shell/common/gin_helper/locker.cc @@ -8,10 +8,9 @@ namespace gin_helper { -Locker::Locker(v8::Isolate* isolate) { - if (electron::IsBrowserProcess()) - locker_ = std::make_unique(isolate); -} +Locker::Locker(v8::Isolate* isolate) + : locker_{electron::IsBrowserProcess() ? new v8::Locker{isolate} + : nullptr} {} Locker::~Locker() = default; diff --git a/shell/common/gin_helper/locker.h b/shell/common/gin_helper/locker.h index 9ce78d701e42..dc142aded3bc 100644 --- a/shell/common/gin_helper/locker.h +++ b/shell/common/gin_helper/locker.h @@ -22,13 +22,7 @@ class Locker { Locker& operator=(const Locker&) = delete; private: - void* operator new(size_t size); - void operator delete(void*, size_t); - - std::unique_ptr locker_; - - static bool g_is_browser_process; - static bool g_is_renderer_process; + const std::unique_ptr locker_; }; } // namespace gin_helper diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index 9a6092364eb6..8c6c1fb3c689 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -31,7 +31,6 @@ #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/event.h" #include "shell/common/gin_helper/event_emitter_caller.h" -#include "shell/common/gin_helper/locker.h" #include "shell/common/gin_helper/microtasks_scope.h" #include "shell/common/mac/main_application_bundle.h" #include "shell/common/world_ids.h"