2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Copyright (c) 2017 GitHub, Inc.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Use of this source code is governed by the MIT license that can be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// found in the LICENSE file.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/renderer/web_worker_observer.h"
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <string_view>
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-31 12:29:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <utility>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "base/no_destructor.h"
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/strings/strcat.h"
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "base/threading/thread_local.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/api/electron_bindings.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_helper/event_emitter_caller.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/node_bindings.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/node_includes.h"
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace electron {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-31 12:29:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static base::NoDestructor<base::ThreadLocalOwnedPointer<WebWorkerObserver>>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    lazy_tls;
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}  // namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// static
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WebWorkerObserver* WebWorkerObserver::GetCurrent() {
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-31 12:29:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return lazy_tls->Get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// static
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WebWorkerObserver* WebWorkerObserver::Create() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto obs = std::make_unique<WebWorkerObserver>();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto* obs_raw = obs.get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  lazy_tls->Set(std::move(obs));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return obs_raw;
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WebWorkerObserver::WebWorkerObserver()
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    : node_bindings_(
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-27 18:51:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          NodeBindings::Create(NodeBindings::BrowserEnvironment::kWorker)),
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-07 19:00:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      electron_bindings_(
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-31 12:29:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          std::make_unique<ElectronBindings>(node_bindings_->uv_loop())) {}
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-18 10:41:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								WebWorkerObserver::~WebWorkerObserver() = default;
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-27 18:48:37 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void WebWorkerObserver::WorkerScriptReadyForEvaluation(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    v8::Local<v8::Context> worker_context) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-15 18:58:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::Context::Scope context_scope(worker_context);
							 | 
						
					
						
							
								
									
										
										
										
											2021-05-13 18:21:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto* isolate = worker_context->GetIsolate();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  v8::MicrotasksScope microtasks_scope(
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-07 02:44:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      worker_context, v8::MicrotasksScope::kDoNotRunMicrotasks);
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:59:48 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-10 15:22:25 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Start the embed thread.
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-30 12:09:42 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  node_bindings_->PrepareEmbedThread();
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 15:04:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Setup node tracing controller.
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-09 21:36:42 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!node::tracing::TraceEventHelper::GetAgent()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto* tracing_agent = new node::tracing::Agent();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    node::tracing::TraceEventHelper::SetAgent(tracing_agent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 15:04:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Setup node environment for each window.
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-10 22:31:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::Maybe<bool> initialized = node::InitializeContext(worker_context);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CHECK(!initialized.IsNothing() && initialized.FromJust());
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 08:56:16 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::shared_ptr<node::Environment> env =
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-25 16:46:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      node_bindings_->CreateEnvironment(worker_context, nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // We need to use the Blink implementation of fetch in web workers
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Node.js deletes the global fetch function when their fetch implementation
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // is disabled, so we need to save and re-add it after the Node.js environment
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // is loaded. See corresponding change in node/init.ts.
							 | 
						
					
						
							
								
									
										
										
										
											2024-04-17 12:39:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::Local<v8::Object> global = worker_context->Global();
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  for (const std::string_view key :
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       {"fetch", "Response", "FormData", "Request", "Headers", "EventSource"}) {
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    v8::MaybeLocal<v8::Value> value =
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        global->Get(worker_context, gin::StringToV8(isolate, key));
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (!value.IsEmpty()) {
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      std::string blink_key = base::StrCat({"blink", key});
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      global
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-31 08:25:33 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          ->Set(worker_context, gin::StringToV8(isolate, blink_key),
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-20 17:01:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                value.ToLocalChecked())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          .Check();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2024-04-17 12:39:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-14 09:58:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // We do not want to crash Web Workers on unhandled rejections.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  env->options()->unhandled_rejections = "warn-with-error-code";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Add Electron extended APIs.
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 12:37:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  electron_bindings_->BindTo(env->isolate(), env->process_object());
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Load everything.
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 08:56:16 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  node_bindings_->LoadEnvironment(env.get());
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Make uv loop being wrapped by window context.
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 08:56:16 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  node_bindings_->set_uv_env(env.get());
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Give the node loop a run to make sure everything is ready.
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-30 12:09:42 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  node_bindings_->StartPolling();
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 08:56:16 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Keep the environment alive until we free it in ContextWillDestroy()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  environments_.insert(std::move(env));
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void WebWorkerObserver::ContextWillDestroy(v8::Local<v8::Context> context) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  node::Environment* env = node::Environment::GetCurrent(context);
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-28 13:40:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (env) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    v8::Context::Scope context_scope(env->context());
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin_helper::EmitEvent(env->isolate(), env->process_object(), "exit");
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-28 13:40:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-18 10:41:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Destroying the node environment will also run the uv loop,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Node.js expects `kExplicit` microtasks policy and will run microtasks
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // checkpoints after every call into JavaScript. Since we use a different
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // policy in the renderer - switch to `kExplicit`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  v8::MicrotaskQueue* microtask_queue = context->GetMicrotaskQueue();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto old_policy = microtask_queue->microtasks_policy();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  DCHECK_EQ(microtask_queue->GetMicrotasksScopeDepth(), 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  microtask_queue->set_microtasks_policy(v8::MicrotasksPolicy::kExplicit);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-05 05:18:31 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  base::EraseIf(environments_,
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 08:56:16 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                [env](auto const& item) { return item.get() == env; });
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-18 10:41:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  microtask_queue->set_microtasks_policy(old_policy);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // ElectronBindings is tracking node environments.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  electron_bindings_->EnvironmentDestroyed(env);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-31 12:29:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (lazy_tls->Get())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    lazy_tls->Set(nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-07 19:35:03 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}  // namespace electron
							 |