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

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

Issue 1848603002: Remove single observer assumption in WebUSBClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use EAGERLY_FINALIZE() instead. Created 4 years, 9 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 c35c88c26ad9ea79be0ff78cef6473005987e624..73ac25da38b5a6fc8ed63b0bede5732fda92f326 100644
--- a/third_party/WebKit/Source/modules/webusb/USB.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -49,7 +49,7 @@ void convertDeviceFilter(const USBDeviceFilter& filter, WebUSBDeviceFilter* webF
void convertDeviceRequestOptions(const USBDeviceRequestOptions& options, WebUSBDeviceRequestOptions* webOptions)
{
- ASSERT(options.hasFilters());
+ DCHECK(options.hasFilters());
webOptions->filters = WebVector<WebUSBDeviceFilter>(options.filters().size());
for (size_t i = 0; i < options.filters().size(); ++i) {
convertDeviceFilter(options.filters()[i], &webOptions->filters[i]);
@@ -79,13 +79,13 @@ USB::USB(LocalFrame& frame)
, m_client(USBController::from(frame).client())
{
if (m_client)
- m_client->setObserver(this);
+ m_client->addObserver(this);
}
USB::~USB()
{
if (m_client)
- m_client->setObserver(nullptr);
+ m_client->removeObserver(this);
}
ScriptPromise USB::getDevices(ScriptState* scriptState)
@@ -139,7 +139,7 @@ const AtomicString& USB::interfaceName() const
void USB::willDetachFrameHost()
{
if (m_client)
- m_client->setObserver(nullptr);
+ m_client->removeObserver(this);
m_client = nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698