Chromium Code Reviews| Index: Source/modules/bluetooth/BluetoothDevice.cpp |
| diff --git a/Source/modules/bluetooth/BluetoothDevice.cpp b/Source/modules/bluetooth/BluetoothDevice.cpp |
| index 2d9552a950762b3fef6a4061330d912b48b4d6fb..ae59773cf0558e4759d2fa6bf78e3f0408130739 100644 |
| --- a/Source/modules/bluetooth/BluetoothDevice.cpp |
| +++ b/Source/modules/bluetooth/BluetoothDevice.cpp |
| @@ -18,20 +18,14 @@ |
| namespace blink { |
| -BluetoothDevice::BluetoothDevice(const WebBluetoothDevice& webDevice) |
| +BluetoothDevice::BluetoothDevice(PassOwnPtr<WebBluetoothDevice> webDevice) |
|
Jeffrey Yasskin
2015/06/03 23:39:22
It does work to take OwnPtr<> here as long as you
|
| : m_webDevice(webDevice) |
| { |
| } |
| -BluetoothDevice* BluetoothDevice::create(const WebBluetoothDevice& webDevice) |
| -{ |
| - return new BluetoothDevice(webDevice); |
| -} |
| - |
| BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver*, WebBluetoothDevice* webDeviceRawPointer) |
| { |
| - OwnPtr<WebBluetoothDevice> webDevice = adoptPtr(webDeviceRawPointer); |
| - return BluetoothDevice::create(*webDevice); |
| + return new BluetoothDevice(adoptPtr(webDeviceRawPointer)); |
| } |
| void BluetoothDevice::dispose(WebBluetoothDevice* webDeviceRaw) |
| @@ -42,12 +36,12 @@ void BluetoothDevice::dispose(WebBluetoothDevice* webDeviceRaw) |
| unsigned BluetoothDevice::deviceClass(bool& isNull) |
| { |
| isNull = false; |
| - return m_webDevice.deviceClass; |
| + return m_webDevice->deviceClass; |
| } |
| String BluetoothDevice::vendorIDSource() |
| { |
| - switch (m_webDevice.vendorIDSource) { |
| + switch (m_webDevice->vendorIDSource) { |
| case WebBluetoothDevice::VendorIDSource::Unknown: return String(); |
| case WebBluetoothDevice::VendorIDSource::Bluetooth: return "bluetooth"; |
| case WebBluetoothDevice::VendorIDSource::USB: return "usb"; |
| @@ -59,31 +53,31 @@ String BluetoothDevice::vendorIDSource() |
| unsigned BluetoothDevice::vendorID(bool& isNull) |
| { |
| isNull = false; |
| - return m_webDevice.vendorID; |
| + return m_webDevice->vendorID; |
| } |
| unsigned BluetoothDevice::productID(bool& isNull) |
| { |
| isNull = false; |
| - return m_webDevice.productID; |
| + return m_webDevice->productID; |
| } |
| unsigned BluetoothDevice::productVersion(bool& isNull) |
| { |
| isNull = false; |
| - return m_webDevice.productVersion; |
| + return m_webDevice->productVersion; |
| } |
| bool BluetoothDevice::paired() |
| { |
| - return m_webDevice.paired; |
| + return m_webDevice->paired; |
| } |
| Vector<String> BluetoothDevice::uuids() |
| { |
| - Vector<String> uuids(m_webDevice.uuids.size()); |
| - for (size_t i = 0; i < m_webDevice.uuids.size(); ++i) |
| - uuids[i] = m_webDevice.uuids[i]; |
| + Vector<String> uuids(m_webDevice->uuids.size()); |
| + for (size_t i = 0; i < m_webDevice->uuids.size(); ++i) |
| + uuids[i] = m_webDevice->uuids[i]; |
| return uuids; |
| } |