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

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

Issue 2463453002: "Fix" remaining connection error handlers in Blink (Closed)
Patch Set: Created 4 years, 2 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
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 4c60a015dc329f06ad139e6ff263d726f6158622..9e8252c305dd3b8284247cd7cb2f767843f4055e 100644
--- a/third_party/WebKit/Source/modules/webusb/USB.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -19,6 +19,7 @@
#include "platform/UserGestureIndicator.h"
#include "platform/mojo/MojoHelper.h"
#include "public/platform/InterfaceProvider.h"
+#include "public/platform/Platform.h"
#include "wtf/Functional.h"
namespace usb = device::usb::blink;
@@ -221,6 +222,11 @@ void USB::OnDeviceRemoved(usb::DeviceInfoPtr deviceInfo) {
}
void USB::onDeviceManagerConnectionError() {
+ if (!Platform::current()) {
+ // TODO(rockot): Clean this up once renderer shutdown sequence is fixed.
+ return;
+ }
+
m_deviceManager.reset();
for (ScriptPromiseResolver* resolver : m_deviceManagerRequests)
resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
@@ -228,6 +234,11 @@ void USB::onDeviceManagerConnectionError() {
}
void USB::onChooserServiceConnectionError() {
+ if (!Platform::current()) {
+ // TODO(rockot): Clean this up once renderer shutdown sequence is fixed.
+ return;
+ }
+
m_chooserService.reset();
for (ScriptPromiseResolver* resolver : m_chooserServiceRequests)
resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
« no previous file with comments | « third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp ('k') | third_party/WebKit/Source/modules/webusb/USBDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698