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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_function_base.cc

Issue 482163002: Large wallpaper decoding in utility process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add space Created 6 years, 2 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 | « no previous file | chrome/browser/extensions/webstore_install_helper.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/extensions/wallpaper_function_base.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_function_base.h"
6 6
7 #include "base/synchronization/cancellation_flag.h" 7 #include "base/synchronization/cancellation_flag.h"
8 #include "chrome/browser/image_decoder.h" 8 #include "chrome/browser/image_decoder.h"
9 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 #include "chromeos/login/login_state.h" 10 #include "chromeos/login/login_state.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 void Start(const std::string& image_data) { 50 void Start(const std::string& image_data) {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
52 52
53 // This function can only be called after user login. It is fine to use 53 // This function can only be called after user login. It is fine to use
54 // unsafe image decoder here. Before user login, a robust jpeg decoder will 54 // unsafe image decoder here. Before user login, a robust jpeg decoder will
55 // be used. 55 // be used.
56 CHECK(chromeos::LoginState::Get()->IsUserLoggedIn()); 56 CHECK(chromeos::LoginState::Get()->IsUserLoggedIn());
57 unsafe_image_decoder_ = new ImageDecoder(this, image_data, 57 unsafe_image_decoder_ = new ImageDecoder(this, image_data,
58 ImageDecoder::DEFAULT_CODEC); 58 ImageDecoder::DEFAULT_CODEC);
59 unsafe_image_decoder_->set_shrink_to_fit(true);
60
59 scoped_refptr<base::MessageLoopProxy> task_runner = 61 scoped_refptr<base::MessageLoopProxy> task_runner =
60 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); 62 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
61 unsafe_image_decoder_->Start(task_runner); 63 unsafe_image_decoder_->Start(task_runner);
62 } 64 }
63 65
64 void Cancel() { 66 void Cancel() {
65 cancel_flag_.Set(); 67 cancel_flag_.Set();
66 } 68 }
67 69
68 virtual void OnImageDecoded(const ImageDecoder* decoder, 70 virtual void OnImageDecoded(const ImageDecoder* decoder,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 unsafe_wallpaper_decoder_ = NULL; 119 unsafe_wallpaper_decoder_ = NULL;
118 SetError(wallpaper_api_util::kCancelWallpaperMessage); 120 SetError(wallpaper_api_util::kCancelWallpaperMessage);
119 SendResponse(false); 121 SendResponse(false);
120 } 122 }
121 123
122 void WallpaperFunctionBase::OnFailure(const std::string& error) { 124 void WallpaperFunctionBase::OnFailure(const std::string& error) {
123 unsafe_wallpaper_decoder_ = NULL; 125 unsafe_wallpaper_decoder_ = NULL;
124 SetError(error); 126 SetError(error);
125 SendResponse(false); 127 SendResponse(false);
126 } 128 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/webstore_install_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698