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

Side by Side Diff: Source/modules/bluetooth/BluetoothGATTService.cpp

Issue 1148283009: bluetooth: Remove deep copying of structs by using OwnPtr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-get-primary-service-implementation
Patch Set: Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "modules/bluetooth/BluetoothGATTService.h" 6 #include "modules/bluetooth/BluetoothGATTService.h"
7 7
8 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" 8 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h"
9 #include "wtf/OwnPtr.h" 9 #include "wtf/OwnPtr.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 BluetoothGATTService::BluetoothGATTService(const WebBluetoothGATTService& webSer vice) 13 BluetoothGATTService::BluetoothGATTService(PassOwnPtr<WebBluetoothGATTService> w ebService)
14 : m_webService(webService) 14 : m_webService(webService)
15 { 15 {
16 } 16 }
17 17
18 BluetoothGATTService* BluetoothGATTService::take(ScriptPromiseResolver*, WebBlue toothGATTService* webServiceRawPointer) 18 BluetoothGATTService* BluetoothGATTService::take(ScriptPromiseResolver*, WebBlue toothGATTService* webServiceRawPointer)
19 { 19 {
20 if (!webServiceRawPointer) { 20 if (!webServiceRawPointer) {
21 return nullptr; 21 return nullptr;
22 } 22 }
23 OwnPtr<WebBluetoothGATTService> webService = adoptPtr(webServiceRawPointer); 23 return new BluetoothGATTService(adoptPtr(webServiceRawPointer));
24 return new BluetoothGATTService(*webService);
25 } 24 }
26 25
27 void BluetoothGATTService::dispose(WebBluetoothGATTService* webService) 26 void BluetoothGATTService::dispose(WebBluetoothGATTService* webService)
28 { 27 {
29 delete webService; 28 delete webService;
30 } 29 }
31 30
32 } // namespace blink 31 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698