| 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_HELIUM_REVISION_GENERATOR_H_ | |
| 6 #define BLIMP_HELIUM_REVISION_GENERATOR_H_ | |
| 7 | |
| 8 #include "base/lazy_instance.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/sequence_checker.h" | |
| 11 #include "blimp/helium/blimp_helium_export.h" | |
| 12 #include "blimp/helium/version_vector.h" | |
| 13 | |
| 14 namespace blimp { | |
| 15 namespace helium { | |
| 16 | |
| 17 // Responsible for generating monotonically increasing values | |
| 18 // of Revisions. This generator is used one per host | |
| 19 // (client or engine) to ensure they have a single clock domain. | |
| 20 class BLIMP_HELIUM_EXPORT RevisionGenerator { | |
| 21 public: | |
| 22 RevisionGenerator() = default; | |
| 23 | |
| 24 const Revision& current() { return revision_; } | |
| 25 | |
| 26 const Revision& GetNextRevision(); | |
| 27 | |
| 28 static RevisionGenerator* GetInstance(); | |
| 29 | |
| 30 private: | |
| 31 static base::LazyInstance<RevisionGenerator> instance_; | |
| 32 | |
| 33 Revision revision_ = 0; | |
| 34 base::SequenceChecker sequence_checker_; | |
| 35 | |
| 36 DISALLOW_COPY_AND_ASSIGN(RevisionGenerator); | |
| 37 }; | |
| 38 | |
| 39 Revision BLIMP_HELIUM_EXPORT GetNextRevision(); | |
| 40 | |
| 41 } // namespace helium | |
| 42 } // namespace blimp | |
| 43 | |
| 44 #endif // BLIMP_HELIUM_REVISION_GENERATOR_H_ | |
| OLD | NEW |