Chromium Code Reviews| Index: device/bluetooth/bluez/bluetooth_service_record_bluez.cc |
| diff --git a/device/bluetooth/bluez/bluetooth_service_record_bluez.cc b/device/bluetooth/bluez/bluetooth_service_record_bluez.cc |
| index 5a3178f2616d169524f084900ccbf6120becb4ae..262e4e1c3254c2305397df6c91e110adee555ab2 100644 |
| --- a/device/bluetooth/bluez/bluetooth_service_record_bluez.cc |
| +++ b/device/bluetooth/bluez/bluetooth_service_record_bluez.cc |
| @@ -4,13 +4,13 @@ |
| #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h" |
| +#include <utility> |
| + |
| #include "base/values.h" |
| namespace bluez { |
| -BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ( |
| - const std::map<uint16_t, BluetoothServiceAttributeValueBlueZ>& attributes) |
| - : attributes_(attributes) {} |
| +BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ() {} |
| BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ( |
| const BluetoothServiceRecordBlueZ& record) { |
| @@ -35,4 +35,14 @@ BluetoothServiceRecordBlueZ::GetAttributeValue(uint16_t attribute_id) const { |
| return it->second; |
| } |
| +void BluetoothServiceRecordBlueZ::AddRecordEntry( |
| + uint16_t id, |
| + const BluetoothServiceAttributeValueBlueZ& value) { |
| + auto it = attributes_.find(id); |
| + if (it != attributes_.end()) |
| + attributes_.erase(it); |
|
xiyuan
2016/06/29 22:43:08
Why do we need to explicitly remove the existing o
rkc
2016/06/30 20:02:24
This is a painful part of std::map. This apparentl
xiyuan
2016/06/30 20:07:34
Acknowledged.
|
| + attributes_.insert( |
|
xiyuan
2016/06/30 20:07:34
nit: could this be
attributes_.emplace(id, valu
rkc
2016/06/30 20:15:54
For some reason, map::emplace breaks some bots, wh
|
| + std::pair<uint16_t, BluetoothServiceAttributeValueBlueZ>(id, value)); |
| +} |
| + |
| } // namespace bluez |