a47b724c99
* chore: bump chromium in DEPS to 124.0.6355.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * 5341411: view-transition: Ensure resources are cleaned up in all cases. https://chromium-review.googlesource.com/c/chromium/src/+/5341411 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: fixup patch indices Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5354013: Return nullopt on error from ProcessMetrics CPU measurements https://chromium-review.googlesource.com/c/chromium/src/+/5354013 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: bump chromium in DEPS to 124.0.6357.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 5368769: Reland "[mojo] Use large worker for mojom_parser action" https://chromium-review.googlesource.com/c/chromium/src/+/5368769 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 5336171: [Extensions] Introduce a CoreExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5336171 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 5367334: [FS Shortcut] Refactor ExclusiveAccessManager https://chromium-review.googlesource.com/c/chromium/src/+/5367334 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 5354161: Rename GeolocationManager to GeolocationSystemPermissionManager https://chromium-review.googlesource.com/c/chromium/src/+/5354161 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: [Extensions] Introduce a CoreExtensionsRendererAPIProvider Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: bump chromium in DEPS to 124.0.6359.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * 5371370: [Extensions] Move core NativeHandler registration https://chromium-review.googlesource.com/c/chromium/src/+/5371370 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 5370702: [Extensions] Introduce ShellExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5370702 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
85 lines
4.4 KiB
Diff
85 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Thu, 20 Sep 2018 17:47:12 -0700
|
|
Subject: worker_context_will_destroy.patch
|
|
|
|
This adds a hook for worker context destruction, which we use in Electron to
|
|
shutdown node integration in the worker if relevant.
|
|
|
|
An attempt to upstream this was made, but rejected:
|
|
https://chromium-review.googlesource.com/c/chromium/src/+/1954347
|
|
|
|
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
|
|
index 4399fe2564a03527f5172519d0542967803c8635..1b0e7abf7db8cb2c4df4955f6f5547c63902f14e 100644
|
|
--- a/content/public/renderer/content_renderer_client.h
|
|
+++ b/content/public/renderer/content_renderer_client.h
|
|
@@ -385,6 +385,11 @@ class CONTENT_EXPORT ContentRendererClient {
|
|
virtual void DidInitializeWorkerContextOnWorkerThread(
|
|
v8::Local<v8::Context> context) {}
|
|
|
|
+ // Notifies that a worker context will be destroyed. This function is called
|
|
+ // from the worker thread.
|
|
+ virtual void WillDestroyWorkerContextOnWorkerThread(
|
|
+ v8::Local<v8::Context> context) {}
|
|
+
|
|
// Overwrites the given URL to use an HTML5 embed if possible.
|
|
// An empty URL is returned if the URL is not overriden.
|
|
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
|
|
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
|
index 033169bbdd94d4767ff90306d8768e87d2c5ccab..49a3f95667a5ae24d32c0f986a98bdd7dd557974 100644
|
|
--- a/content/renderer/renderer_blink_platform_impl.cc
|
|
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
|
@@ -854,6 +854,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
|
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
|
|
}
|
|
|
|
+void RendererBlinkPlatformImpl::WorkerContextWillDestroy(
|
|
+ const v8::Local<v8::Context>& worker) {
|
|
+ GetContentClient()->renderer()->WillDestroyWorkerContextOnWorkerThread(
|
|
+ worker);
|
|
+}
|
|
+
|
|
void RendererBlinkPlatformImpl::WorkerContextCreated(
|
|
const v8::Local<v8::Context>& worker) {
|
|
GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
|
|
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
|
|
index 89fd49fe34afaef4e36a2b0ac13e01fa98517f7d..f1af544c524680939847a4eca70e4d5aff1a91bf 100644
|
|
--- a/content/renderer/renderer_blink_platform_impl.h
|
|
+++ b/content/renderer/renderer_blink_platform_impl.h
|
|
@@ -187,6 +187,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
|
void DidStartWorkerThread() override;
|
|
void WillStopWorkerThread() override;
|
|
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
|
|
+ void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) override;
|
|
bool AllowScriptExtensionForServiceWorker(
|
|
const blink::WebSecurityOrigin& script_origin) override;
|
|
blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel(
|
|
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
|
|
index 165bd4eae9e1b3509379af1697991469d53c76ae..c953d63fe7252a570347b79ae436bccaebe979c1 100644
|
|
--- a/third_party/blink/public/platform/platform.h
|
|
+++ b/third_party/blink/public/platform/platform.h
|
|
@@ -636,6 +636,7 @@ class BLINK_PLATFORM_EXPORT Platform {
|
|
virtual void DidStartWorkerThread() {}
|
|
virtual void WillStopWorkerThread() {}
|
|
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
|
|
+ virtual void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) {}
|
|
virtual bool AllowScriptExtensionForServiceWorker(
|
|
const WebSecurityOrigin& script_origin) {
|
|
return false;
|
|
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc
|
|
index fc4eee1c0b3b2906ddc004d6069ff62ee5ee4a3a..587c47b92935fa740390eacdb0f73be6da5027c8 100644
|
|
--- a/third_party/blink/renderer/core/workers/worker_thread.cc
|
|
+++ b/third_party/blink/renderer/core/workers/worker_thread.cc
|
|
@@ -756,6 +756,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() {
|
|
}
|
|
pause_handle_.reset();
|
|
|
|
+ {
|
|
+ v8::HandleScope handle_scope(GetIsolate());
|
|
+ Platform::Current()->WorkerContextWillDestroy(
|
|
+ GlobalScope()->ScriptController()->GetContext());
|
|
+ }
|
|
+
|
|
if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::From(GetIsolate()))
|
|
debugger->WorkerThreadDestroyed(this);
|
|
|