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

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

Issue 2570463005: Retire ThreadState::registerPreFinalizer<T>() (Closed)
Patch Set: Created 4 years 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/BluetoothAttributeInstanceMap.h" 12 #include "modules/bluetooth/BluetoothAttributeInstanceMap.h"
13 #include "modules/bluetooth/BluetoothError.h" 13 #include "modules/bluetooth/BluetoothError.h"
14 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" 14 #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
15 #include "modules/bluetooth/BluetoothSupplement.h" 15 #include "modules/bluetooth/BluetoothSupplement.h"
16 #include "public/platform/modules/bluetooth/WebBluetooth.h" 16 #include "public/platform/modules/bluetooth/WebBluetooth.h"
17 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h" 17 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h"
18 #include <memory> 18 #include <memory>
19 #include <utility> 19 #include <utility>
20 20
21 namespace blink { 21 namespace blink {
22 22
23 BluetoothDevice::BluetoothDevice( 23 BluetoothDevice::BluetoothDevice(
24 ExecutionContext* context, 24 ExecutionContext* context,
25 std::unique_ptr<WebBluetoothDeviceInit> webDevice) 25 std::unique_ptr<WebBluetoothDeviceInit> webDevice)
26 : ContextLifecycleObserver(context), 26 : ContextLifecycleObserver(context),
27 m_attributeInstanceMap(new BluetoothAttributeInstanceMap(this)), 27 m_attributeInstanceMap(new BluetoothAttributeInstanceMap(this)),
28 m_webDevice(std::move(webDevice)), 28 m_webDevice(std::move(webDevice)),
29 m_gatt(BluetoothRemoteGATTServer::create(this)) { 29 m_gatt(BluetoothRemoteGATTServer::create(this)) {
30 // See example in Source/platform/heap/ThreadState.h
31 ThreadState::current()->registerPreFinalizer(this);
32 } 30 }
33 31
34 BluetoothDevice* BluetoothDevice::take( 32 BluetoothDevice* BluetoothDevice::take(
35 ScriptPromiseResolver* resolver, 33 ScriptPromiseResolver* resolver,
36 std::unique_ptr<WebBluetoothDeviceInit> webDevice) { 34 std::unique_ptr<WebBluetoothDeviceInit> webDevice) {
37 ASSERT(webDevice); 35 ASSERT(webDevice);
38 return new BluetoothDevice(resolver->getExecutionContext(), 36 return new BluetoothDevice(resolver->getExecutionContext(),
39 std::move(webDevice)); 37 std::move(webDevice));
40 } 38 }
41 39
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 104 }
107 105
108 DEFINE_TRACE(BluetoothDevice) { 106 DEFINE_TRACE(BluetoothDevice) {
109 EventTargetWithInlineData::trace(visitor); 107 EventTargetWithInlineData::trace(visitor);
110 ContextLifecycleObserver::trace(visitor); 108 ContextLifecycleObserver::trace(visitor);
111 visitor->trace(m_attributeInstanceMap); 109 visitor->trace(m_attributeInstanceMap);
112 visitor->trace(m_gatt); 110 visitor->trace(m_gatt);
113 } 111 }
114 112
115 } // namespace blink 113 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698