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

Unified Diff: content/shell/utility/shell_content_utility_client.cc

Issue 2810343002: Convert UtilityThread/Clients to add ConnectionFilters instead of using ChildThread's InterfaceRegi… (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « content/shell/utility/shell_content_utility_client.h ('k') | content/utility/utility_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/utility/shell_content_utility_client.cc
diff --git a/content/shell/utility/shell_content_utility_client.cc b/content/shell/utility/shell_content_utility_client.cc
index 0181ed21c8dd2cbca8f4aa3dbea2f2bf58d0de2b..b9b5fb7aeeffdeb0af9093c7e18ffffdb55eb2ad 100644
--- a/content/shell/utility/shell_content_utility_client.cc
+++ b/content/shell/utility/shell_content_utility_client.cc
@@ -11,11 +11,14 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ptr_util.h"
#include "base/process/process.h"
+#include "content/public/child/child_thread.h"
+#include "content/public/common/service_manager_connection.h"
+#include "content/public/common/simple_connection_filter.h"
#include "content/public/test/test_service.h"
#include "content/public/test/test_service.mojom.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/buffer.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
namespace content {
@@ -76,15 +79,20 @@ std::unique_ptr<service_manager::Service> CreateTestService() {
ShellContentUtilityClient::~ShellContentUtilityClient() {
}
+void ShellContentUtilityClient::UtilityThreadStarted() {
+ auto registry = base::MakeUnique<service_manager::BinderRegistry>();
+ registry->AddInterface(base::Bind(&TestServiceImpl::Create),
+ base::ThreadTaskRunnerHandle::Get());
+ content::ChildThread::Get()
+ ->GetServiceManagerConnection()
+ ->AddConnectionFilter(
+ base::MakeUnique<SimpleConnectionFilter>(std::move(registry)));
+}
+
void ShellContentUtilityClient::RegisterServices(StaticServiceMap* services) {
ServiceInfo info;
info.factory = base::Bind(&CreateTestService);
services->insert(std::make_pair(kTestServiceUrl, info));
}
-void ShellContentUtilityClient::ExposeInterfacesToBrowser(
- service_manager::InterfaceRegistry* registry) {
- registry->AddInterface(base::Bind(&TestServiceImpl::Create));
-}
-
} // namespace content
« no previous file with comments | « content/shell/utility/shell_content_utility_client.h ('k') | content/utility/utility_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698