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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBDevice.cpp

Issue 2091713002: Specialize base::IsWeakReceiver for Blink weak pointers to support base::Bind (1/5) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +#include for build fix Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webusb/USBDevice.h" 5 #include "modules/webusb/USBDevice.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ToV8.h" 9 #include "bindings/core/v8/ToV8.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 USBDevice::USBDevice(usb::DeviceInfoPtr deviceInfo, usb::DevicePtr device, Execu tionContext* context) 88 USBDevice::USBDevice(usb::DeviceInfoPtr deviceInfo, usb::DevicePtr device, Execu tionContext* context)
89 : ContextLifecycleObserver(context) 89 : ContextLifecycleObserver(context)
90 , m_deviceInfo(std::move(deviceInfo)) 90 , m_deviceInfo(std::move(deviceInfo))
91 , m_device(std::move(device)) 91 , m_device(std::move(device))
92 , m_opened(false) 92 , m_opened(false)
93 , m_deviceStateChangeInProgress(false) 93 , m_deviceStateChangeInProgress(false)
94 , m_configurationIndex(-1) 94 , m_configurationIndex(-1)
95 { 95 {
96 if (m_device) 96 if (m_device)
97 m_device.set_connection_error_handler(createBaseCallback(bind(&USBDevice ::onConnectionError, WeakPersistentThisPointer<USBDevice>(this)))); 97 m_device.set_connection_error_handler(createBaseCallback(bind(&USBDevice ::onConnectionError, wrapWeakPersistent(this))));
98 int configurationIndex = findConfigurationIndex(info().active_configuration) ; 98 int configurationIndex = findConfigurationIndex(info().active_configuration) ;
99 if (configurationIndex != -1) 99 if (configurationIndex != -1)
100 onConfigurationSelected(true /* success */, configurationIndex); 100 onConfigurationSelected(true /* success */, configurationIndex);
101 } 101 }
102 102
103 USBDevice::~USBDevice() 103 USBDevice::~USBDevice()
104 { 104 {
105 // |m_device| may still be valid but there should be no more outstanding 105 // |m_device| may still be valid but there should be no more outstanding
106 // requests because each holds a persistent handle to this object. 106 // requests because each holds a persistent handle to this object.
107 DCHECK(m_deviceRequests.isEmpty()); 107 DCHECK(m_deviceRequests.isEmpty());
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 bool USBDevice::markRequestComplete(ScriptPromiseResolver* resolver) 782 bool USBDevice::markRequestComplete(ScriptPromiseResolver* resolver)
783 { 783 {
784 auto requestEntry = m_deviceRequests.find(resolver); 784 auto requestEntry = m_deviceRequests.find(resolver);
785 if (requestEntry == m_deviceRequests.end()) 785 if (requestEntry == m_deviceRequests.end())
786 return false; 786 return false;
787 m_deviceRequests.remove(requestEntry); 787 m_deviceRequests.remove(requestEntry);
788 return true; 788 return true;
789 } 789 }
790 790
791 } // namespace blink 791 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('k') | third_party/WebKit/Source/platform/CrossThreadCopier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698