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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bluetooth/BluetoothDevice.h" 5 #include "modules/bluetooth/BluetoothDevice.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/events/Event.h" 11 #include "core/events/Event.h"
12 #include "modules/bluetooth/BluetoothError.h" 12 #include "modules/bluetooth/BluetoothError.h"
13 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" 13 #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
14 #include "modules/bluetooth/BluetoothSupplement.h" 14 #include "modules/bluetooth/BluetoothSupplement.h"
15 #include "public/platform/modules/bluetooth/WebBluetooth.h" 15 #include "public/platform/modules/bluetooth/WebBluetooth.h"
16 #include <memory>
16 17
17 namespace blink { 18 namespace blink {
18 19
19 BluetoothDevice::BluetoothDevice(ExecutionContext* context, PassOwnPtr<WebBlueto othDeviceInit> webDevice) 20 BluetoothDevice::BluetoothDevice(ExecutionContext* context, std::unique_ptr<WebB luetoothDeviceInit> webDevice)
20 : ActiveDOMObject(context) 21 : ActiveDOMObject(context)
21 , m_webDevice(std::move(webDevice)) 22 , m_webDevice(std::move(webDevice))
22 , m_gatt(BluetoothRemoteGATTServer::create(this)) 23 , m_gatt(BluetoothRemoteGATTServer::create(this))
23 { 24 {
24 // See example in Source/platform/heap/ThreadState.h 25 // See example in Source/platform/heap/ThreadState.h
25 ThreadState::current()->registerPreFinalizer(this); 26 ThreadState::current()->registerPreFinalizer(this);
26 } 27 }
27 28
28 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, PassOwnP tr<WebBluetoothDeviceInit> webDevice) 29 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, std::uni que_ptr<WebBluetoothDeviceInit> webDevice)
29 { 30 {
30 ASSERT(webDevice); 31 ASSERT(webDevice);
31 BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext( ), std::move(webDevice)); 32 BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext( ), std::move(webDevice));
32 device->suspendIfNeeded(); 33 device->suspendIfNeeded();
33 return device; 34 return device;
34 } 35 }
35 36
36 void BluetoothDevice::dispose() 37 void BluetoothDevice::dispose()
37 { 38 {
38 disconnectGATTIfConnected(); 39 disconnectGATTIfConnected();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 Vector<String> BluetoothDevice::uuids() 82 Vector<String> BluetoothDevice::uuids()
82 { 83 {
83 Vector<String> uuids(m_webDevice->uuids.size()); 84 Vector<String> uuids(m_webDevice->uuids.size());
84 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i) 85 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i)
85 uuids[i] = m_webDevice->uuids[i]; 86 uuids[i] = m_webDevice->uuids[i];
86 return uuids; 87 return uuids;
87 } 88 }
88 89
89 } // namespace blink 90 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698