Commit b2574cd6 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Worker: Remove unnecessary null check for Agent

After https://crrev.com/c/2164926, ExecutionContext::GetAgent() does not
return a null Agent instance anymore. This CL removes an unnecessary
null check in WorkerThread class.

Bug: 1074766
Change-Id: I08020af4507dc78d4cfe9236f62549c359146e5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263433Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781862}
parent 02033d53
...@@ -64,7 +64,9 @@ ExecutionContext::ExecutionContext(v8::Isolate* isolate, Agent* agent) ...@@ -64,7 +64,9 @@ ExecutionContext::ExecutionContext(v8::Isolate* isolate, Agent* agent)
is_context_destroyed_(false), is_context_destroyed_(false),
csp_delegate_(MakeGarbageCollected<ExecutionContextCSPDelegate>(*this)), csp_delegate_(MakeGarbageCollected<ExecutionContextCSPDelegate>(*this)),
window_interaction_tokens_(0), window_interaction_tokens_(0),
referrer_policy_(network::mojom::ReferrerPolicy::kDefault) {} referrer_policy_(network::mojom::ReferrerPolicy::kDefault) {
DCHECK(agent_);
}
ExecutionContext::~ExecutionContext() = default; ExecutionContext::~ExecutionContext() = default;
......
...@@ -362,7 +362,7 @@ class CORE_EXPORT ExecutionContext : public Supplementable<ExecutionContext>, ...@@ -362,7 +362,7 @@ class CORE_EXPORT ExecutionContext : public Supplementable<ExecutionContext>,
v8::Isolate* const isolate_; v8::Isolate* const isolate_;
Member<Agent> agent_; const Member<Agent> agent_;
bool DispatchErrorEventInternal(ErrorEvent*, SanitizeScriptErrors); bool DispatchErrorEventInternal(ErrorEvent*, SanitizeScriptErrors);
......
...@@ -321,11 +321,7 @@ void WorkerThread::DidProcessTask(const base::PendingTask& pending_task) { ...@@ -321,11 +321,7 @@ void WorkerThread::DidProcessTask(const base::PendingTask& pending_task) {
// TODO(tzik): Move this to WorkerThreadScheduler::OnTaskCompleted(), so that // TODO(tzik): Move this to WorkerThreadScheduler::OnTaskCompleted(), so that
// metrics for microtasks are counted as a part of the preceding task. // metrics for microtasks are counted as a part of the preceding task.
// TODO(nhiroki): Replace this null check with DCHECK(agent) after making GlobalScope()->GetAgent()->event_loop()->PerformMicrotaskCheckpoint();
// WorkletGlobalScope take a proper Agent.
if (Agent* agent = GlobalScope()->GetAgent()) {
agent->event_loop()->PerformMicrotaskCheckpoint();
}
// Microtask::PerformCheckpoint() runs microtasks and its completion hooks for // Microtask::PerformCheckpoint() runs microtasks and its completion hooks for
// the default microtask queue. The default queue may contain the microtasks // the default microtask queue. The default queue may contain the microtasks
......
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