| OLD | NEW |
| 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/profiles/profile_info_cache.h" | 5 #include "chrome/browser/profiles/profile_info_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 gfx::Image image = gfx::Image::CreateFrom1xPNGBytes( | 116 gfx::Image image = gfx::Image::CreateFrom1xPNGBytes( |
| 117 base::RefCountedString::TakeString(&image_data)); | 117 base::RefCountedString::TakeString(&image_data)); |
| 118 if (image.IsEmpty()) { | 118 if (image.IsEmpty()) { |
| 119 LOG(ERROR) << "Failed to decode PNG file."; | 119 LOG(ERROR) << "Failed to decode PNG file."; |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 *out_image = new gfx::Image(image); | 123 *out_image = new gfx::Image(image); |
| 124 |
| 125 // As the image is going to be sent back to the calling thread, detach it from |
| 126 // this thread. |
| 127 (*out_image)->DetachFromThread(); |
| 124 } | 128 } |
| 125 | 129 |
| 126 void RunCallbackIfFileMissing(const base::FilePath& file_path, | 130 void RunCallbackIfFileMissing(const base::FilePath& file_path, |
| 127 const base::Closure& callback) { | 131 const base::Closure& callback) { |
| 128 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 132 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 129 if (!base::PathExists(file_path)) | 133 if (!base::PathExists(file_path)) |
| 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); | 134 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); |
| 131 } | 135 } |
| 132 | 136 |
| 133 void DeleteBitmap(const base::FilePath& image_path) { | 137 void DeleteBitmap(const base::FilePath& image_path) { |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 if (!current_entry) { | 1151 if (!current_entry) { |
| 1148 // The profile info is in the cache but its entry isn't created yet, insert | 1152 // The profile info is in the cache but its entry isn't created yet, insert |
| 1149 // it in the map. | 1153 // it in the map. |
| 1150 current_entry.reset(new ProfileAttributesEntry()); | 1154 current_entry.reset(new ProfileAttributesEntry()); |
| 1151 current_entry->Initialize(this, path); | 1155 current_entry->Initialize(this, path); |
| 1152 } | 1156 } |
| 1153 | 1157 |
| 1154 *entry = current_entry.get(); | 1158 *entry = current_entry.get(); |
| 1155 return true; | 1159 return true; |
| 1156 } | 1160 } |
| OLD | NEW |