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

Side by Side Diff: chrome/browser/chromeos/login/user_image_loader.cc

Issue 10820049: Load 2x resources on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comment Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wallpaper_manager.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 (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/chromeos/login/user_image_loader.h" 5 #include "chrome/browser/chromeos/login/user_image_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Also downsize the image to save space and memory. 85 // Also downsize the image to save space and memory.
86 final_image = 86 final_image =
87 skia::ImageOperations::Resize(cropped_image, 87 skia::ImageOperations::Resize(cropped_image,
88 skia::ImageOperations::RESIZE_LANCZOS3, 88 skia::ImageOperations::RESIZE_LANCZOS3,
89 image_info.size, 89 image_info.size,
90 image_info.size); 90 image_info.size);
91 } else { 91 } else {
92 final_image = cropped_image; 92 final_image = cropped_image;
93 } 93 }
94 } 94 }
95 95 gfx::ImageSkia final_image_skia(final_image);
96 final_image_skia.MakeThreadSafe();
96 target_message_loop_->PostTask( 97 target_message_loop_->PostTask(
97 FROM_HERE, 98 FROM_HERE,
98 base::Bind(image_info.loaded_cb, 99 base::Bind(image_info.loaded_cb,
99 UserImage(final_image, decoder->get_image_data()))); 100 UserImage(final_image_skia, decoder->get_image_data())));
100 101
101 image_info_map_.erase(info_it); 102 image_info_map_.erase(info_it);
102 } 103 }
103 104
104 void UserImageLoader::OnDecodeImageFailed(const ImageDecoder* decoder) { 105 void UserImageLoader::OnDecodeImageFailed(const ImageDecoder* decoder) {
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
106 image_info_map_.erase(decoder); 107 image_info_map_.erase(decoder);
107 } 108 }
108 109
109 } // namespace chromeos 110 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698