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

Unified Diff: chrome/browser/image_decoder.h

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: Clean up and add test. Created 5 years, 9 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/browser/image_decoder.h
diff --git a/chrome/browser/image_decoder.h b/chrome/browser/image_decoder.h
index 2206dd9f454ebcbfc3a29674cf41e1d42eb594ee..fa9e7e10eaeafb47f4059a8c66f82e3767bb94f1 100644
--- a/chrome/browser/image_decoder.h
+++ b/chrome/browser/image_decoder.h
@@ -12,11 +12,13 @@
#include "base/memory/ref_counted.h"
#include "base/threading/sequenced_worker_pool.h"
#include "content/public/browser/utility_process_host_client.h"
+#include "services/image_decoder/public/interfaces/image_decoder.mojom.h"
class SkBitmap;
// Decodes an image in a sandboxed process.
-class ImageDecoder : public content::UtilityProcessHostClient {
+class ImageDecoder : public content::UtilityProcessHostClient,
+ public mojo::ErrorHandler {
public:
class Delegate {
public:
@@ -65,6 +67,9 @@ class ImageDecoder : public content::UtilityProcessHostClient {
// Overidden from UtilityProcessHostClient:
bool OnMessageReceived(const IPC::Message& message) override;
+ // Overidden from mojo::ErrorHandler:
+ void OnConnectionError() override;
+
// IPC message handlers.
void OnDecodeImageSucceeded(const SkBitmap& decoded_image);
void OnDecodeImageFailed();
@@ -72,11 +77,15 @@ class ImageDecoder : public content::UtilityProcessHostClient {
// Launches sandboxed process that will decode the image.
void DecodeImageInSandbox(const std::vector<unsigned char>& image_data);
+ // Mojo RPC callback.
+ void OnDecodeImageDone(bool success, skia::BitmapPtr image);
sky 2015/04/01 15:00:45 Do we need to distinguish between failure and an e
Anand Mistry (off Chromium) 2015/04/02 04:29:45 Done.
+
Delegate* delegate_;
std::vector<unsigned char> image_data_;
const ImageCodec image_codec_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- bool shrink_to_fit_; // if needed for IPC msg size limit
+ bool shrink_to_fit_; // if needed for IPC msg size limit
+ services::ImageDecoderPtr decoder_;
DISALLOW_COPY_AND_ASSIGN(ImageDecoder);
};

Powered by Google App Engine
This is Rietveld 408576698