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

Side by Side Diff: device/bluetooth/bluetooth_device_win.cc

Issue 1690133002: Implement BluetoothRemoteGattServiceWin and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and split out of included GATT services Created 4 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "device/bluetooth/bluetooth_device_win.h" 5 #include "device/bluetooth/bluetooth_device_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 service_state) { 343 service_state) {
344 // First, remove no longer exist GATT service. 344 // First, remove no longer exist GATT service.
345 { 345 {
346 std::vector<std::string> to_be_removed_services; 346 std::vector<std::string> to_be_removed_services;
347 for (const auto& gatt_service : gatt_services_) { 347 for (const auto& gatt_service : gatt_services_) {
348 if (!DoesGattServiceExist(service_state, gatt_service.second)) { 348 if (!DoesGattServiceExist(service_state, gatt_service.second)) {
349 to_be_removed_services.push_back(gatt_service.first); 349 to_be_removed_services.push_back(gatt_service.first);
350 } 350 }
351 } 351 }
352 for (const auto& service : to_be_removed_services) { 352 for (const auto& service : to_be_removed_services) {
353 gatt_services_.erase(service); 353 gatt_services_.take_and_erase(service);
354 } 354 }
355 // Update previously discovered services. 355 // Update previously discovered services.
356 for (auto gatt_service : gatt_services_) { 356 for (auto gatt_service : gatt_services_) {
357 static_cast<BluetoothRemoteGattServiceWin*>(gatt_service.second) 357 static_cast<BluetoothRemoteGattServiceWin*>(gatt_service.second)
358 ->Update(); 358 ->Update();
359 } 359 }
360 } 360 }
361 361
362 // Return if no new services have been added. 362 // Return if no new services have been added.
363 if (gatt_services_.size() == service_state.size()) 363 if (gatt_services_.size() == service_state.size())
(...skipping 11 matching lines...) Expand all
375 gatt_services_.add(primary_service->GetIdentifier(), 375 gatt_services_.add(primary_service->GetIdentifier(),
376 scoped_ptr<BluetoothGattService>(primary_service)); 376 scoped_ptr<BluetoothGattService>(primary_service));
377 adapter_->NotifyGattServiceAdded(primary_service); 377 adapter_->NotifyGattServiceAdded(primary_service);
378 } 378 }
379 } 379 }
380 380
381 adapter_->NotifyGattServicesDiscovered(this); 381 adapter_->NotifyGattServicesDiscovered(this);
382 } 382 }
383 383
384 } // namespace device 384 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698