Commit 7b363f03 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

🚫Bind: components/keyed_service/

Migrates some directories off of deprecated base::Bind, base::Callback,
etc, and onto the newer APIs.

Specifically this covers components/keyed_services/

Fixed: 1007699
Change-Id: Ibaa3ac6c7aa8ae7ccc669558e10ea569e0cfeba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1977855
Commit-Queue: Colin Blundell <blundell@chromium.org>
Auto-Submit: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726728}
parent e0f28fde
......@@ -55,7 +55,8 @@ std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription>
BrowserContextDependencyManager::
RegisterWillCreateBrowserContextServicesCallbackForTesting(
const base::Callback<void(content::BrowserContext*)>& callback) {
const base::RepeatingCallback<void(content::BrowserContext*)>&
callback) {
return will_create_browser_context_services_callbacks_.Add(callback);
}
......
......@@ -64,7 +64,7 @@ class KEYED_SERVICE_EXPORT BrowserContextDependencyManager
std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription>
RegisterWillCreateBrowserContextServicesCallbackForTesting(
const base::Callback<void(content::BrowserContext*)>& callback);
const base::RepeatingCallback<void(content::BrowserContext*)>& callback);
// Runtime assertion called as a part of GetServiceForBrowserContext() to
// check if |context| is considered stale. This will NOTREACHED() or
......
......@@ -137,8 +137,8 @@ bool DependencyGraph::BuildConstructionOrder() {
std::string DependencyGraph::DumpAsGraphviz(
const std::string& toplevel_name,
const base::Callback<std::string(DependencyNode*)>& node_name_callback)
const {
const base::RepeatingCallback<std::string(DependencyNode*)>&
node_name_callback) const {
std::string result("digraph {\n");
std::string escaped_toplevel_name = Escape(toplevel_name);
......
......@@ -41,9 +41,10 @@ class KEYED_SERVICE_EXPORT DependencyGraph {
WARN_UNUSED_RESULT;
// Returns representation of the dependency graph in graphviz format.
std::string DumpAsGraphviz(const std::string& toplevel_name,
const base::Callback<std::string(DependencyNode*)>&
node_name_callback) const;
std::string DumpAsGraphviz(
const std::string& toplevel_name,
const base::RepeatingCallback<std::string(DependencyNode*)>&
node_name_callback) const;
private:
typedef std::multimap<DependencyNode*, DependencyNode*> EdgeMap;
......
......@@ -207,8 +207,8 @@ TEST_F(DependencyGraphTest, DumpAsGraphviz_Escaping) {
for (const char* name : names) {
SCOPED_TRACE(testing::Message("name=") << name);
std::string graph_str =
graph.DumpAsGraphviz("Test", base::Bind(&NodeNameProvider, name));
std::string graph_str = graph.DumpAsGraphviz(
"Test", base::BindRepeating(&NodeNameProvider, name));
base::StringPiece dumped_name(LocateNodeNameInGraph(graph_str));
EXPECT_TRUE(IsValidDotId(dumped_name)) << "dumped_name=" << dumped_name;
}
......
......@@ -174,7 +174,7 @@ void DependencyManager::DumpDependenciesAsGraphviz(
const base::FilePath& dot_file) const {
DCHECK(!dot_file.empty());
std::string contents = dependency_graph_.DumpAsGraphviz(
top_level_name, base::Bind(&KeyedServiceBaseFactoryGetNodeName));
top_level_name, base::BindRepeating(&KeyedServiceBaseFactoryGetNodeName));
base::WriteFile(dot_file, contents.c_str(), contents.size());
}
#endif // NDEBUG
......@@ -11,7 +11,8 @@ KeyedServiceShutdownNotifier::~KeyedServiceShutdownNotifier() {
}
std::unique_ptr<base::CallbackList<void()>::Subscription>
KeyedServiceShutdownNotifier::Subscribe(const base::Closure& callback) {
KeyedServiceShutdownNotifier::Subscribe(
const base::RepeatingClosure& callback) {
return callback_list_.Add(callback);
}
......
......@@ -28,7 +28,8 @@ class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService {
// Subscribe for a notification when the keyed services this object depends on
// (as defined by its factory) are shut down. The subscription object can be
// destroyed to unsubscribe.
std::unique_ptr<Subscription> Subscribe(const base::Closure& callback);
std::unique_ptr<Subscription> Subscribe(
const base::RepeatingClosure& callback);
private:
// KeyedService implementation:
......
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