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

Unified Diff: Source/modules/bluetooth/BluetoothGATTService.cpp

Issue 1152393002: bluetooth: Blink side implementation of getPrimaryService (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-get-primary-service-interface
Patch Set: 1. getPrimaryService impl Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/bluetooth/BluetoothGATTService.cpp
diff --git a/Source/modules/bluetooth/BluetoothGATTService.cpp b/Source/modules/bluetooth/BluetoothGATTService.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..620b1bce5d390a9052d02a5dfc1e901028dadfa5
--- /dev/null
+++ b/Source/modules/bluetooth/BluetoothGATTService.cpp
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/bluetooth/BluetoothGATTService.h"
+
+#include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h"
+#include "wtf/OwnPtr.h"
+
+namespace blink {
+
+BluetoothGATTService::BluetoothGATTService(const WebBluetoothGATTService& webService)
+ : m_webService(webService)
+{
+}
+
+BluetoothGATTService* BluetoothGATTService::take(ScriptPromiseResolver*, WebBluetoothGATTService* webServiceRawPointer)
+{
+ if (!webServiceRawPointer) {
+ return nullptr;
+ }
+ OwnPtr<WebBluetoothGATTService> webService = adoptPtr(webServiceRawPointer);
haraken 2015/05/24 00:13:50 We should avoid the adoptPtr(raw_pointer) pattern
yhirano 2015/05/25 02:30:00 To: haraken@ Yeah, I agree that this is ugly, but
haraken 2015/05/26 11:45:33 I'm curious why we can't make CallbackPromiseAdapt
+ return new BluetoothGATTService(*webService);
+}
+
+void BluetoothGATTService::dispose(WebBluetoothGATTService* webService)
+{
+ delete webService;
haraken 2015/05/24 00:13:51 Manually deleting an object looks terrible :) Can
yhirano 2015/05/25 02:30:00 To: haraken@ ditto
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698