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

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

Issue 9317074: Create an API around UtilityProcessHost and use that from chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 12
12 using content::BrowserThread; 13 using content::BrowserThread;
14 using content::UtilityProcessHost;
13 15
14 ImageDecoder::ImageDecoder(Delegate* delegate, 16 ImageDecoder::ImageDecoder(Delegate* delegate,
15 const std::string& image_data) 17 const std::string& image_data)
16 : delegate_(delegate), 18 : delegate_(delegate),
17 image_data_(image_data.begin(), image_data.end()), 19 image_data_(image_data.begin(), image_data.end()),
18 target_thread_id_(BrowserThread::UI) { 20 target_thread_id_(BrowserThread::UI) {
19 } 21 }
20 22
21 ImageDecoder::~ImageDecoder() {} 23 ImageDecoder::~ImageDecoder() {}
22 24
(...skipping 27 matching lines...) Expand all
50 52
51 void ImageDecoder::OnDecodeImageFailed() { 53 void ImageDecoder::OnDecodeImageFailed() {
52 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_)); 54 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_));
53 if (delegate_) 55 if (delegate_)
54 delegate_->OnDecodeImageFailed(this); 56 delegate_->OnDecodeImageFailed(this);
55 } 57 }
56 58
57 void ImageDecoder::DecodeImageInSandbox( 59 void ImageDecoder::DecodeImageInSandbox(
58 const std::vector<unsigned char>& image_data) { 60 const std::vector<unsigned char>& image_data) {
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
60 UtilityProcessHost* utility_process_host = 62 UtilityProcessHost* utility_process_host = UtilityProcessHost::Create(
61 new UtilityProcessHost(this, 63 this, target_thread_id_);
62 target_thread_id_); 64 utility_process_host->EnableZygote();
63 utility_process_host->set_use_linux_zygote(true);
64 utility_process_host->Send(new ChromeUtilityMsg_DecodeImage(image_data)); 65 utility_process_host->Send(new ChromeUtilityMsg_DecodeImage(image_data));
65 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/image_decoder.h ('k') | chrome/browser/importer/external_process_importer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698