0

Avoid dereferencing RenderThread::Get() in more of extension tracing.

The tracing statements changed in this CL are always executing on the
main thread, so `RenderThread::Get()` should never be null and therefore
these statements should not be causing crashes like the ones reported in
https://crbug.com/1444377.  OTOH, avoiding the dereference makes the
code simpler and more obviously correct.

Bug: 1444377
Change-Id: I14f3999dbf4dbc3637822172d376d132d14b1acb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4533855
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1144479}
This commit is contained in:
Lukasz Anforowicz
2023-05-16 00:14:18 +00:00
committed by Chromium LUCI CQ
parent 13739e237a
commit 4152d3a2ee

@ -91,7 +91,7 @@ ScriptInjection::ScriptInjection(
CHECK(injection_host_.get());
TRACE_EVENT_BEGIN(
"extensions", "ScriptInjection", perfetto::Track::FromPointer(this),
ChromeTrackEvent::kRenderProcessHost, *content::RenderThread::Get(),
ChromeTrackEvent::kRenderProcessHost, content::RenderThread::Get(),
ChromeTrackEvent::kChromeExtensionId,
ExtensionIdForTracing(host_id().id));
}
@ -102,7 +102,7 @@ ScriptInjection::~ScriptInjection() {
TRACE_EVENT_END("extensions", perfetto::Track::FromPointer(this),
ChromeTrackEvent::kRenderProcessHost,
*content::RenderThread::Get(),
content::RenderThread::Get(),
ChromeTrackEvent::kChromeExtensionId,
ExtensionIdForTracing(host_id().id));
}