| 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)
|
|
|