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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1028543002: Turn the utility process image decoder into a Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments. Created 5 years, 7 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 | « chrome/utility/DEPS ('k') | components/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 6b92765c242ba42799f61c81fc3c35829522738e..1439b0f33455eb44876a5eca83c906112b2a2473 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -14,6 +14,7 @@
#include "chrome/common/safe_browsing/zip_analyzer_results.h"
#include "chrome/utility/chrome_content_utility_ipc_whitelist.h"
#include "chrome/utility/utility_message_handler.h"
+#include "components/image_decoder/image_decoder_impl.h"
#include "content/public/child/image_decoder_utils.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_registry.h"
@@ -85,14 +86,6 @@ void FinishParseMediaMetadata(
#endif
#if !defined(OS_ANDROID)
-void CreateProxyResolverFactory(
- mojo::InterfaceRequest<net::interfaces::ProxyResolverFactory> request) {
- // MojoProxyResolverFactoryImpl is strongly bound to the Mojo message pipe it
- // is connected to. When that message pipe is closed, either explicitly on the
- // other end (in the browser process), or by a connection error, this object
- // will be destroyed.
- new net::MojoProxyResolverFactoryImpl(request.Pass());
-}
class ResourceUsageReporterImpl : public ResourceUsageReporter {
public:
@@ -116,12 +109,15 @@ class ResourceUsageReporterImpl : public ResourceUsageReporter {
mojo::StrongBinding<ResourceUsageReporter> binding_;
};
+#endif // OS_ANDROID
-void CreateResourceUsageReporter(
- mojo::InterfaceRequest<ResourceUsageReporter> request) {
- new ResourceUsageReporterImpl(request.Pass());
+template <class Interface, class Impl>
+void CreateMojoService(mojo::InterfaceRequest<Interface> request) {
+ // The Mojo service implementation is assumed to use a StrongBinding<>, which
+ // causes the implementation to be deleted automatically when the Mojo
+ // connection is closed.
+ new Impl(request.Pass());
}
-#endif // OS_ANDROID
} // namespace
@@ -222,10 +218,15 @@ void ChromeContentUtilityClient::RegisterMojoServices(
content::ServiceRegistry* registry) {
#if !defined(OS_ANDROID)
registry->AddService<net::interfaces::ProxyResolverFactory>(
- base::Bind(CreateProxyResolverFactory));
+ base::Bind(CreateMojoService<net::interfaces::ProxyResolverFactory,
+ net::MojoProxyResolverFactoryImpl>));
registry->AddService<ResourceUsageReporter>(
- base::Bind(CreateResourceUsageReporter));
+ base::Bind(CreateMojoService<ResourceUsageReporter,
+ ResourceUsageReporterImpl>));
#endif
+ registry->AddService<image_decoder::ImageDecoder>(base::Bind(
+ CreateMojoService<image_decoder::ImageDecoder,
+ image_decoder::ImageDecoderImpl>));
}
// static
« no previous file with comments | « chrome/utility/DEPS ('k') | components/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698