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

Side by Side Diff: chrome/browser/image_decoder.cc

Issue 600913002: Revert of Large wallpaper decoding in utility process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/image_decoder.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/image_decoder.h" 5 #include "chrome/browser/image_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/common/chrome_utility_messages.h" 9 #include "chrome/common/chrome_utility_messages.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/utility_process_host.h" 11 #include "content/public/browser/utility_process_host.h"
12 12
13 using content::BrowserThread; 13 using content::BrowserThread;
14 using content::UtilityProcessHost; 14 using content::UtilityProcessHost;
15 15
16 ImageDecoder::ImageDecoder(Delegate* delegate, 16 ImageDecoder::ImageDecoder(Delegate* delegate,
17 const std::string& image_data, 17 const std::string& image_data,
18 ImageCodec image_codec) 18 ImageCodec image_codec)
19 : delegate_(delegate), 19 : delegate_(delegate),
20 image_data_(image_data.begin(), image_data.end()), 20 image_data_(image_data.begin(), image_data.end()),
21 image_codec_(image_codec), 21 image_codec_(image_codec),
22 task_runner_(NULL), 22 task_runner_(NULL) {
23 shrink_to_fit_(false) {
24 } 23 }
25 24
26 ImageDecoder::~ImageDecoder() {} 25 ImageDecoder::~ImageDecoder() {}
27 26
28 void ImageDecoder::Start(scoped_refptr<base::SequencedTaskRunner> task_runner) { 27 void ImageDecoder::Start(scoped_refptr<base::SequencedTaskRunner> task_runner) {
29 task_runner_ = task_runner; 28 task_runner_ = task_runner;
30 BrowserThread::PostTask( 29 BrowserThread::PostTask(
31 BrowserThread::IO, FROM_HERE, 30 BrowserThread::IO, FROM_HERE,
32 base::Bind(&ImageDecoder::DecodeImageInSandbox, this, image_data_)); 31 base::Bind(&ImageDecoder::DecodeImageInSandbox, this, image_data_));
33 } 32 }
(...skipping 24 matching lines...) Expand all
58 57
59 void ImageDecoder::DecodeImageInSandbox( 58 void ImageDecoder::DecodeImageInSandbox(
60 const std::vector<unsigned char>& image_data) { 59 const std::vector<unsigned char>& image_data) {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
62 UtilityProcessHost* utility_process_host; 61 UtilityProcessHost* utility_process_host;
63 utility_process_host = UtilityProcessHost::Create(this, task_runner_.get()); 62 utility_process_host = UtilityProcessHost::Create(this, task_runner_.get());
64 if (image_codec_ == ROBUST_JPEG_CODEC) { 63 if (image_codec_ == ROBUST_JPEG_CODEC) {
65 utility_process_host->Send( 64 utility_process_host->Send(
66 new ChromeUtilityMsg_RobustJPEGDecodeImage(image_data)); 65 new ChromeUtilityMsg_RobustJPEGDecodeImage(image_data));
67 } else { 66 } else {
68 utility_process_host->Send( 67 utility_process_host->Send(new ChromeUtilityMsg_DecodeImage(image_data));
69 new ChromeUtilityMsg_DecodeImage(image_data, shrink_to_fit_));
70 } 68 }
71 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/image_decoder.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698