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

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: Type converter arg change. Created 5 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
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 1c79cdf4e55c426c0faf53aad0c6919618e1a411..dc92538208f68e5ae59145528300dd02c0b41f84 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -21,6 +21,7 @@
#include "courgette/courgette.h"
#include "courgette/third_party/bsdiff.h"
#include "ipc/ipc_channel.h"
+#include "services/image_decoder/image_decoder_impl.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/zlib/google/zip.h"
@@ -78,16 +79,13 @@ 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());
+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
@@ -186,8 +184,11 @@ 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>));
#endif
+ registry->AddService<services::ImageDecoder>(base::Bind(
+ CreateMojoService<services::ImageDecoder, services::ImageDecoderImpl>));
}
// static

Powered by Google App Engine
This is Rietveld 408576698