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

Avoid allocation during NFCReader::HasPendingActivity()

HasPendingActivity of classes inheriting from ScriptWrappable are
not allowed to allocate. Using GetNFCProxy in HasPendingActivity
resulted in allocation.
This issue was found by clusterfuzz.

Added a call to GetNFCProxy during NFCReader initialization.
This guarantees that a NFCProxy object exists when we call
HasPendingActivity down the line and avoids the allocation.

Bug: 1001974
Change-Id: I83abd54641618a56d33a73150ffdfccd3d64a73e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796370
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695589}
parent 5cab902a
......@@ -26,7 +26,11 @@ NFCReader* NFCReader::Create(ExecutionContext* context) {
}
NFCReader::NFCReader(ExecutionContext* context)
: ContextLifecycleObserver(context) {}
: ContextLifecycleObserver(context) {
// Call GetNFCProxy to create a proxy. This guarantees no allocation will
// be needed when calling HasPendingActivity later during gc tracing.
GetNfcProxy();
}
NFCReader::~NFCReader() = default;
......
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