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

Unified Diff: chrome/browser/media/router/route_id_manager.h

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698