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

Unified Diff: chrome/browser/web_applications/update_shortcut_worker_win.cc

Issue 1038573002: Fixed thread-unsafe use of gfx::Image in app shortcut creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 8 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
Index: chrome/browser/web_applications/update_shortcut_worker_win.cc
diff --git a/chrome/browser/web_applications/update_shortcut_worker_win.cc b/chrome/browser/web_applications/update_shortcut_worker_win.cc
index 39d6ec0008bf856f1362e70e6678eec41280d7bc..528b60b7ac2090223e98f0a7ae0ab0a74ba7b1c1 100644
--- a/chrome/browser/web_applications/update_shortcut_worker_win.cc
+++ b/chrome/browser/web_applications/update_shortcut_worker_win.cc
@@ -39,10 +39,10 @@ UpdateShortcutWorker::UpdateShortcutWorker(WebContents* web_contents)
web_contents->GetBrowserContext())->GetPath()) {
extensions::TabHelper* extensions_tab_helper =
extensions::TabHelper::FromWebContents(web_contents);
- web_app::GetShortcutInfoForTab(web_contents_, &shortcut_info_);
+ shortcut_info_ = web_app::GetShortcutInfoForTab(web_contents_);
web_app::GetIconsInfo(extensions_tab_helper->web_app_info(),
&unprocessed_icons_);
- file_name_ = web_app::internals::GetSanitizedFileName(shortcut_info_.title);
+ file_name_ = web_app::internals::GetSanitizedFileName(shortcut_info_->title);
registrar_.Add(
this,
@@ -118,7 +118,7 @@ void UpdateShortcutWorker::DidDownloadFavicon(
if (!bitmap.isNull()) {
// Update icon with download image and update shortcut.
- shortcut_info_.favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap));
+ shortcut_info_->favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap));
extensions::TabHelper* extensions_tab_helper =
extensions::TabHelper::FromWebContents(web_contents_);
extensions_tab_helper->SetAppIcon(bitmap);
@@ -180,7 +180,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
base::FilePath web_app_path = web_app::GetWebAppDataDirectory(
- profile_path_, shortcut_info_.extension_id, shortcut_info_.url);
+ profile_path_, shortcut_info_->extension_id, shortcut_info_->url);
// Ensure web_app_path exists. web_app_path could be missing for a legacy
// shortcut created by Gears.
@@ -191,8 +191,9 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
}
base::FilePath icon_file =
- web_app::internals::GetIconFilePath(web_app_path, shortcut_info_.title);
- web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon, true);
+ web_app::internals::GetIconFilePath(web_app_path, shortcut_info_->title);
+ web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_->favicon,
+ true);
// Update existing shortcuts' description, icon and app id.
CheckExistingShortcuts();
@@ -200,17 +201,17 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
// Generates app id from web app url and profile path.
base::string16 app_id = ShellIntegration::GetAppModelIdForProfile(
base::UTF8ToWide(
- web_app::GenerateApplicationNameFromURL(shortcut_info_.url)),
+ web_app::GenerateApplicationNameFromURL(shortcut_info_->url)),
profile_path_);
// Sanitize description
- if (shortcut_info_.description.length() >= MAX_PATH)
- shortcut_info_.description.resize(MAX_PATH - 1);
+ if (shortcut_info_->description.length() >= MAX_PATH)
+ shortcut_info_->description.resize(MAX_PATH - 1);
for (size_t i = 0; i < shortcut_files_.size(); ++i) {
base::win::ShortcutProperties shortcut_properties;
shortcut_properties.set_target(shortcut_files_[i]);
- shortcut_properties.set_description(shortcut_info_.description);
+ shortcut_properties.set_description(shortcut_info_->description);
shortcut_properties.set_icon(icon_file, 0);
shortcut_properties.set_app_id(app_id);
base::win::CreateOrUpdateShortcutLink(
« no previous file with comments | « chrome/browser/web_applications/update_shortcut_worker_win.h ('k') | chrome/browser/web_applications/web_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698