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

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

Issue 2703283005: Destroy web_app::ShortcutInfo on UI thread (Closed)
Patch Set: s/auto/web_app::ShortcutInfo/. +Unretained. 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
Index: chrome/browser/web_applications/web_app_win.cc
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index 467217fd737637a1158285a4adfe603c4e73abd6..75761db2ffa372e586d6b8dd17b8a52e0dba7eeb 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -336,11 +336,10 @@ void GetShortcutLocationsAndDeleteShortcuts(
}
}
-void CreateIconAndSetRelaunchDetails(
- const base::FilePath& web_app_path,
- const base::FilePath& icon_file,
- std::unique_ptr<web_app::ShortcutInfo> shortcut_info,
- HWND hwnd) {
+void CreateIconAndSetRelaunchDetails(const base::FilePath& web_app_path,
+ const base::FilePath& icon_file,
+ web_app::ShortcutInfo* shortcut_info,
+ HWND hwnd) {
DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
base::CommandLine command_line =
@@ -376,9 +375,13 @@ void OnShortcutInfoLoadedForSetRelaunchDetails(
shortcut_info->url);
base::FilePath icon_file =
web_app::internals::GetIconFilePath(web_app_path, shortcut_info->title);
- content::BrowserThread::PostBlockingPoolTask(
- FROM_HERE, base::Bind(&CreateIconAndSetRelaunchDetails, web_app_path,
- icon_file, base::Passed(&shortcut_info), hwnd));
+ web_app::ShortcutInfo* shortcut_info_ptr = shortcut_info.get();
+ content::BrowserThread::PostBlockingPoolTaskAndReply(
+ FROM_HERE,
+ base::Bind(&CreateIconAndSetRelaunchDetails, web_app_path, icon_file,
+ base::Unretained(shortcut_info_ptr), hwnd),
+ base::Bind(&web_app::internals::DeleteShortcutInfoOnUIThread,
+ base::Passed(&shortcut_info), base::Closure()));
}
} // namespace
@@ -442,11 +445,10 @@ bool CheckAndSaveIcon(const base::FilePath& icon_file,
return true;
}
-bool CreatePlatformShortcuts(
- const base::FilePath& web_app_path,
- std::unique_ptr<ShortcutInfo> shortcut_info,
- const ShortcutLocations& creation_locations,
- ShortcutCreationReason creation_reason) {
+bool CreatePlatformShortcuts(const base::FilePath& web_app_path,
+ ShortcutInfo* shortcut_info,
+ const ShortcutLocations& creation_locations,
+ ShortcutCreationReason creation_reason) {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
// Nothing to do on Windows for hidden apps.
@@ -489,7 +491,7 @@ bool CreatePlatformShortcuts(
void UpdatePlatformShortcuts(const base::FilePath& web_app_path,
const base::string16& old_app_title,
- std::unique_ptr<ShortcutInfo> shortcut_info) {
+ ShortcutInfo* shortcut_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
// Generates file name to use with persisted ico and shortcut file.
@@ -527,7 +529,7 @@ void UpdatePlatformShortcuts(const base::FilePath& web_app_path,
}
void DeletePlatformShortcuts(const base::FilePath& web_app_path,
- std::unique_ptr<ShortcutInfo> shortcut_info) {
+ ShortcutInfo* shortcut_info) {
GetShortcutLocationsAndDeleteShortcuts(web_app_path,
shortcut_info->profile_path,
shortcut_info->title, NULL, NULL);
« chrome/browser/web_applications/web_app.cc ('K') | « chrome/browser/web_applications/web_app_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698