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

Side by Side Diff: extensions/browser/image_loader.cc

Issue 2859933002: Use constexpr TaskTraits constructor in extensions. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/image_loader.h" 5 #include "extensions/browser/image_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 LoadImagesAsync(extension, info_list, callback); 259 LoadImagesAsync(extension, info_list, callback);
260 } 260 }
261 261
262 void ImageLoader::LoadImagesAsync( 262 void ImageLoader::LoadImagesAsync(
263 const Extension* extension, 263 const Extension* extension,
264 const std::vector<ImageRepresentation>& info_list, 264 const std::vector<ImageRepresentation>& info_list,
265 const ImageLoaderImageCallback& callback) { 265 const ImageLoaderImageCallback& callback) {
266 DCHECK_CURRENTLY_ON(BrowserThread::UI); 266 DCHECK_CURRENTLY_ON(BrowserThread::UI);
267 base::PostTaskWithTraitsAndReplyWithResult( 267 base::PostTaskWithTraitsAndReplyWithResult(
268 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 268 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
269 base::TaskPriority::USER_VISIBLE),
270 base::Bind(LoadImagesBlocking, info_list, 269 base::Bind(LoadImagesBlocking, info_list,
271 LoadResourceBitmaps(extension, info_list)), 270 LoadResourceBitmaps(extension, info_list)),
272 base::Bind(&ImageLoader::ReplyBack, weak_ptr_factory_.GetWeakPtr(), 271 base::Bind(&ImageLoader::ReplyBack, weak_ptr_factory_.GetWeakPtr(),
273 callback)); 272 callback));
274 } 273 }
275 274
276 void ImageLoader::LoadImageFamilyAsync( 275 void ImageLoader::LoadImageFamilyAsync(
277 const Extension* extension, 276 const Extension* extension,
278 const std::vector<ImageRepresentation>& info_list, 277 const std::vector<ImageRepresentation>& info_list,
279 const ImageLoaderImageFamilyCallback& callback) { 278 const ImageLoaderImageFamilyCallback& callback) {
280 DCHECK_CURRENTLY_ON(BrowserThread::UI); 279 DCHECK_CURRENTLY_ON(BrowserThread::UI);
281 base::PostTaskWithTraitsAndReplyWithResult( 280 base::PostTaskWithTraitsAndReplyWithResult(
282 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 281 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
283 base::TaskPriority::USER_VISIBLE),
284 base::Bind(LoadImagesBlocking, info_list, 282 base::Bind(LoadImagesBlocking, info_list,
285 LoadResourceBitmaps(extension, info_list)), 283 LoadResourceBitmaps(extension, info_list)),
286 base::Bind(&ImageLoader::ReplyBackWithImageFamily, 284 base::Bind(&ImageLoader::ReplyBackWithImageFamily,
287 weak_ptr_factory_.GetWeakPtr(), callback)); 285 weak_ptr_factory_.GetWeakPtr(), callback));
288 } 286 }
289 287
290 void ImageLoader::ReplyBack(const ImageLoaderImageCallback& callback, 288 void ImageLoader::ReplyBack(const ImageLoaderImageCallback& callback,
291 const std::vector<LoadResult>& load_result) { 289 const std::vector<LoadResult>& load_result) {
292 DCHECK_CURRENTLY_ON(BrowserThread::UI); 290 DCHECK_CURRENTLY_ON(BrowserThread::UI);
293 291
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 it != image_skia_map.end(); 335 it != image_skia_map.end();
338 ++it) { 336 ++it) {
339 it->second.MakeThreadSafe(); 337 it->second.MakeThreadSafe();
340 image_family.Add(it->second); 338 image_family.Add(it->second);
341 } 339 }
342 340
343 callback.Run(image_family); 341 callback.Run(image_family);
344 } 342 }
345 343
346 } // namespace extensions 344 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_protocols.cc ('k') | extensions/browser/updater/update_client_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698