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

Unified Diff: third_party/WebKit/Source/modules/webusb/USBDevice.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
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('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/USBDevice.cpp
diff --git a/third_party/WebKit/Source/modules/webusb/USBDevice.cpp b/third_party/WebKit/Source/modules/webusb/USBDevice.cpp
index f2dba29e50c20b582a8d59db523b30d522fbf509..d422b920fe98586c04feee4510d7d0aa278f0ab2 100644
--- a/third_party/WebKit/Source/modules/webusb/USBDevice.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USBDevice.cpp
@@ -19,6 +19,7 @@
#include "modules/webusb/USBIsochronousOutTransferResult.h"
#include "modules/webusb/USBOutTransferResult.h"
#include "platform/mojo/MojoHelper.h"
+#include "public/platform/Platform.h"
#include "wtf/Assertions.h"
namespace usb = device::usb::blink;
@@ -102,9 +103,10 @@ USBDevice::USBDevice(usb::DeviceInfoPtr deviceInfo,
m_opened(false),
m_deviceStateChangeInProgress(false),
m_configurationIndex(-1) {
- if (m_device)
+ if (m_device) {
m_device.set_connection_error_handler(convertToBaseCallback(
WTF::bind(&USBDevice::onConnectionError, wrapWeakPersistent(this))));
+ }
int configurationIndex = findConfigurationIndex(info().active_configuration);
if (configurationIndex != -1)
onConfigurationSelected(true /* success */, configurationIndex);
@@ -937,6 +939,11 @@ void USBDevice::asyncReset(ScriptPromiseResolver* resolver, bool success) {
}
void USBDevice::onConnectionError() {
+ if (!Platform::current()) {
+ // TODO(rockot): Clean this up once renderer shutdown sequence is fixed.
+ return;
+ }
+
m_device.reset();
m_opened = false;
for (ScriptPromiseResolver* resolver : m_deviceRequests)
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698