Commit 980844d2 authored by imcheng's avatar imcheng Committed by Commit bot

[Media Router] Remove RouteIDManager.

Remove RouteIDManager as it is not and will not be used.

BUG=461815

Review URL: https://codereview.chromium.org/1143453005

Cr-Commit-Position: refs/heads/master@{#330263}
parent f9b0fb66
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
'media_source_helper.h', 'media_source_helper.h',
'presentation_media_sinks_observer.cc', 'presentation_media_sinks_observer.cc',
'presentation_media_sinks_observer.h', 'presentation_media_sinks_observer.h',
'route_id_manager.cc',
'route_id_manager.h',
], ],
'media_router_test_support_sources': [ 'media_router_test_support_sources': [
'mock_media_router.cc', 'mock_media_router.cc',
......
// 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.
#include "chrome/browser/media/router/route_id_manager.h"
#include "base/memory/singleton.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/media/router/media_route.h"
namespace media_router {
const char kLocalRoutePrefix[] = "route-local-";
RouteIDManager::RouteIDManager() : next_local_id_(0) {}
std::string RouteIDManager::ForLocalRoute() {
DCHECK(CalledOnValidThread());
return kLocalRoutePrefix + base::Uint64ToString(next_local_id_++);
}
// static
RouteIDManager* RouteIDManager::GetInstance() {
return Singleton<RouteIDManager>::get();
}
} // namespace media_router
// 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 is not threadsafe; IDs should be created on the same thread.
class RouteIDManager : public base::NonThreadSafe {
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_
// 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.
#include "chrome/browser/media/router/route_id_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace media_router {
TEST(RouteIDManagerTest, ForLocalRoute) {
// Singleton instance is left unused for better test isolation.
RouteIDManager manager1;
EXPECT_EQ("route-local-0", manager1.ForLocalRoute());
EXPECT_EQ("route-local-1", manager1.ForLocalRoute());
RouteIDManager manager2;
EXPECT_EQ("route-local-0", manager2.ForLocalRoute());
}
} // namespace media_router
...@@ -1429,7 +1429,6 @@ ...@@ -1429,7 +1429,6 @@
'browser/media/router/media_source_helper_unittest.cc', 'browser/media/router/media_source_helper_unittest.cc',
'browser/media/router/media_source_unittest.cc', 'browser/media/router/media_source_unittest.cc',
'browser/media/router/presentation_media_sinks_observer_unittest.cc', 'browser/media/router/presentation_media_sinks_observer_unittest.cc',
'browser/media/router/route_id_manager_unittest.cc',
'browser/ui/webui/media_router/media_cast_mode_unittest.cc', 'browser/ui/webui/media_router/media_cast_mode_unittest.cc',
'browser/ui/webui/media_router/media_router_dialog_controller_unittest.cc', 'browser/ui/webui/media_router/media_router_dialog_controller_unittest.cc',
'browser/ui/webui/media_router/media_router_test.cc', 'browser/ui/webui/media_router/media_router_test.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment