Commit a79f327a authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Move Proxy Resolver service off Service Manager

This refactors the Proxy Resolver service to use the new simpler
services model, free of any dependency on Service Manager APIs.

Process lifetime should remain identical to what it was before this
change: the browser launches a service process to host a
ProxyResolverFactory whenever one is needed, and it kills the process
once the process reports itself as idle. The process reports itself as
idle once all ProxyResolver receivers are torn down.

This is based on the proposal to simplify Chrome services here:
https://docs.google.com/document/d/1M0-K0gi1xXO0f_-YKSH2LFVh4RJY-xe9T9VaGFOSXb0/edit

Bug: 977637
Change-Id: Ibba29ac4bd3c0f7359f07788a868efb12a32327f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1699476Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#678969}
parent 05276a7b
...@@ -580,7 +580,6 @@ source_set("builtin_service_manifests") { ...@@ -580,7 +580,6 @@ source_set("builtin_service_manifests") {
"//extensions/buildflags", "//extensions/buildflags",
"//printing/buildflags", "//printing/buildflags",
"//services/preferences/public/cpp:local_state_manifest", "//services/preferences/public/cpp:local_state_manifest",
"//services/proxy_resolver/public/cpp:manifest",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
] ]
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "extensions/buildflags/buildflags.h" #include "extensions/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h"
#include "services/preferences/public/cpp/local_state_manifest.h" #include "services/preferences/public/cpp/local_state_manifest.h"
#include "services/proxy_resolver/public/cpp/manifest.h"
#include "services/service_manager/public/cpp/manifest_builder.h" #include "services/service_manager/public/cpp/manifest_builder.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -109,7 +108,6 @@ GetChromeBuiltinServiceManifests() { ...@@ -109,7 +108,6 @@ GetChromeBuiltinServiceManifests() {
GetFileUtilManifest(), GetFileUtilManifest(),
patch::GetManifest(), patch::GetManifest(),
unzip::GetManifest(), unzip::GetManifest(),
proxy_resolver::GetManifest(),
prefs::GetLocalStateManifest(), prefs::GetLocalStateManifest(),
quarantine::GetQuarantineManifest(), quarantine::GetQuarantineManifest(),
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
......
...@@ -148,7 +148,6 @@ const service_manager::Manifest& GetChromeContentBrowserOverlayManifest() { ...@@ -148,7 +148,6 @@ const service_manager::Manifest& GetChromeContentBrowserOverlayManifest() {
.RequireCapability("preferences", "pref_client") .RequireCapability("preferences", "pref_client")
.RequireCapability("preferences", "pref_control") .RequireCapability("preferences", "pref_control")
.RequireCapability("profile_import", "import") .RequireCapability("profile_import", "import")
.RequireCapability("proxy_resolver", "factory")
.RequireCapability(quarantine::mojom::kServiceName, .RequireCapability(quarantine::mojom::kServiceName,
quarantine::mojom::kQuarantineFileCapability) quarantine::mojom::kQuarantineFileCapability)
.RequireCapability("removable_storage_writer", .RequireCapability("removable_storage_writer",
......
...@@ -341,7 +341,6 @@ ...@@ -341,7 +341,6 @@
#include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_request.h"
#include "services/preferences/public/cpp/in_process_service_factory.h" #include "services/preferences/public/cpp/in_process_service_factory.h"
#include "services/preferences/public/mojom/preferences.mojom.h" #include "services/preferences/public/mojom/preferences.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/embedder/switches.h" #include "services/service_manager/embedder/switches.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/mojom/connector.mojom.h" #include "services/service_manager/public/mojom/connector.mojom.h"
...@@ -454,7 +453,6 @@ ...@@ -454,7 +453,6 @@
#include "components/crash/content/browser/crash_memory_metrics_collector_android.h" #include "components/crash/content/browser/crash_memory_metrics_collector_android.h"
#include "components/navigation_interception/intercept_navigation_delegate.h" #include "components/navigation_interception/intercept_navigation_delegate.h"
#include "content/public/browser/android/java_interfaces.h" #include "content/public/browser/android/java_interfaces.h"
#include "services/proxy_resolver/proxy_resolver_service.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/payments/payment_request.mojom.h" #include "third_party/blink/public/mojom/payments/payment_request.mojom.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h" #include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
...@@ -4123,15 +4121,6 @@ void ChromeContentBrowserClient::RunServiceInstanceOnIOThread( ...@@ -4123,15 +4121,6 @@ void ChromeContentBrowserClient::RunServiceInstanceOnIOThread(
return; return;
} }
#if defined(OS_ANDROID)
if (identity.name() == proxy_resolver::mojom::kProxyResolverServiceName) {
service_manager::Service::RunAsyncUntilTermination(
std::make_unique<proxy_resolver::ProxyResolverService>(
std::move(*receiver)));
return;
}
#endif
if (identity.name() == heap_profiling::mojom::kServiceName) { if (identity.name() == heap_profiling::mojom::kServiceName) {
heap_profiling::HeapProfilingService::GetServiceFactory().Run( heap_profiling::HeapProfilingService::GetServiceFactory().Run(
std::move(*receiver)); std::move(*receiver));
......
...@@ -8,11 +8,65 @@ ...@@ -8,11 +8,65 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/no_destructor.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/system_connector.h" #include "build/build_config.h"
#include "content/public/common/child_process_host.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#if defined(OS_ANDROID)
#include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#else
#include "content/public/browser/service_process_host.h"
#include "services/strings/grit/services_strings.h"
#endif
namespace {
proxy_resolver::mojom::ProxyResolverFactory* GetProxyResolverFactory() {
static base::NoDestructor<
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory>>
remote;
if (!remote->is_bound()) {
#if defined(OS_ANDROID)
// For Android we just lazily initialize a single factory instance and keep
// it around forever.
static base::NoDestructor<proxy_resolver::ProxyResolverFactoryImpl> factory(
remote->BindNewPipeAndPassReceiver());
#else
// For other platforms we launch the resolver in its own sandboxed service
// process.
content::ServiceProcessHost::Launch(
remote->BindNewPipeAndPassReceiver(),
content::ServiceProcessHost::Options()
#if defined(OS_MACOSX)
// The proxy_resolver service runs V8, so it needs to run in the
// helper application that has the com.apple.security.cs.allow-jit
// code signing entitlement, which is CHILD_RENDERER. The service
// still runs under the utility process sandbox.
.WithChildFlags(content::ChildProcessHost::CHILD_RENDERER)
#endif
.WithDisplayName(IDS_PROXY_RESOLVER_DISPLAY_NAME)
.Pass());
// The service will report itself idle once there are no more bound
// ProxyResolver instances. We drop the Remote at that point to initiate
// service process termination. Any subsequent call to
// |GetProxyResolverFactory()| will launch a new process.
remote->reset_on_idle_timeout(base::TimeDelta());
// Also reset on disconnection in case, e.g., the service crashes.
remote->reset_on_disconnect();
#endif
}
return remote->get();
}
} // namespace
ChromeMojoProxyResolverFactory::ChromeMojoProxyResolverFactory() = default; ChromeMojoProxyResolverFactory::ChromeMojoProxyResolverFactory() = default;
...@@ -35,14 +89,6 @@ void ChromeMojoProxyResolverFactory::CreateResolver( ...@@ -35,14 +89,6 @@ void ChromeMojoProxyResolverFactory::CreateResolver(
mojo::PendingRemote< mojo::PendingRemote<
proxy_resolver::mojom::ProxyResolverFactoryRequestClient> client) { proxy_resolver::mojom::ProxyResolverFactoryRequestClient> client) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
GetProxyResolverFactory()->CreateResolver(pac_script, std::move(receiver),
// Bind a ProxyResolverFactory backed by the proxy resolver service, have it std::move(client));
// create a ProxyResolverFactory and then destroy the factory, to avoid
// keeping the service alive after all resolvers have been destroyed.
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory;
content::GetSystemConnector()->Connect(
proxy_resolver::mojom::kProxyResolverServiceName,
resolver_factory.BindNewPipeAndPassReceiver());
resolver_factory->CreateResolver(pac_script, std::move(receiver),
std::move(client));
} }
...@@ -10,18 +10,20 @@ ...@@ -10,18 +10,20 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/optional.h"
#include "base/process/process.h" #include "base/process/process.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/test/bind_test_util.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/system_connector.h" #include "content/public/browser/service_process_host.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/mojom/service_manager.mojom.h"
namespace { namespace {
...@@ -32,88 +34,6 @@ constexpr char kPacScript[] = ...@@ -32,88 +34,6 @@ constexpr char kPacScript[] =
"function FindProxyForURL(url, host) { return 'PROXY proxy.example.com:1; " "function FindProxyForURL(url, host) { return 'PROXY proxy.example.com:1; "
"DIRECT'; }"; "DIRECT'; }";
// An implementation of ServiceManagerListener that tracks creation/destruction
// of the proxy resolver service.
class TestServiceManagerListener
: public service_manager::mojom::ServiceManagerListener {
public:
explicit TestServiceManagerListener(
service_manager::mojom::ServiceManager* service_manager) {
service_manager::mojom::ServiceManagerListenerPtr listener;
receiver_.Bind(mojo::MakeRequest(&listener));
service_manager->AddListener(std::move(listener));
}
bool service_running() const { return service_running_; }
void WaitUntilServiceStarted() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!on_service_event_loop_closure_);
if (service_running_)
return;
base::RunLoop run_loop;
on_service_event_loop_closure_ = run_loop.QuitClosure();
run_loop.Run();
on_service_event_loop_closure_.Reset();
}
void WaitUntilServiceStopped() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!on_service_event_loop_closure_);
if (!service_running_)
return;
base::RunLoop run_loop;
on_service_event_loop_closure_ = run_loop.QuitClosure();
run_loop.Run();
on_service_event_loop_closure_.Reset();
}
private:
// service_manager::mojom::ServiceManagerListener implementation:
void OnInit(std::vector<service_manager::mojom::RunningServiceInfoPtr>
running_services) override {}
void OnServiceCreated(
service_manager::mojom::RunningServiceInfoPtr service) override {}
void OnServiceStarted(const service_manager::Identity& identity,
uint32_t pid) override {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (identity.name() != proxy_resolver::mojom::kProxyResolverServiceName)
return;
EXPECT_FALSE(service_running_);
service_running_ = true;
if (on_service_event_loop_closure_)
std::move(on_service_event_loop_closure_).Run();
}
void OnServicePIDReceived(const service_manager::Identity& identity,
uint32_t pid) override {}
void OnServiceFailedToStart(
const service_manager::Identity& identity) override {}
void OnServiceStopped(const service_manager::Identity& identity) override {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (identity.name() != proxy_resolver::mojom::kProxyResolverServiceName)
return;
EXPECT_TRUE(service_running_);
service_running_ = false;
if (on_service_event_loop_closure_)
std::move(on_service_event_loop_closure_).Run();
}
mojo::Receiver<service_manager::mojom::ServiceManagerListener> receiver_{
this};
bool service_running_ = false;
base::OnceClosure on_service_event_loop_closure_;
DISALLOW_COPY_AND_ASSIGN(TestServiceManagerListener);
};
// Dummy consumer of a ProxyResolverFactory. It just calls CreateResolver, and // Dummy consumer of a ProxyResolverFactory. It just calls CreateResolver, and
// keeps Mojo objects alive from when CreateResolver() is called until it's // keeps Mojo objects alive from when CreateResolver() is called until it's
// destroyed. // destroyed.
...@@ -160,24 +80,52 @@ class DumbProxyResolverFactoryRequestClient ...@@ -160,24 +80,52 @@ class DumbProxyResolverFactoryRequestClient
base::RunLoop run_loop_; base::RunLoop run_loop_;
}; };
class ChromeMojoProxyResolverFactoryBrowserTest : public InProcessBrowserTest { using ChromeMojoProxyResolverFactoryBrowserTest = InProcessBrowserTest;
class ProxyResolverProcessObserver
: public content::ServiceProcessHost::Observer {
public: public:
void SetUpOnMainThread() override { ProxyResolverProcessObserver() {
// Access the service manager so a listener for service creation/destruction content::ServiceProcessHost::AddObserver(this);
// can be set-up. }
content::GetSystemConnector()->Connect(
service_manager::mojom::kServiceName, ~ProxyResolverProcessObserver() override {
service_manager_.BindNewPipeAndPassReceiver()); content::ServiceProcessHost::RemoveObserver(this);
}
listener_ =
std::make_unique<TestServiceManagerListener>(service_manager_.get()); bool is_service_running() const { return is_service_running_; }
void WaitForLaunch() { launch_loop_.Run(); }
void WaitForDeath() { death_loop_.Run(); }
private:
// content::ServiceProcessHost::Observer:
void OnServiceProcessLaunched(
const content::ServiceProcessInfo& info) override {
if (!info.IsService<proxy_resolver::mojom::ProxyResolverFactory>())
return;
ASSERT_FALSE(is_service_running_);
is_service_running_ = true;
launch_loop_.Quit();
} }
TestServiceManagerListener* listener() const { return listener_.get(); } void OnServiceProcessTerminatedNormally(
const content::ServiceProcessInfo& info) override {
if (!info.IsService<proxy_resolver::mojom::ProxyResolverFactory>())
return;
ASSERT_TRUE(is_service_running_);
is_service_running_ = false;
death_loop_.Quit();
}
private: private:
mojo::Remote<service_manager::mojom::ServiceManager> service_manager_; bool is_service_running_ = false;
std::unique_ptr<TestServiceManagerListener> listener_; base::RunLoop launch_loop_;
base::RunLoop death_loop_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverProcessObserver);
}; };
// Ensures the proxy resolver service is started correctly and stopped when no // Ensures the proxy resolver service is started correctly and stopped when no
...@@ -188,12 +136,13 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest, ...@@ -188,12 +136,13 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest,
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory( mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory(
ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver()); ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver());
ProxyResolverProcessObserver observer;
// Create a resolver, this should create and start the service. // Create a resolver, this should create and start the service.
std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client1 = std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client1 =
std::make_unique<DumbProxyResolverFactoryRequestClient>(); std::make_unique<DumbProxyResolverFactoryRequestClient>();
resolver_client1->CreateResolver(resolver_factory.get()); resolver_client1->CreateResolver(resolver_factory.get());
observer.WaitForLaunch();
listener()->WaitUntilServiceStarted();
// Create another resolver, no new service should be created (the listener // Create another resolver, no new service should be created (the listener
// will assert if that's the case). // will assert if that's the case).
...@@ -213,11 +162,12 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest, ...@@ -213,11 +162,12 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest,
kServiceShutdownTimeout); kServiceShutdownTimeout);
run_loop.Run(); run_loop.Run();
} }
ASSERT_TRUE(listener()->service_running());
EXPECT_TRUE(observer.is_service_running());
// Close the last resolver, the service should now go away. // Close the last resolver, the service should now go away.
resolver_client2.reset(); resolver_client2.reset();
listener()->WaitUntilServiceStopped(); observer.WaitForDeath();
} }
// Same as above, but destroys the ProxyResolverFactory, which should have no // Same as above, but destroys the ProxyResolverFactory, which should have no
...@@ -228,12 +178,13 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest, ...@@ -228,12 +178,13 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest,
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory( mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory(
ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver()); ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver());
ProxyResolverProcessObserver observer;
// Create a resolver, this should create and start the service. // Create a resolver, this should create and start the service.
std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client1 = std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client1 =
std::make_unique<DumbProxyResolverFactoryRequestClient>(); std::make_unique<DumbProxyResolverFactoryRequestClient>();
resolver_client1->CreateResolver(resolver_factory.get()); resolver_client1->CreateResolver(resolver_factory.get());
observer.WaitForLaunch();
listener()->WaitUntilServiceStarted();
// Create another resolver, no new service should be created (the listener // Create another resolver, no new service should be created (the listener
// will assert if that's the case). // will assert if that's the case).
...@@ -256,11 +207,12 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest, ...@@ -256,11 +207,12 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest,
kServiceShutdownTimeout); kServiceShutdownTimeout);
run_loop.Run(); run_loop.Run();
} }
ASSERT_TRUE(listener()->service_running());
EXPECT_TRUE(observer.is_service_running());
// Close the last resolver, the service should now go away. // Close the last resolver, the service should now go away.
resolver_client2.reset(); resolver_client2.reset();
listener()->WaitUntilServiceStopped(); observer.WaitForDeath();
} }
// Make sure the service can be started again after it's been stopped. // Make sure the service can be started again after it's been stopped.
...@@ -270,25 +222,28 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest, ...@@ -270,25 +222,28 @@ IN_PROC_BROWSER_TEST_F(ChromeMojoProxyResolverFactoryBrowserTest,
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory( mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory(
ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver()); ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver());
base::Optional<ProxyResolverProcessObserver> observer{base::in_place};
// Create a resolver, this should create and start the service. // Create a resolver, this should create and start the service.
std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client = std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client =
std::make_unique<DumbProxyResolverFactoryRequestClient>(); std::make_unique<DumbProxyResolverFactoryRequestClient>();
resolver_client->CreateResolver(resolver_factory.get()); resolver_client->CreateResolver(resolver_factory.get());
listener()->WaitUntilServiceStarted(); observer->WaitForLaunch();
// Close the resolver, the service should stop. // Close the resolver, the service should stop.
resolver_client.reset(); resolver_client.reset();
listener()->WaitUntilServiceStopped(); observer->WaitForDeath();
observer.emplace();
// Create a resolver again, using the same factory. This should create and // Create a resolver again, using the same factory. This should create and
// start the service. // start the service.
resolver_client = std::make_unique<DumbProxyResolverFactoryRequestClient>(); resolver_client = std::make_unique<DumbProxyResolverFactoryRequestClient>();
resolver_client->CreateResolver(resolver_factory.get()); resolver_client->CreateResolver(resolver_factory.get());
listener()->WaitUntilServiceStarted(); observer->WaitForLaunch();
// Close the resolver again, the service should stop. // Close the resolver again, the service should stop.
resolver_client.reset(); resolver_client.reset();
listener()->WaitUntilServiceStopped(); observer->WaitForDeath();
} }
} // namespace } // namespace
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#include "chrome/utility/importer/profile_import_impl.h" #include "chrome/utility/importer/profile_import_impl.h"
#include "chrome/utility/importer/profile_import_service.h" #include "chrome/utility/importer/profile_import_service.h"
#include "services/network/url_request_context_builder_mojo.h" #include "services/network/url_request_context_builder_mojo.h"
#include "services/proxy_resolver/proxy_resolver_service.h" // nogncheck #include "services/proxy_resolver/proxy_resolver_factory_impl.h" // nogncheck
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" // nogncheck #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -126,31 +126,6 @@ void RunServiceAsyncThenTerminateProcess( ...@@ -126,31 +126,6 @@ void RunServiceAsyncThenTerminateProcess(
base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); })); base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); }));
} }
#if !defined(OS_ANDROID)
std::unique_ptr<service_manager::Service> CreateProxyResolverService(
service_manager::mojom::ServiceRequest request) {
return std::make_unique<proxy_resolver::ProxyResolverService>(
std::move(request));
}
using ServiceFactory =
base::OnceCallback<std::unique_ptr<service_manager::Service>()>;
void RunServiceOnIOThread(ServiceFactory factory) {
base::OnceClosure terminate_process = base::BindOnce(
base::IgnoreResult(&base::SequencedTaskRunner::PostTask),
base::SequencedTaskRunnerHandle::Get(), FROM_HERE,
base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); }));
content::ChildThread::Get()->GetIOTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(
[](ServiceFactory factory, base::OnceClosure terminate_process) {
service_manager::Service::RunAsyncUntilTermination(
std::move(factory).Run(), std::move(terminate_process));
},
std::move(factory), std::move(terminate_process)));
}
#endif // !defined(OS_ANDROID)
} // namespace } // namespace
ChromeContentUtilityClient::ChromeContentUtilityClient() ChromeContentUtilityClient::ChromeContentUtilityClient()
...@@ -221,14 +196,6 @@ bool ChromeContentUtilityClient::HandleServiceRequest( ...@@ -221,14 +196,6 @@ bool ChromeContentUtilityClient::HandleServiceRequest(
return false; return false;
} }
#if !defined(OS_ANDROID)
if (service_name == proxy_resolver::mojom::kProxyResolverServiceName) {
RunServiceOnIOThread(
base::BindOnce(&CreateProxyResolverService, std::move(request)));
return true;
}
#endif // !defined(OS_ANDROID)
auto service = MaybeCreateMainThreadService(service_name, std::move(request)); auto service = MaybeCreateMainThreadService(service_name, std::move(request));
if (service) { if (service) {
RunServiceAsyncThenTerminateProcess(std::move(service)); RunServiceAsyncThenTerminateProcess(std::move(service));
...@@ -355,6 +322,18 @@ void ChromeContentUtilityClient::RegisterNetworkBinders( ...@@ -355,6 +322,18 @@ void ChromeContentUtilityClient::RegisterNetworkBinders(
g_network_binder_creation_callback.Get().Run(registry); g_network_binder_creation_callback.Get().Run(registry);
} }
void ChromeContentUtilityClient::RunIOThreadService(
mojo::GenericPendingReceiver* receiver) {
#if !defined(OS_ANDROID)
if (auto factory_receiver =
receiver->As<proxy_resolver::mojom::ProxyResolverFactory>()) {
static base::NoDestructor<proxy_resolver::ProxyResolverFactoryImpl> factory(
std::move(factory_receiver));
return;
}
#endif // !defined(OS_ANDROID)
}
// static // static
void ChromeContentUtilityClient::SetNetworkBinderCreationCallback( void ChromeContentUtilityClient::SetNetworkBinderCreationCallback(
const NetworkBinderCreationCallback& callback) { const NetworkBinderCreationCallback& callback) {
......
...@@ -33,6 +33,7 @@ class ChromeContentUtilityClient : public content::ContentUtilityClient { ...@@ -33,6 +33,7 @@ class ChromeContentUtilityClient : public content::ContentUtilityClient {
service_manager::mojom::ServiceRequest request) override; service_manager::mojom::ServiceRequest request) override;
void RegisterNetworkBinders( void RegisterNetworkBinders(
service_manager::BinderRegistry* registry) override; service_manager::BinderRegistry* registry) override;
void RunIOThreadService(mojo::GenericPendingReceiver* receiver) override;
// See NetworkBinderProvider above. // See NetworkBinderProvider above.
static void SetNetworkBinderCreationCallback( static void SetNetworkBinderCreationCallback(
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
#include "services/network/public/cpp/cross_thread_shared_url_loader_factory_info.h" #include "services/network/public/cpp/cross_thread_shared_url_loader_factory_info.h"
#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_service_test.mojom.h" #include "services/network/public/mojom/network_service_test.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/resource_coordinator/public/mojom/service_constants.mojom.h" #include "services/resource_coordinator/public/mojom/service_constants.mojom.h"
#include "services/resource_coordinator/resource_coordinator_service.h" #include "services/resource_coordinator/resource_coordinator_service.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
...@@ -464,14 +463,6 @@ class BrowserServiceManagerDelegate ...@@ -464,14 +463,6 @@ class BrowserServiceManagerDelegate
#endif #endif
if (identity.name() == shape_detection::mojom::kServiceName) if (identity.name() == shape_detection::mojom::kServiceName)
run_in_gpu_process = true; run_in_gpu_process = true;
#if defined(OS_MACOSX)
// The proxy_resolver service runs V8, so it needs to run in the helper
// application that has the com.apple.security.cs.allow-jit code signing
// entitlement, which is CHILD_RENDERER. The service still runs under the
// utility process sandbox.
if (identity.name() == proxy_resolver::mojom::kProxyResolverServiceName)
child_flags = ChildProcessHost::CHILD_RENDERER;
#endif
return std::make_unique<ContentChildServiceProcessHost>(run_in_gpu_process, return std::make_unique<ContentChildServiceProcessHost>(run_in_gpu_process,
child_flags); child_flags);
} }
......
...@@ -31,4 +31,14 @@ ServiceProcessHost::Options& ServiceProcessHost::Options::WithDisplayName( ...@@ -31,4 +31,14 @@ ServiceProcessHost::Options& ServiceProcessHost::Options::WithDisplayName(
return *this; return *this;
} }
ServiceProcessHost::Options& ServiceProcessHost::Options::WithChildFlags(
int flags) {
child_flags = flags;
return *this;
}
ServiceProcessHost::Options ServiceProcessHost::Options::Pass() {
return std::move(*this);
}
} // namespace content } // namespace content
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/optional.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
...@@ -60,8 +61,18 @@ class CONTENT_EXPORT ServiceProcessHost { ...@@ -60,8 +61,18 @@ class CONTENT_EXPORT ServiceProcessHost {
Options& WithDisplayName(const base::string16& name); Options& WithDisplayName(const base::string16& name);
Options& WithDisplayName(int resource_id); Options& WithDisplayName(int resource_id);
// Specifies additional flags to configure the launched process. See
// ChildProcessHost for flag definitions.
Options& WithChildFlags(int flags);
// Passes the contents of this Options object to a newly returned Options
// value. This must be called when moving a built Options object into a call
// to |Launch()|.
Options Pass();
SandboxType sandbox_type = service_manager::SANDBOX_TYPE_UTILITY; SandboxType sandbox_type = service_manager::SANDBOX_TYPE_UTILITY;
base::string16 display_name; base::string16 display_name;
base::Optional<int> child_flags;
}; };
// An interface which can be implemented and registered/unregistered with // An interface which can be implemented and registered/unregistered with
......
...@@ -11,11 +11,7 @@ ...@@ -11,11 +11,7 @@
namespace content { namespace content {
TestMojoProxyResolverFactory::TestMojoProxyResolverFactory() TestMojoProxyResolverFactory::TestMojoProxyResolverFactory()
: service_keepalive_(static_cast<service_manager::ServiceBinding*>(nullptr), : proxy_resolver_factory_impl_(factory_.BindNewPipeAndPassReceiver()) {}
base::nullopt) {
proxy_resolver_factory_impl_.BindReceiver(
factory_.BindNewPipeAndPassReceiver(), &service_keepalive_);
}
TestMojoProxyResolverFactory::~TestMojoProxyResolverFactory() = default; TestMojoProxyResolverFactory::~TestMojoProxyResolverFactory() = default;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h" #include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace content { namespace content {
...@@ -39,10 +38,8 @@ class TestMojoProxyResolverFactory ...@@ -39,10 +38,8 @@ class TestMojoProxyResolverFactory
override; override;
private: private:
service_manager::ServiceKeepalive service_keepalive_;
proxy_resolver::ProxyResolverFactoryImpl proxy_resolver_factory_impl_;
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> factory_; mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> factory_;
proxy_resolver::ProxyResolverFactoryImpl proxy_resolver_factory_impl_;
mojo::Receiver<ProxyResolverFactory> receiver_{this}; mojo::Receiver<ProxyResolverFactory> receiver_{this};
......
...@@ -152,6 +152,17 @@ class Remote { ...@@ -152,6 +152,17 @@ class Remote {
std::move(handler)); std::move(handler));
} }
// A convenient helper that resets this Remote on disconnect. Note that this
// replaces any previously set disconnection handler.
void reset_on_disconnect() {
if (!is_connected()) {
reset();
return;
}
set_disconnect_handler(
base::BindOnce(&Remote::reset, base::Unretained(this)));
}
// Sets a Closure to be invoked if the receiving endpoint reports itself as // Sets a Closure to be invoked if the receiving endpoint reports itself as
// idle and there are no in-flight messages it has yet to acknowledge, and // idle and there are no in-flight messages it has yet to acknowledge, and
// this state occurs continuously for a duration of at least |timeout|. The // this state occurs continuously for a duration of at least |timeout|. The
...@@ -182,6 +193,13 @@ class Remote { ...@@ -182,6 +193,13 @@ class Remote {
internal_state_.set_idle_handler(timeout, std::move(handler)); internal_state_.set_idle_handler(timeout, std::move(handler));
} }
// A convenient helper for common idle timeout behavior. This is equivalent to
// calling |set_idle_handler| with a handler that only resets this Remote.
void reset_on_idle_timeout(base::TimeDelta timeout) {
set_idle_handler(
timeout, base::BindRepeating(&Remote::reset, base::Unretained(this)));
}
// Resets this Remote to an unbound state. To reset the Remote and recover an // Resets this Remote to an unbound state. To reset the Remote and recover an
// PendingRemote that can be bound again later, use |Unbind()| instead. // PendingRemote that can be bound again later, use |Unbind()| instead.
void reset() { void reset() {
......
...@@ -11,8 +11,6 @@ source_set("lib") { ...@@ -11,8 +11,6 @@ source_set("lib") {
"proxy_resolver_factory_impl.h", "proxy_resolver_factory_impl.h",
"proxy_resolver_impl.cc", "proxy_resolver_impl.cc",
"proxy_resolver_impl.h", "proxy_resolver_impl.h",
"proxy_resolver_service.cc",
"proxy_resolver_service.h",
] ]
configs += [ "//build/config/compiler:wexit_time_destructors" ] configs += [ "//build/config/compiler:wexit_time_destructors" ]
...@@ -40,7 +38,6 @@ source_set("tests") { ...@@ -40,7 +38,6 @@ source_set("tests") {
"mojo_proxy_resolver_v8_tracing_bindings_unittest.cc", "mojo_proxy_resolver_v8_tracing_bindings_unittest.cc",
"proxy_resolver_factory_impl_unittest.cc", "proxy_resolver_factory_impl_unittest.cc",
"proxy_resolver_impl_unittest.cc", "proxy_resolver_impl_unittest.cc",
"proxy_resolver_service_unittest.cc",
] ]
deps = [ deps = [
......
...@@ -25,9 +25,7 @@ class ProxyResolverFactoryImpl::Job { ...@@ -25,9 +25,7 @@ class ProxyResolverFactoryImpl::Job {
const scoped_refptr<net::PacFileData>& pac_script, const scoped_refptr<net::PacFileData>& pac_script,
net::ProxyResolverV8TracingFactory* proxy_resolver_factory, net::ProxyResolverV8TracingFactory* proxy_resolver_factory,
mojo::PendingReceiver<mojom::ProxyResolver> receiver, mojo::PendingReceiver<mojom::ProxyResolver> receiver,
mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client, mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client);
std::unique_ptr<service_manager::ServiceKeepaliveRef>
service_keepalive_ref);
~Job(); ~Job();
private: private:
...@@ -40,7 +38,6 @@ class ProxyResolverFactoryImpl::Job { ...@@ -40,7 +38,6 @@ class ProxyResolverFactoryImpl::Job {
net::ProxyResolverV8TracingFactory* factory_; net::ProxyResolverV8TracingFactory* factory_;
std::unique_ptr<net::ProxyResolverFactory::Request> request_; std::unique_ptr<net::ProxyResolverFactory::Request> request_;
mojo::Remote<mojom::ProxyResolverFactoryRequestClient> remote_client_; mojo::Remote<mojom::ProxyResolverFactoryRequestClient> remote_client_;
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_keepalive_ref_;
DISALLOW_COPY_AND_ASSIGN(Job); DISALLOW_COPY_AND_ASSIGN(Job);
}; };
...@@ -50,13 +47,11 @@ ProxyResolverFactoryImpl::Job::Job( ...@@ -50,13 +47,11 @@ ProxyResolverFactoryImpl::Job::Job(
const scoped_refptr<net::PacFileData>& pac_script, const scoped_refptr<net::PacFileData>& pac_script,
net::ProxyResolverV8TracingFactory* proxy_resolver_factory, net::ProxyResolverV8TracingFactory* proxy_resolver_factory,
mojo::PendingReceiver<mojom::ProxyResolver> receiver, mojo::PendingReceiver<mojom::ProxyResolver> receiver,
mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client, mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client)
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_keepalive_ref)
: parent_(factory), : parent_(factory),
proxy_receiver_(std::move(receiver)), proxy_receiver_(std::move(receiver)),
factory_(proxy_resolver_factory), factory_(proxy_resolver_factory),
remote_client_(std::move(client)), remote_client_(std::move(client)) {
service_keepalive_ref_(std::move(service_keepalive_ref)) {
remote_client_.set_disconnect_handler(base::BindOnce( remote_client_.set_disconnect_handler(base::BindOnce(
&ProxyResolverFactoryImpl::Job::OnDisconnect, base::Unretained(this))); &ProxyResolverFactoryImpl::Job::OnDisconnect, base::Unretained(this)));
factory_->CreateProxyResolverV8Tracing( factory_->CreateProxyResolverV8Tracing(
...@@ -79,29 +74,17 @@ void ProxyResolverFactoryImpl::Job::OnDisconnect() { ...@@ -79,29 +74,17 @@ void ProxyResolverFactoryImpl::Job::OnDisconnect() {
void ProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { void ProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) {
if (error == net::OK) { if (error == net::OK) {
parent_->AddResolver( parent_->AddResolver(
std::make_unique<ProxyResolverImpl>(std::move(proxy_resolver_impl_), std::make_unique<ProxyResolverImpl>(std::move(proxy_resolver_impl_)),
std::move(service_keepalive_ref_)),
std::move(proxy_receiver_)); std::move(proxy_receiver_));
} }
remote_client_->ReportResult(error); remote_client_->ReportResult(error);
parent_->RemoveJob(this); parent_->RemoveJob(this);
} }
ProxyResolverFactoryImpl::ProxyResolverFactoryImpl() ProxyResolverFactoryImpl::ProxyResolverFactoryImpl(
: ProxyResolverFactoryImpl( mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver)
net::ProxyResolverV8TracingFactory::Create()) {} : ProxyResolverFactoryImpl(std::move(receiver),
net::ProxyResolverV8TracingFactory::Create()) {}
void ProxyResolverFactoryImpl::BindReceiver(
mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolverFactory> receiver,
service_manager::ServiceKeepalive* service_keepalive) {
if (receivers_.empty()) {
DCHECK(!service_keepalive_ref_);
service_keepalive_ref_ = service_keepalive->CreateRef();
}
DCHECK(service_keepalive_ref_.get());
receivers_.Add(this, std::move(receiver));
}
void ProxyResolverFactoryImpl::AddResolver( void ProxyResolverFactoryImpl::AddResolver(
std::unique_ptr<mojom::ProxyResolver> resolver, std::unique_ptr<mojom::ProxyResolver> resolver,
...@@ -110,11 +93,10 @@ void ProxyResolverFactoryImpl::AddResolver( ...@@ -110,11 +93,10 @@ void ProxyResolverFactoryImpl::AddResolver(
} }
ProxyResolverFactoryImpl::ProxyResolverFactoryImpl( ProxyResolverFactoryImpl::ProxyResolverFactoryImpl(
mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver,
std::unique_ptr<net::ProxyResolverV8TracingFactory> proxy_resolver_factory) std::unique_ptr<net::ProxyResolverV8TracingFactory> proxy_resolver_factory)
: proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)) { : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)),
receivers_.set_disconnect_handler(base::BindRepeating( receiver_(this, std::move(receiver)) {}
&ProxyResolverFactoryImpl::OnDisconnect, base::Unretained(this)));
}
ProxyResolverFactoryImpl::~ProxyResolverFactoryImpl() = default; ProxyResolverFactoryImpl::~ProxyResolverFactoryImpl() = default;
...@@ -122,14 +104,12 @@ void ProxyResolverFactoryImpl::CreateResolver( ...@@ -122,14 +104,12 @@ void ProxyResolverFactoryImpl::CreateResolver(
const std::string& pac_script, const std::string& pac_script,
mojo::PendingReceiver<mojom::ProxyResolver> receiver, mojo::PendingReceiver<mojom::ProxyResolver> receiver,
mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client) { mojo::PendingRemote<mojom::ProxyResolverFactoryRequestClient> client) {
DCHECK(service_keepalive_ref_);
// The Job will call RemoveJob on |this| when either the create request // The Job will call RemoveJob on |this| when either the create request
// finishes or |receiver| or |client| encounters a connection error. // finishes or |receiver| or |client| encounters a connection error.
std::unique_ptr<Job> job = std::make_unique<Job>( std::unique_ptr<Job> job =
this, net::PacFileData::FromUTF8(pac_script), std::make_unique<Job>(this, net::PacFileData::FromUTF8(pac_script),
proxy_resolver_impl_factory_.get(), std::move(receiver), proxy_resolver_impl_factory_.get(),
std::move(client), service_keepalive_ref_->Clone()); std::move(receiver), std::move(client));
Job* job_ptr = job.get(); Job* job_ptr = job.get();
jobs_[job_ptr] = std::move(job); jobs_[job_ptr] = std::move(job);
} }
...@@ -139,10 +119,4 @@ void ProxyResolverFactoryImpl::RemoveJob(Job* job) { ...@@ -139,10 +119,4 @@ void ProxyResolverFactoryImpl::RemoveJob(Job* job) {
DCHECK_EQ(1U, erased_count); DCHECK_EQ(1U, erased_count);
} }
void ProxyResolverFactoryImpl::OnDisconnect() {
DCHECK(service_keepalive_ref_);
if (receivers_.empty())
service_keepalive_ref_.reset();
}
} // namespace proxy_resolver } // namespace proxy_resolver
...@@ -12,10 +12,9 @@ ...@@ -12,10 +12,9 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/unique_receiver_set.h" #include "mojo/public/cpp/bindings/unique_receiver_set.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace net { namespace net {
class ProxyResolverV8TracingFactory; class ProxyResolverV8TracingFactory;
...@@ -26,15 +25,10 @@ namespace proxy_resolver { ...@@ -26,15 +25,10 @@ namespace proxy_resolver {
// mojom::ProxyResolverFactory implementation that handles multiple bound pipes. // mojom::ProxyResolverFactory implementation that handles multiple bound pipes.
class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory { class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory {
public: public:
ProxyResolverFactoryImpl(); explicit ProxyResolverFactoryImpl(
mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver);
~ProxyResolverFactoryImpl() override; ~ProxyResolverFactoryImpl() override;
// Binds |receiver| to |this|. If |this| has no ServiceKeepaliveRef, creates
// one, and only destroys all refs once all bound requests, and all
// ProxyResolvers they are used to create are destroyed.
void BindReceiver(mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver,
service_manager::ServiceKeepalive* service_keepalive);
// Used by jobs to pass ownership of a newly bound ProxyResolver to this // Used by jobs to pass ownership of a newly bound ProxyResolver to this
// factory. // factory.
void AddResolver(std::unique_ptr<mojom::ProxyResolver> resolver, void AddResolver(std::unique_ptr<mojom::ProxyResolver> resolver,
...@@ -42,7 +36,8 @@ class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory { ...@@ -42,7 +36,8 @@ class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory {
protected: protected:
// Visible for tests. // Visible for tests.
explicit ProxyResolverFactoryImpl( ProxyResolverFactoryImpl(
mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver,
std::unique_ptr<net::ProxyResolverV8TracingFactory> std::unique_ptr<net::ProxyResolverV8TracingFactory>
proxy_resolver_factory); proxy_resolver_factory);
...@@ -57,16 +52,13 @@ class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory { ...@@ -57,16 +52,13 @@ class ProxyResolverFactoryImpl : public mojom::ProxyResolverFactory {
override; override;
void RemoveJob(Job* job); void RemoveJob(Job* job);
void OnDisconnect();
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_keepalive_ref_;
const std::unique_ptr<net::ProxyResolverV8TracingFactory> const std::unique_ptr<net::ProxyResolverV8TracingFactory>
proxy_resolver_impl_factory_; proxy_resolver_impl_factory_;
std::map<Job*, std::unique_ptr<Job>> jobs_; std::map<Job*, std::unique_ptr<Job>> jobs_;
mojo::ReceiverSet<mojom::ProxyResolverFactory> receivers_; mojo::Receiver<mojom::ProxyResolverFactory> receiver_;
mojo::UniqueReceiverSet<mojom::ProxyResolver> resolvers_; mojo::UniqueReceiverSet<mojom::ProxyResolver> resolvers_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryImpl); DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryImpl);
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/optional.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
...@@ -19,7 +21,6 @@ ...@@ -19,7 +21,6 @@
#include "net/proxy_resolution/proxy_resolver_v8_tracing.h" #include "net/proxy_resolution/proxy_resolver_v8_tracing.h"
#include "net/test/event_waiter.h" #include "net/test/event_waiter.h"
#include "net/test/gtest_util.h" #include "net/test/gtest_util.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -100,36 +101,31 @@ class TestProxyResolverFactory : public net::ProxyResolverV8TracingFactory { ...@@ -100,36 +101,31 @@ class TestProxyResolverFactory : public net::ProxyResolverV8TracingFactory {
class TestProxyResolverFactoryImpl : public ProxyResolverFactoryImpl { class TestProxyResolverFactoryImpl : public ProxyResolverFactoryImpl {
public: public:
explicit TestProxyResolverFactoryImpl( TestProxyResolverFactoryImpl(
std::unique_ptr<net::ProxyResolverV8TracingFactory> mojo::PendingReceiver<mojom::ProxyResolverFactory> receiver,
proxy_resolver_factory) std::unique_ptr<net::ProxyResolverV8TracingFactory> factory)
: ProxyResolverFactoryImpl(std::move(proxy_resolver_factory)) {} : ProxyResolverFactoryImpl(std::move(receiver), std::move(factory)) {}
}; };
} // namespace } // namespace
class ProxyResolverFactoryImplTest class ProxyResolverFactoryImplTest
: public testing::Test, : public testing::Test,
public mojom::ProxyResolverFactoryRequestClient, public mojom::ProxyResolverFactoryRequestClient {
public service_manager::ServiceKeepalive::Observer {
public: public:
ProxyResolverFactoryImplTest() ProxyResolverFactoryImplTest() {
: service_keepalive_(
static_cast<service_manager::ServiceBinding*>(nullptr),
base::TimeDelta()) {
service_keepalive_.AddObserver(this);
std::unique_ptr<TestProxyResolverFactory> test_factory = std::unique_ptr<TestProxyResolverFactory> test_factory =
std::make_unique<TestProxyResolverFactory>(&waiter_); std::make_unique<TestProxyResolverFactory>(&waiter_);
mock_factory_ = test_factory.get(); mock_factory_ = test_factory.get();
mock_factory_impl_ = mock_factory_impl_ = std::make_unique<TestProxyResolverFactoryImpl>(
std::make_unique<TestProxyResolverFactoryImpl>(std::move(test_factory)); factory_.BindNewPipeAndPassReceiver(), std::move(test_factory));
mock_factory_impl_->BindReceiver(factory_.BindNewPipeAndPassReceiver(), factory_.set_idle_handler(
&service_keepalive_); base::TimeDelta(),
base::BindRepeating(&ProxyResolverFactoryImplTest::OnFactoryIdle,
base::Unretained(this)));
} }
~ProxyResolverFactoryImplTest() override { ~ProxyResolverFactoryImplTest() override = default;
service_keepalive_.RemoveObserver(this);
}
void OnDisconnect() { waiter_.NotifyEvent(CONNECTION_ERROR); } void OnDisconnect() { waiter_.NotifyEvent(CONNECTION_ERROR); }
...@@ -151,24 +147,14 @@ class ProxyResolverFactoryImplTest ...@@ -151,24 +147,14 @@ class ProxyResolverFactoryImplTest
net::ProxyResolveDnsOperation operation, net::ProxyResolveDnsOperation operation,
mojo::PendingRemote<mojom::HostResolverRequestClient> client) override {} mojo::PendingRemote<mojom::HostResolverRequestClient> client) override {}
void WaitForNoServiceRefs() { void set_idle_callback(base::OnceClosure callback) {
DCHECK(!service_keepalive_ref_run_loop_); idle_callback_ = std::move(callback);
if (service_keepalive_.HasNoRefs())
return;
service_keepalive_ref_run_loop_ = std::make_unique<base::RunLoop>();
service_keepalive_ref_run_loop_->Run();
service_keepalive_ref_run_loop_.reset();
EXPECT_TRUE(service_keepalive_.HasNoRefs());
} }
protected: protected:
// service_manager::ServiceKeepalive::Observer: void OnFactoryIdle() {
void OnIdleTimeout() override { if (idle_callback_)
if (service_keepalive_ref_run_loop_) std::move(idle_callback_).Run();
service_keepalive_ref_run_loop_->Quit();
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::ScopedTaskEnvironment task_environment_;
...@@ -176,12 +162,11 @@ class ProxyResolverFactoryImplTest ...@@ -176,12 +162,11 @@ class ProxyResolverFactoryImplTest
TestProxyResolverFactory* mock_factory_; TestProxyResolverFactory* mock_factory_;
mojo::Remote<mojom::ProxyResolverFactory> factory_; mojo::Remote<mojom::ProxyResolverFactory> factory_;
service_manager::ServiceKeepalive service_keepalive_;
std::unique_ptr<base::RunLoop> service_keepalive_ref_run_loop_;
int instances_destroyed_ = 0; int instances_destroyed_ = 0;
net::CompletionOnceCallback create_callback_; net::CompletionOnceCallback create_callback_;
base::OnceClosure idle_callback_;
net::EventWaiter<Event> waiter_; net::EventWaiter<Event> waiter_;
}; };
...@@ -207,18 +192,15 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverClient) { ...@@ -207,18 +192,15 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverClient) {
base::Unretained(this))); base::Unretained(this)));
std::move(mock_factory_->pending_request()->callback).Run(net::OK); std::move(mock_factory_->pending_request()->callback).Run(net::OK);
EXPECT_THAT(create_callback.WaitForResult(), IsOk()); EXPECT_THAT(create_callback.WaitForResult(), IsOk());
EXPECT_FALSE(service_keepalive_.HasNoRefs());
base::RunLoop wait_for_idle_loop;
set_idle_callback(wait_for_idle_loop.QuitClosure());
proxy_resolver.reset(); proxy_resolver.reset();
waiter_.WaitForEvent(RESOLVER_DESTROYED); waiter_.WaitForEvent(RESOLVER_DESTROYED);
EXPECT_EQ(1, instances_destroyed_); EXPECT_EQ(1, instances_destroyed_);
EXPECT_FALSE(service_keepalive_.HasNoRefs());
task_environment_.RunUntilIdle();
EXPECT_FALSE(service_keepalive_.HasNoRefs());
factory_.reset(); wait_for_idle_loop.Run();
WaitForNoServiceRefs();
} }
// Same as above, but disconnect the factory right after the CreateResolver // Same as above, but disconnect the factory right after the CreateResolver
...@@ -231,7 +213,7 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverFactory) { ...@@ -231,7 +213,7 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverFactory) {
factory_->CreateResolver(kScriptData, factory_->CreateResolver(kScriptData,
proxy_resolver.BindNewPipeAndPassReceiver(), proxy_resolver.BindNewPipeAndPassReceiver(),
std::move(client)); std::move(client));
factory_.reset();
proxy_resolver.set_disconnect_handler(base::BindOnce( proxy_resolver.set_disconnect_handler(base::BindOnce(
&ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this))); &ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this)));
waiter_.WaitForEvent(RESOLVER_CREATED); waiter_.WaitForEvent(RESOLVER_CREATED);
...@@ -246,16 +228,15 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverFactory) { ...@@ -246,16 +228,15 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectProxyResolverFactory) {
base::Unretained(this))); base::Unretained(this)));
std::move(mock_factory_->pending_request()->callback).Run(net::OK); std::move(mock_factory_->pending_request()->callback).Run(net::OK);
EXPECT_THAT(create_callback.WaitForResult(), IsOk()); EXPECT_THAT(create_callback.WaitForResult(), IsOk());
EXPECT_FALSE(service_keepalive_.HasNoRefs());
task_environment_.RunUntilIdle(); base::RunLoop wait_for_idle_loop;
EXPECT_FALSE(service_keepalive_.HasNoRefs()); set_idle_callback(wait_for_idle_loop.QuitClosure());
proxy_resolver.reset(); proxy_resolver.reset();
waiter_.WaitForEvent(RESOLVER_DESTROYED); waiter_.WaitForEvent(RESOLVER_DESTROYED);
EXPECT_EQ(1, instances_destroyed_); EXPECT_EQ(1, instances_destroyed_);
WaitForNoServiceRefs(); wait_for_idle_loop.Run();
} }
TEST_F(ProxyResolverFactoryImplTest, Error) { TEST_F(ProxyResolverFactoryImplTest, Error) {
...@@ -266,7 +247,6 @@ TEST_F(ProxyResolverFactoryImplTest, Error) { ...@@ -266,7 +247,6 @@ TEST_F(ProxyResolverFactoryImplTest, Error) {
factory_->CreateResolver(kScriptData, factory_->CreateResolver(kScriptData,
proxy_resolver.BindNewPipeAndPassReceiver(), proxy_resolver.BindNewPipeAndPassReceiver(),
std::move(client)); std::move(client));
factory_.reset();
proxy_resolver.set_disconnect_handler(base::BindOnce( proxy_resolver.set_disconnect_handler(base::BindOnce(
&ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this))); &ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this)));
waiter_.WaitForEvent(RESOLVER_CREATED); waiter_.WaitForEvent(RESOLVER_CREATED);
...@@ -289,7 +269,6 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectClientDuringResolverCreation) { ...@@ -289,7 +269,6 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectClientDuringResolverCreation) {
factory_->CreateResolver(kScriptData, factory_->CreateResolver(kScriptData,
proxy_resolver.BindNewPipeAndPassReceiver(), proxy_resolver.BindNewPipeAndPassReceiver(),
std::move(client)); std::move(client));
factory_.reset();
proxy_resolver.set_disconnect_handler(base::BindOnce( proxy_resolver.set_disconnect_handler(base::BindOnce(
&ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this))); &ProxyResolverFactoryImplTest::OnDisconnect, base::Unretained(this)));
waiter_.WaitForEvent(RESOLVER_CREATED); waiter_.WaitForEvent(RESOLVER_CREATED);
...@@ -299,34 +278,4 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectClientDuringResolverCreation) { ...@@ -299,34 +278,4 @@ TEST_F(ProxyResolverFactoryImplTest, DisconnectClientDuringResolverCreation) {
waiter_.WaitForEvent(CONNECTION_ERROR); waiter_.WaitForEvent(CONNECTION_ERROR);
} }
TEST_F(ProxyResolverFactoryImplTest, MultipleFactories) {
// Creating |factory_| should have resulted in an outstanding service
// reference.
EXPECT_FALSE(service_keepalive_.HasNoRefs());
// Creating another shouldn't change that.
mojo::Remote<mojom::ProxyResolverFactory> factory2;
mock_factory_impl_->BindReceiver(factory2.BindNewPipeAndPassReceiver(),
&service_keepalive_);
EXPECT_FALSE(service_keepalive_.HasNoRefs());
// Destroying one factory while keeping the other around should not release
// the reference.
factory_.reset();
task_environment_.RunUntilIdle();
EXPECT_FALSE(service_keepalive_.HasNoRefs());
// Destroying the second factory should release the reference.
factory2.reset();
WaitForNoServiceRefs();
// Test that creating and then destroying a new factory gets and releases a
// reference again.
mock_factory_impl_->BindReceiver(factory2.BindNewPipeAndPassReceiver(),
&service_keepalive_);
EXPECT_FALSE(service_keepalive_.HasNoRefs());
factory2.reset();
WaitForNoServiceRefs();
}
} // namespace proxy_resolver } // namespace proxy_resolver
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "net/proxy_resolution/proxy_info.h" #include "net/proxy_resolution/proxy_info.h"
#include "net/proxy_resolution/proxy_resolver_v8_tracing.h" #include "net/proxy_resolution/proxy_resolver_v8_tracing.h"
#include "services/proxy_resolver/mojo_proxy_resolver_v8_tracing_bindings.h" #include "services/proxy_resolver/mojo_proxy_resolver_v8_tracing_bindings.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace proxy_resolver { namespace proxy_resolver {
...@@ -46,9 +45,8 @@ class ProxyResolverImpl::Job { ...@@ -46,9 +45,8 @@ class ProxyResolverImpl::Job {
}; };
ProxyResolverImpl::ProxyResolverImpl( ProxyResolverImpl::ProxyResolverImpl(
std::unique_ptr<net::ProxyResolverV8Tracing> resolver, std::unique_ptr<net::ProxyResolverV8Tracing> resolver)
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref) : resolver_(std::move(resolver)) {}
: resolver_(std::move(resolver)), service_ref_(std::move(service_ref)) {}
ProxyResolverImpl::~ProxyResolverImpl() = default; ProxyResolverImpl::~ProxyResolverImpl() = default;
......
...@@ -17,17 +17,12 @@ namespace net { ...@@ -17,17 +17,12 @@ namespace net {
class ProxyResolverV8Tracing; class ProxyResolverV8Tracing;
} // namespace net } // namespace net
namespace service_manager {
class ServiceKeepaliveRef;
} // namespace service_manager
namespace proxy_resolver { namespace proxy_resolver {
class ProxyResolverImpl : public mojom::ProxyResolver { class ProxyResolverImpl : public mojom::ProxyResolver {
public: public:
ProxyResolverImpl( explicit ProxyResolverImpl(
std::unique_ptr<net::ProxyResolverV8Tracing> resolver, std::unique_ptr<net::ProxyResolverV8Tracing> resolver);
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref);
~ProxyResolverImpl() override; ~ProxyResolverImpl() override;
...@@ -43,7 +38,6 @@ class ProxyResolverImpl : public mojom::ProxyResolver { ...@@ -43,7 +38,6 @@ class ProxyResolverImpl : public mojom::ProxyResolver {
std::unique_ptr<net::ProxyResolverV8Tracing> resolver_; std::unique_ptr<net::ProxyResolverV8Tracing> resolver_;
std::map<Job*, std::unique_ptr<Job>> resolve_jobs_; std::map<Job*, std::unique_ptr<Job>> resolve_jobs_;
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverImpl); DISALLOW_COPY_AND_ASSIGN(ProxyResolverImpl);
}; };
......
...@@ -203,9 +203,8 @@ class ProxyResolverImplTest : public testing::Test { ...@@ -203,9 +203,8 @@ class ProxyResolverImplTest : public testing::Test {
std::unique_ptr<MockProxyResolverV8Tracing> mock_resolver = std::unique_ptr<MockProxyResolverV8Tracing> mock_resolver =
std::make_unique<MockProxyResolverV8Tracing>(); std::make_unique<MockProxyResolverV8Tracing>();
mock_proxy_resolver_ = mock_resolver.get(); mock_proxy_resolver_ = mock_resolver.get();
resolver_impl_ = std::make_unique<ProxyResolverImpl>( resolver_impl_ =
std::move(mock_resolver), std::make_unique<ProxyResolverImpl>(std::move(mock_resolver));
std::unique_ptr<service_manager::ServiceContextRef>());
resolver_ = resolver_impl_.get(); resolver_ = resolver_impl_.get();
} }
......
// Copyright 2017 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 "services/proxy_resolver/proxy_resolver_service.h"
#include <utility>
#include "base/bind.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
namespace proxy_resolver {
ProxyResolverService::ProxyResolverService(
mojo::PendingReceiver<service_manager::mojom::Service> receiver)
: service_binding_(this, std::move(receiver)),
service_keepalive_(&service_binding_, base::TimeDelta()) {}
ProxyResolverService::~ProxyResolverService() = default;
void ProxyResolverService::OnConnect(
const service_manager::ConnectSourceInfo& source,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle receiver_pipe) {
if (interface_name == mojom::ProxyResolverFactory::Name_) {
proxy_resolver_factory_.BindReceiver(
mojo::PendingReceiver<mojom::ProxyResolverFactory>(
std::move(receiver_pipe)),
&service_keepalive_);
}
}
} // namespace proxy_resolver
// Copyright 2017 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 SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_SERVICE_H_
#define SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_SERVICE_H_
#include <memory>
#include <string>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_binding.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
#include "services/service_manager/public/mojom/service.mojom.h"
namespace proxy_resolver {
class ProxyResolverService : public service_manager::Service {
public:
explicit ProxyResolverService(
mojo::PendingReceiver<service_manager::mojom::Service> receiver);
~ProxyResolverService() override;
// Lifescycle events that occur after the service has started to spinup.
void OnConnect(const service_manager::ConnectSourceInfo& source,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle receiver_pipe) override;
private:
service_manager::ServiceBinding service_binding_;
service_manager::ServiceKeepalive service_keepalive_;
ProxyResolverFactoryImpl proxy_resolver_factory_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverService);
};
} // namespace proxy_resolver
#endif // SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_SERVICE_H_
// Copyright 2017 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 "services/proxy_resolver/proxy_resolver_service.h"
#include <memory>
#include "base/test/scoped_task_environment.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/test/test_connector_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace proxy_resolver {
class ProxyResolverServiceTest : public testing::Test {
public:
ProxyResolverServiceTest()
: service_(std::make_unique<ProxyResolverService>(
connector_factory_.RegisterInstance(
mojom::kProxyResolverServiceName))) {}
~ProxyResolverServiceTest() override = default;
protected:
base::test::ScopedTaskEnvironment task_environment_;
service_manager::TestConnectorFactory connector_factory_;
std::unique_ptr<ProxyResolverService> service_;
};
// Check that destroying the service while there's a live ProxyResolverFactory
// is safe.
TEST_F(ProxyResolverServiceTest, ShutdownServiceWithLiveProxyResolverFactory) {
mojo::Remote<mojom::ProxyResolverFactory> proxy_resolver_factory;
connector_factory_.GetDefaultConnector()->Connect(
mojom::kProxyResolverServiceName,
proxy_resolver_factory.BindNewPipeAndPassReceiver());
// Wait for the ProxyFactory to be bound.
proxy_resolver_factory.FlushForTesting();
// Simulate the service being destroyed. No crash should occur.
service_.reset();
// Destroying the ProxyResolverFactory shouldn't result in a crash, either.
proxy_resolver_factory.reset();
task_environment_.RunUntilIdle();
}
} // namespace proxy_resolver
# Copyright 2019 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.
source_set("manifest") {
sources = [
"manifest.cc",
"manifest.h",
]
deps = [
"//base",
"//services/proxy_resolver/public/mojom",
"//services/service_manager/public/cpp",
"//services/strings",
]
}
// Copyright 2019 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 "services/proxy_resolver/public/cpp/manifest.h"
#include "base/no_destructor.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
#include "services/strings/grit/services_strings.h"
namespace proxy_resolver {
const service_manager::Manifest& GetManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.WithServiceName(mojom::kProxyResolverServiceName)
.WithDisplayName(IDS_PROXY_RESOLVER_DISPLAY_NAME)
.WithOptions(
service_manager::ManifestOptionsBuilder()
.WithExecutionMode(service_manager::Manifest::ExecutionMode::
kOutOfProcessBuiltin)
.WithInstanceSharingPolicy(
service_manager::Manifest::InstanceSharingPolicy::
kSharedAcrossGroups)
.Build())
.ExposeCapability("factory", service_manager::Manifest::InterfaceList<
mojom::ProxyResolverFactory>())
.Build()};
return *manifest;
}
} // namespace proxy_resolver
// Copyright 2019 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 SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MANIFEST_H_
#define SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
namespace proxy_resolver {
const service_manager::Manifest& GetManifest();
} // namespace proxy_resolver
#endif // SERVICES_PROXY_RESOLVER_PUBLIC_CPP_MANIFEST_H_
...@@ -10,8 +10,6 @@ module proxy_resolver.mojom; ...@@ -10,8 +10,6 @@ module proxy_resolver.mojom;
import "services/network/public/mojom/ip_address.mojom"; import "services/network/public/mojom/ip_address.mojom";
import "url/mojom/url.mojom"; import "url/mojom/url.mojom";
const string kProxyResolverServiceName = "proxy_resolver";
// Mirror of net::ProxyResolveDnsOperation. // Mirror of net::ProxyResolveDnsOperation.
enum HostResolveOperation { enum HostResolveOperation {
DNS_RESOLVE, DNS_RESOLVE,
......
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