Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: third_party/WebKit/Source/modules/webusb/USB.cpp

Issue 1876703002: Oilpan: Replace EAGERLY_FINALIZE in EventTarget's hierarchy with pre-finalizers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webusb/USB.cpp
diff --git a/third_party/WebKit/Source/modules/webusb/USB.cpp b/third_party/WebKit/Source/modules/webusb/USB.cpp
index 7863b6f80015211fce5af8b6bf679cdcfadfd065..0254cf738ff978339b48df912a4792c7a6156436 100644
--- a/third_party/WebKit/Source/modules/webusb/USB.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -78,14 +78,22 @@ USB::USB(LocalFrame& frame)
: ContextLifecycleObserver(frame.document())
, m_client(USBController::from(frame).client())
{
+ ThreadState::current()->registerPreFinalizer(this);
if (m_client)
m_client->addObserver(this);
}
USB::~USB()
{
+}
+
+void USB::dispose()
+{
+ // Promptly clears a raw reference from content/ to an on-heap object
+ // so that content/ doesn't access it in a lazy sweeping phase.
if (m_client)
m_client->removeObserver(this);
+ m_client = nullptr;
}
ScriptPromise USB::getDevices(ScriptState* scriptState)
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698