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< ...@@ -55,7 +55,8 @@ std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription> base::CallbackList<void(content::BrowserContext*)>::Subscription>
BrowserContextDependencyManager:: BrowserContextDependencyManager::
RegisterWillCreateBrowserContextServicesCallbackForTesting( RegisterWillCreateBrowserContextServicesCallbackForTesting(
const base::Callback<void(content::BrowserContext*)>& callback) { const base::RepeatingCallback<void(content::BrowserContext*)>&
callback) {
return will_create_browser_context_services_callbacks_.Add(callback); return will_create_browser_context_services_callbacks_.Add(callback);
} }
......
...@@ -64,7 +64,7 @@ class KEYED_SERVICE_EXPORT BrowserContextDependencyManager ...@@ -64,7 +64,7 @@ class KEYED_SERVICE_EXPORT BrowserContextDependencyManager
std::unique_ptr< std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription> base::CallbackList<void(content::BrowserContext*)>::Subscription>
RegisterWillCreateBrowserContextServicesCallbackForTesting( RegisterWillCreateBrowserContextServicesCallbackForTesting(
const base::Callback<void(content::BrowserContext*)>& callback); const base::RepeatingCallback<void(content::BrowserContext*)>& callback);
// Runtime assertion called as a part of GetServiceForBrowserContext() to // Runtime assertion called as a part of GetServiceForBrowserContext() to
// check if |context| is considered stale. This will NOTREACHED() or // check if |context| is considered stale. This will NOTREACHED() or
......
...@@ -137,8 +137,8 @@ bool DependencyGraph::BuildConstructionOrder() { ...@@ -137,8 +137,8 @@ bool DependencyGraph::BuildConstructionOrder() {
std::string DependencyGraph::DumpAsGraphviz( std::string DependencyGraph::DumpAsGraphviz(
const std::string& toplevel_name, const std::string& toplevel_name,
const base::Callback<std::string(DependencyNode*)>& node_name_callback) const base::RepeatingCallback<std::string(DependencyNode*)>&
const { node_name_callback) const {
std::string result("digraph {\n"); std::string result("digraph {\n");
std::string escaped_toplevel_name = Escape(toplevel_name); std::string escaped_toplevel_name = Escape(toplevel_name);
......
...@@ -41,8 +41,9 @@ class KEYED_SERVICE_EXPORT DependencyGraph { ...@@ -41,8 +41,9 @@ class KEYED_SERVICE_EXPORT DependencyGraph {
WARN_UNUSED_RESULT; WARN_UNUSED_RESULT;
// Returns representation of the dependency graph in graphviz format. // Returns representation of the dependency graph in graphviz format.
std::string DumpAsGraphviz(const std::string& toplevel_name, std::string DumpAsGraphviz(
const base::Callback<std::string(DependencyNode*)>& const std::string& toplevel_name,
const base::RepeatingCallback<std::string(DependencyNode*)>&
node_name_callback) const; node_name_callback) const;
private: private:
......
...@@ -207,8 +207,8 @@ TEST_F(DependencyGraphTest, DumpAsGraphviz_Escaping) { ...@@ -207,8 +207,8 @@ TEST_F(DependencyGraphTest, DumpAsGraphviz_Escaping) {
for (const char* name : names) { for (const char* name : names) {
SCOPED_TRACE(testing::Message("name=") << name); SCOPED_TRACE(testing::Message("name=") << name);
std::string graph_str = std::string graph_str = graph.DumpAsGraphviz(
graph.DumpAsGraphviz("Test", base::Bind(&NodeNameProvider, name)); "Test", base::BindRepeating(&NodeNameProvider, name));
base::StringPiece dumped_name(LocateNodeNameInGraph(graph_str)); base::StringPiece dumped_name(LocateNodeNameInGraph(graph_str));
EXPECT_TRUE(IsValidDotId(dumped_name)) << "dumped_name=" << dumped_name; EXPECT_TRUE(IsValidDotId(dumped_name)) << "dumped_name=" << dumped_name;
} }
......
...@@ -174,7 +174,7 @@ void DependencyManager::DumpDependenciesAsGraphviz( ...@@ -174,7 +174,7 @@ void DependencyManager::DumpDependenciesAsGraphviz(
const base::FilePath& dot_file) const { const base::FilePath& dot_file) const {
DCHECK(!dot_file.empty()); DCHECK(!dot_file.empty());
std::string contents = dependency_graph_.DumpAsGraphviz( 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()); base::WriteFile(dot_file, contents.c_str(), contents.size());
} }
#endif // NDEBUG #endif // NDEBUG
...@@ -11,7 +11,8 @@ KeyedServiceShutdownNotifier::~KeyedServiceShutdownNotifier() { ...@@ -11,7 +11,8 @@ KeyedServiceShutdownNotifier::~KeyedServiceShutdownNotifier() {
} }
std::unique_ptr<base::CallbackList<void()>::Subscription> std::unique_ptr<base::CallbackList<void()>::Subscription>
KeyedServiceShutdownNotifier::Subscribe(const base::Closure& callback) { KeyedServiceShutdownNotifier::Subscribe(
const base::RepeatingClosure& callback) {
return callback_list_.Add(callback); return callback_list_.Add(callback);
} }
......
...@@ -28,7 +28,8 @@ class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService { ...@@ -28,7 +28,8 @@ class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService {
// Subscribe for a notification when the keyed services this object depends on // 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 // (as defined by its factory) are shut down. The subscription object can be
// destroyed to unsubscribe. // destroyed to unsubscribe.
std::unique_ptr<Subscription> Subscribe(const base::Closure& callback); std::unique_ptr<Subscription> Subscribe(
const base::RepeatingClosure& callback);
private: private:
// KeyedService implementation: // 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