Commit fe74cb0c authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

Converting DedicatedWorker from EagerSweeping to PreFinalizer

Pre-finalizer performs:
1) Inform context_proxy_ that parent is destroyed
2) Cancel requests to classic_script_loader_
3) Reset uniqueptr to factory_client_

Bug: 981043
Change-Id: I425513bcc91d7d8676d575d302be85c9ca114cf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1690584Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675716}
parent db31f019
......@@ -161,9 +161,12 @@ DedicatedWorker::DedicatedWorker(ExecutionContext* context,
context->Fetcher()->GetProperties().GetFetchClientSettingsObject());
}
DedicatedWorker::~DedicatedWorker() {
DedicatedWorker::~DedicatedWorker() = default;
void DedicatedWorker::Dispose() {
DCHECK(!GetExecutionContext() || GetExecutionContext()->IsContextThread());
context_proxy_->ParentObjectDestroyed();
factory_client_.reset();
}
void DedicatedWorker::postMessage(ScriptState* script_state,
......
......@@ -70,9 +70,9 @@ class CORE_EXPORT DedicatedWorker final
public WebDedicatedWorker {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(DedicatedWorker);
// Eager finalization is needed to notify the parent object destruction of the
// Pre-finalization is needed to notify the parent object destruction of the
// GC-managed messaging proxy and to initiate worker termination.
EAGERLY_FINALIZE();
USING_PRE_FINALIZER(DedicatedWorker, Dispose);
public:
static DedicatedWorker* Create(ExecutionContext*,
......@@ -85,6 +85,8 @@ class CORE_EXPORT DedicatedWorker final
const WorkerOptions*);
~DedicatedWorker() override;
void Dispose();
void postMessage(ScriptState*,
const ScriptValue& message,
Vector<ScriptValue>& transfer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment