| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_ |
| 6 #define BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "blimp/net/helium/vector_clock.h" |
| 10 |
| 11 namespace blimp { |
| 12 |
| 13 // This entity is responsible for generating monotonically increasing values |
| 14 // of VectorClocks. This generator is going to be used one per host |
| 15 // (client or engine) to ensure they have a single clock domain. |
| 16 // |
| 17 class VectorClockGenerator { |
| 18 public: |
| 19 VectorClockGenerator() {} |
| 20 |
| 21 void Increment() { clock_.IncrementLocal(); } |
| 22 |
| 23 const VectorClock& current() { return clock_; } |
| 24 |
| 25 private: |
| 26 VectorClock clock_; |
| 27 |
| 28 DISALLOW_COPY_AND_ASSIGN(VectorClockGenerator); |
| 29 }; |
| 30 |
| 31 } // namespace blimp |
| 32 |
| 33 #endif // BLIMP_NET_HELIUM_VECTOR_CLOCK_GENERATOR_H_ |
| OLD | NEW |