Chromium Code Reviews| Index: chrome/browser/media/router/route_id_manager.h |
| diff --git a/chrome/browser/media/router/route_id_manager.h b/chrome/browser/media/router/route_id_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b8f2bf3ce5a45a268a2540902996642503ca857e |
| --- /dev/null |
| +++ b/chrome/browser/media/router/route_id_manager.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/gtest_prod_util.h" |
| +#include "base/memory/singleton.h" |
| +#include "base/threading/non_thread_safe.h" |
| + |
| +namespace media_router { |
| + |
| +class MediaRoute; |
| + |
| +// Shared singleton which coordinates the assignment of unique IDs to |
| +// MediaRoute objects. |
| +class RouteIDManager : public base::NonThreadSafe { |
|
xhwang
2015/03/10 04:27:07
Is NonThreadSafe needed? You are not checking Call
Kevin M
2015/03/10 17:40:04
An omission that crept in when I rewrote this from
|
| + public: |
| + static RouteIDManager* GetInstance(); |
| + |
| + std::string ForLocalRoute(); |
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(RouteIDManagerTest, ForLocalRoute); |
| + friend struct DefaultSingletonTraits<RouteIDManager>; |
| + |
| + RouteIDManager(); |
| + |
| + // Monotonically increasing ID number. |
| + uint64 next_local_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RouteIDManager); |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_ID_MANAGER_H_ |