Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 4, 2022
1 parent d72083b commit 869878e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion shell/browser/electron_browser_main_parts.cc
Expand Up @@ -256,7 +256,7 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
// The ProxyResolverV8 has setup a complete V8 environment, in order to
// avoid conflicts we only initialize our V8 environment after that.
js_env_ = std::make_unique<JavascriptEnvironment>(
node_bindings_->uv_loop(), NodeEnvironmentType::kNormal);
node_bindings_->uv_loop(), NodeEnvironmentType::kNormal);

v8::HandleScope scope(js_env_->isolate());

Expand Down
28 changes: 13 additions & 15 deletions shell/browser/javascript_environment.cc
Expand Up @@ -74,25 +74,23 @@ struct base::trace_event::TraceValue::Helper<
namespace electron {

namespace {
auto CreateIsolateHolder(v8::Isolate* isolate, NodeEnvironmentType type) {
std::unique_ptr<v8::Isolate::CreateParams> create_params =
gin::IsolateHolder::getDefaultIsolateParams();
auto CreateIsolateHolder(v8::Isolate* isolate, NodeEnvironmentType type) {
std::unique_ptr<v8::Isolate::CreateParams> create_params =
gin::IsolateHolder::getDefaultIsolateParams();

if (type == NodeEnvironmentType::kNodeMode) {
create_params->only_terminate_in_safe_scope = false;
}

return std::make_unique<gin::IsolateHolder>(
base::ThreadTaskRunnerHandle::Get(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility,
std::move(create_params),
gin::IsolateHolder::IsolateCreationMode::kNormal,
isolate);
if (type == NodeEnvironmentType::kNodeMode) {
create_params->only_terminate_in_safe_scope = false;
}

return std::make_unique<gin::IsolateHolder>(
base::ThreadTaskRunnerHandle::Get(), gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility, std::move(create_params),
gin::IsolateHolder::IsolateCreationMode::kNormal, isolate);
}
} // namespace

JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop, NodeEnvironmentType type)
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop,
NodeEnvironmentType type)
: isolate_(Initialize(event_loop)),
isolate_holder_(CreateIsolateHolder(isolate_, type)),
locker_(isolate_) {
Expand Down
3 changes: 2 additions & 1 deletion shell/browser/javascript_environment.h
Expand Up @@ -24,7 +24,8 @@ class MicrotasksRunner;
// Manage the V8 isolate and context automatically.
class JavascriptEnvironment {
public:
explicit JavascriptEnvironment(uv_loop_t* event_loop, NodeEnvironmentType type);
explicit JavascriptEnvironment(uv_loop_t* event_loop,
NodeEnvironmentType type);
~JavascriptEnvironment();

// disable copy
Expand Down

0 comments on commit 869878e

Please sign in to comment.