Commit 616c8be0 authored by tzik's avatar tzik Committed by Commit Bot

Avoid passing WorkletOptions as a WTF::Bind parameter

WorkletOptions is marked as DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(), and
that required to be allocated on stack or on stack heap container.

WTF::Bind() will start rejecting pass-by-value object that has Trace()
method such as WorkletOptions as it's error prone. So, as a preparation
for that, this CL expands necessary bit of WorkletOptions to the
parameters of Worklet::FetchAndInvokeScript to avoid passing
WorkletOptions directly.

Change-Id: I4cbcb8e1163327c1d4ffd8aa17f3f3d719e2f523
Reviewed-on: https://chromium-review.googlesource.com/1160682
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580372}
parent cccd9dbf
......@@ -76,9 +76,10 @@ ScriptPromise Worklet::addModule(ScriptState* script_state,
// loading.
GetExecutionContext()
->GetTaskRunner(TaskType::kInternalLoading)
->PostTask(FROM_HERE, WTF::Bind(&Worklet::FetchAndInvokeScript,
WrapPersistent(this), module_url_record,
options, WrapPersistent(pending_tasks)));
->PostTask(FROM_HERE,
WTF::Bind(&Worklet::FetchAndInvokeScript, WrapPersistent(this),
module_url_record, options.credentials(),
WrapPersistent(pending_tasks)));
return promise;
}
......@@ -108,7 +109,7 @@ WorkletGlobalScopeProxy* Worklet::FindAvailableGlobalScope() {
// algorithm:
// https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule
void Worklet::FetchAndInvokeScript(const KURL& module_url_record,
const WorkletOptions& options,
const String& credentials,
WorkletPendingTasks* pending_tasks) {
DCHECK(IsMainThread());
if (!GetExecutionContext())
......@@ -116,8 +117,7 @@ void Worklet::FetchAndInvokeScript(const KURL& module_url_record,
// Step 6: "Let credentialOptions be the credentials member of options."
network::mojom::FetchCredentialsMode credentials_mode;
bool result =
Request::ParseCredentialsMode(options.credentials(), &credentials_mode);
bool result = Request::ParseCredentialsMode(credentials, &credentials_mode);
DCHECK(result);
// Step 7: "Let outsideSettings be the relevant settings object of this."
......
......@@ -66,7 +66,7 @@ class CORE_EXPORT Worklet : public ScriptWrappable,
private:
virtual void FetchAndInvokeScript(const KURL& module_url_record,
const WorkletOptions&,
const String& credentials,
WorkletPendingTasks*);
// Returns true if there are no global scopes or additional global scopes are
......
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