Chromium Code Reviews| Index: components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc |
| diff --git a/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc |
| index 800ca90500775be85e14ec49271820e0f494a02a..c2f55e9ab5ee2c0fbf95050dadc495de775c6d20 100644 |
| --- a/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc |
| +++ b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc |
| @@ -20,22 +20,22 @@ namespace proximity_auth { |
| namespace weave { |
| // static. |
| -BluetoothLowEnergyWeavePacketGenerator::Factory* |
| +std::shared_ptr<BluetoothLowEnergyWeavePacketGenerator::Factory> |
|
Kyle Horimoto
2016/08/03 18:24:06
Now that you're using a class instead of a pointer
|
| BluetoothLowEnergyWeavePacketGenerator::Factory::factory_instance_ = |
| nullptr; |
| // static. |
| std::unique_ptr<BluetoothLowEnergyWeavePacketGenerator> |
| BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance() { |
| - if (factory_instance_ == nullptr) { |
| - factory_instance_ = new Factory(); |
| + if (!factory_instance_) { |
|
Kyle Horimoto
2016/08/02 00:04:45
nit: Please keep the == nullptr comparison. This i
jingxuy
2016/08/03 18:04:38
I had the same question. The pointer is not a raw
Kyle Horimoto
2016/08/03 18:24:06
I meant to use `if (factory_instance_.get() == nul
|
| + factory_instance_.reset(new Factory()); |
| } |
| return factory_instance_->BuildInstance(); |
| } |
| // static. |
| void BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( |
| - Factory* factory) { |
| + std::shared_ptr<Factory> factory) { |
| factory_instance_ = factory; |
| } |