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

Unified Diff: ui/base/resource/resource_bundle_ios.mm

Issue 2699323002: Restrict cross-thread access to gfx::Image and gfx::Font in ResourceBundle (Closed)
Patch Set: rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle_ios.mm
diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm
index 6ffb68754d951fbf4d553b23602034f41d42b930..a2e9295d9b02e95a2134e8570453b2b9f439b5e9 100644
--- a/ui/base/resource/resource_bundle_ios.mm
+++ b/ui/base/resource/resource_bundle_ios.mm
@@ -90,13 +90,12 @@ base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale,
}
gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
+ DCHECK(sequence_checker_.CalledOnValidSequence());
+
// Check to see if the image is already in the cache.
- {
- base::AutoLock lock(*images_and_fonts_lock_);
- ImageMap::iterator found = images_.find(resource_id);
- if (found != images_.end()) {
- return found->second;
- }
+ ImageMap::iterator found = images_.find(resource_id);
+ if (found != images_.end()) {
+ return found->second;
}
gfx::Image image;
@@ -166,7 +165,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
image = gfx::Image(ui_image, base::scoped_policy::RETAIN);
}
- base::AutoLock lock(*images_and_fonts_lock_);
+ DCHECK(sequence_checker_.CalledOnValidSequence());
// Another thread raced the load and has already cached the image.
if (images_.count(resource_id))
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698