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

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

Issue 830833002: Makes GetComponentExtensionResourceManager() thread-safe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 11 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 <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 int i = 0; 105 int i = 0;
106 for (std::vector<ImageLoader::ImageRepresentation>::const_iterator 106 for (std::vector<ImageLoader::ImageRepresentation>::const_iterator
107 it = info_list.begin(); 107 it = info_list.begin();
108 it != info_list.end(); 108 it != info_list.end();
109 ++it, ++i) { 109 ++it, ++i) {
110 DCHECK(it->resource.relative_path().empty() || 110 DCHECK(it->resource.relative_path().empty() ||
111 extension->path() == it->resource.extension_root()); 111 extension->path() == it->resource.extension_root());
112 112
113 int resource_id; 113 int resource_id;
114 if (extension->location() == Manifest::COMPONENT) { 114 if (extension->location() == Manifest::COMPONENT) {
115 extensions::ComponentExtensionResourceManager* manager = 115 const extensions::ComponentExtensionResourceManager* manager =
116 extensions::ExtensionsBrowserClient::Get()-> 116 extensions::ExtensionsBrowserClient::Get()
117 GetComponentExtensionResourceManager(); 117 ->GetComponentExtensionResourceManager();
118 if (manager && manager->IsComponentExtensionResource( 118 if (manager && manager->IsComponentExtensionResource(
119 extension->path(), it->resource.relative_path(), &resource_id)) { 119 extension->path(), it->resource.relative_path(), &resource_id)) {
120 LoadResourceOnUIThread(resource_id, &bitmaps[i]); 120 LoadResourceOnUIThread(resource_id, &bitmaps[i]);
121 } 121 }
122 } 122 }
123 } 123 }
124 return bitmaps; 124 return bitmaps;
125 } 125 }
126 126
127 } // namespace 127 } // namespace
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 it != image_skia_map.end(); 322 it != image_skia_map.end();
323 ++it) { 323 ++it) {
324 it->second.MakeThreadSafe(); 324 it->second.MakeThreadSafe();
325 image_family.Add(it->second); 325 image_family.Add(it->second);
326 } 326 }
327 327
328 callback.Run(image_family); 328 callback.Run(image_family);
329 } 329 }
330 330
331 } // namespace extensions 331 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698