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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 931993002: Make image_decoder a Leaky LazyInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a few comments 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
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/extensions/extensions_handler.h » ('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 5d5dbfd7c30f8d6393af652fce1daff4e98a6e95..1c79cdf4e55c426c0faf53aad0c6919618e1a411 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -238,20 +238,25 @@ SkBitmap ChromeContentUtilityClient::DecodeImage(
// static
void ChromeContentUtilityClient::DecodeImageAndSend(
- const std::vector<unsigned char>& encoded_data, bool shrink_to_fit){
+ const std::vector<unsigned char>& encoded_data,
+ bool shrink_to_fit,
+ int request_id) {
SkBitmap decoded_image = DecodeImage(encoded_data, shrink_to_fit);
if (decoded_image.empty()) {
- Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
} else {
- Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image));
+ Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image,
+ request_id));
}
ReleaseProcessIfNeeded();
}
void ChromeContentUtilityClient::OnDecodeImage(
- const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) {
- DecodeImageAndSend(encoded_data, shrink_to_fit);
+ const std::vector<unsigned char>& encoded_data,
+ bool shrink_to_fit,
+ int request_id) {
+ DecodeImageAndSend(encoded_data, shrink_to_fit, request_id);
}
#if defined(OS_CHROMEOS)
@@ -303,19 +308,21 @@ void ChromeContentUtilityClient::OnDetectSeccompSupport() {
#endif // defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
- const std::vector<unsigned char>& encoded_data) {
+ const std::vector<unsigned char>& encoded_data,
+ int request_id) {
// Our robust jpeg decoding is using IJG libjpeg.
if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG &&
!encoded_data.empty()) {
scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
&encoded_data[0], encoded_data.size()));
if (!decoded_image.get() || decoded_image->empty()) {
- Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
} else {
- Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image));
+ Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image,
+ request_id));
}
} else {
- Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
}
ReleaseProcessIfNeeded();
}
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/extensions/extensions_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698