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

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_weave_packet_receiver.h

Issue 2075313002: Substituting legacy protocol with uWeave protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest memory leak Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEIVER _H_ 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEIVER _H_
6 #define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEIVER _H_ 6 #define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEIVER _H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 UNRECOGNIZED_REASON_FOR_CLOSE, 107 UNRECOGNIZED_REASON_FOR_CLOSE,
108 PACKET_OUT_OF_SEQUENCE 108 PACKET_OUT_OF_SEQUENCE
109 }; 109 };
110 110
111 class Factory { 111 class Factory {
112 public: 112 public:
113 static std::unique_ptr<BluetoothLowEnergyWeavePacketReceiver> NewInstance( 113 static std::unique_ptr<BluetoothLowEnergyWeavePacketReceiver> NewInstance(
114 ReceiverType receiver_type); 114 ReceiverType receiver_type);
115 115
116 // Exposed for testing. 116 // Exposed for testing.
117 static void SetInstanceForTesting(Factory* factory); 117 static void SetInstanceForTesting(std::shared_ptr<Factory> factory);
118 118
119 protected: 119 protected:
120 // Exposed for testing. 120 // Exposed for testing.
121 virtual std::unique_ptr<BluetoothLowEnergyWeavePacketReceiver> 121 virtual std::unique_ptr<BluetoothLowEnergyWeavePacketReceiver>
122 BuildInstance(ReceiverType receiver_type); 122 BuildInstance(ReceiverType receiver_type);
123 123
124 private: 124 private:
125 static Factory* factory_instance_; 125 static std::shared_ptr<Factory> factory_instance_;
126 }; 126 };
127 127
128 ~BluetoothLowEnergyWeavePacketReceiver(); 128 ~BluetoothLowEnergyWeavePacketReceiver();
129 129
130 typedef std::vector<uint8_t> Packet; 130 typedef std::vector<uint8_t> Packet;
131 131
132 // Get the receiver’s state. 132 // Get the receiver’s state.
133 virtual State GetState(); 133 virtual State GetState();
134 134
135 // Return the packet size that the receiver parsed out of request/response. 135 // Return the packet size that the receiver parsed out of request/response.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // The error the receiver encountered while processing packets. 213 // The error the receiver encountered while processing packets.
214 // Used for debugging purproses. 214 // Used for debugging purproses.
215 ReceiverError receiver_error_; 215 ReceiverError receiver_error_;
216 }; 216 };
217 217
218 } // namespace weave 218 } // namespace weave
219 219
220 } // namespace proximity_auth 220 } // namespace proximity_auth
221 221
222 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEI VER_H_ 222 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_RECEI VER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698