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

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, 9 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 9c7ff744a0559deec46a278edecb3820feb2f574..d1a0b362e5836116511c750829a03ed3327adf4a 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,
@@ -117,7 +117,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);
@@ -179,7 +179,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.
@@ -190,8 +190,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();
@@ -199,17 +200,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(

Powered by Google App Engine
This is Rietveld 408576698