| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h | 
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h | 
| index 805e50afcef1480a9f48ee947ca2d9982c863887..d72aa6d393b95c2a27a60adb3836d05f989fe51b 100644 | 
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h | 
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h | 
| @@ -7,7 +7,9 @@ | 
|  | 
| #include "bindings/core/v8/ScriptWrappable.h" | 
| #include "bindings/modules/v8/StringOrUnsignedLong.h" | 
| +#include "core/dom/ContextLifecycleObserver.h" | 
| #include "modules/bluetooth/BluetoothDevice.h" | 
| +#include "mojo/public/cpp/bindings/associated_binding.h" | 
| #include "platform/heap/Heap.h" | 
| #include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h" | 
| #include "wtf/text/WTFString.h" | 
| @@ -21,15 +23,25 @@ class ScriptState; | 
|  | 
| // BluetoothRemoteGATTServer provides a way to interact with a connected | 
| // bluetooth peripheral. | 
| -class BluetoothRemoteGATTServer final | 
| -    : public GarbageCollected<BluetoothRemoteGATTServer>, | 
| -      public ScriptWrappable { | 
| +class BluetoothRemoteGATTServer | 
| +    : public GarbageCollectedFinalized<BluetoothRemoteGATTServer>, | 
| +      public ScriptWrappable, | 
| +      public ContextLifecycleObserver, | 
| +      public mojom::blink::WebBluetoothServerClient { | 
| +  USING_PRE_FINALIZER(BluetoothRemoteGATTServer, Dispose); | 
| DEFINE_WRAPPERTYPEINFO(); | 
| +  USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTServer); | 
|  | 
| public: | 
| -  BluetoothRemoteGATTServer(BluetoothDevice*); | 
| +  BluetoothRemoteGATTServer(ExecutionContext*, BluetoothDevice*); | 
|  | 
| -  static BluetoothRemoteGATTServer* Create(BluetoothDevice*); | 
| +  static BluetoothRemoteGATTServer* Create(ExecutionContext*, BluetoothDevice*); | 
| + | 
| +  // ContextLifecycleObserver: | 
| +  void contextDestroyed(ExecutionContext*) override; | 
| + | 
| +  // mojom::blink::WebBluetoothServerClient: | 
| +  void GATTServerDisconnected() override; | 
|  | 
| void SetConnected(bool connected) { m_connected = connected; } | 
|  | 
| @@ -47,6 +59,22 @@ class BluetoothRemoteGATTServer final | 
| // Removes all ScriptPromiseResolvers from the set of Active Algorithms. | 
| void ClearActiveAlgorithms() { m_activeAlgorithms.clear(); } | 
|  | 
| +  // If gatt is connected then sets gatt.connected to false and disconnects. | 
| +  // This function only performs the necessary steps to ensure a device | 
| +  // disconnects therefore it should only be used when the object is being | 
| +  // garbage collected or the context is being destroyed. | 
| +  void DisconnectIfConnected(); | 
| + | 
| +  // Performs necessary cleanup when a device disconnects and fires | 
| +  // gattserverdisconnected event. | 
| +  void CleanupDisconnectedDeviceAndFireEvent(); | 
| + | 
| +  void DispatchDisconnected(); | 
| + | 
| +  // USING_PRE_FINALIZER interface. | 
| +  // Called before the object gets garbage collected. | 
| +  void Dispose(); | 
| + | 
| // Interface required by Garbage Collectoin: | 
| DECLARE_VIRTUAL_TRACE(); | 
|  | 
| @@ -83,6 +111,9 @@ class BluetoothRemoteGATTServer final | 
| // using this server’s connection. | 
| HeapHashSet<Member<ScriptPromiseResolver>> m_activeAlgorithms; | 
|  | 
| +  mojo::AssociatedBinding<mojom::blink::WebBluetoothServerClient> | 
| +      m_clientBinding; | 
| + | 
| Member<BluetoothDevice> m_device; | 
| bool m_connected; | 
| }; | 
|  |