| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "base/memory/singleton.h" | |
| 13 #include "base/threading/non_thread_safe.h" | |
| 14 | |
| 15 namespace media_router { | |
| 16 | |
| 17 class MediaRoute; | |
| 18 | |
| 19 // Shared singleton which coordinates the assignment of unique IDs to | |
| 20 // MediaRoute objects. | |
| 21 // Class is not threadsafe; IDs should be created on the same thread. | |
| 22 class RouteIDManager : public base::NonThreadSafe { | |
| 23 public: | |
| 24 static RouteIDManager* GetInstance(); | |
| 25 | |
| 26 std::string ForLocalRoute(); | |
| 27 | |
| 28 private: | |
| 29 FRIEND_TEST_ALL_PREFIXES(RouteIDManagerTest, ForLocalRoute); | |
| 30 friend struct DefaultSingletonTraits<RouteIDManager>; | |
| 31 | |
| 32 RouteIDManager(); | |
| 33 | |
| 34 // Monotonically increasing ID number. | |
| 35 uint64 next_local_id_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(RouteIDManager); | |
| 38 }; | |
| 39 | |
| 40 } // namespace media_router | |
| 41 | |
| 42 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ | |
| OLD | NEW |