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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 160803002: Fixing M33 and M34 stable blocker crash with InsertAppLauncherItem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index a0756249fed4534738aab15d45f12884ce4c92c4..06f07350778d8137bb3048e82b53dcdcccf40b6c 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -1721,12 +1721,34 @@ void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
WebContents* ChromeLauncherController::GetLastActiveWebContents(
const std::string& app_id) {
- AppIDToWebContentsListMap::const_iterator i =
+ AppIDToWebContentsListMap::iterator i =
app_id_to_web_contents_list_.find(app_id);
if (i == app_id_to_web_contents_list_.end())
return NULL;
- DCHECK_GT(i->second.size(), 0u);
- return *i->second.begin();
+
+ // There are many crash records (crbug.com/341250) which indicate that the
+ // app_id_to_web_contents_list_ contains deleted content entries - so there
+ // must be a way that the content does not get properly updated. To fix
+ // M33 and M34 we filter out the invalid items here, but this should be
+ // addressed by a later patch correctly. Looking at the code however, the
+ // real culprit is possibly BrowserStatusMonitor::UpdateAppItemState which
+ // does not call "UpdateAppState(.., APP_STATE_REMOVED)" because due to a
+ // Browser::SwapTabContent operation it isn't able to get the browser. I
+ // think that the real patch is to call anyway when APP_STATE_REMOVED is
+ // requested, but for a backport that seems risky.
+ while (true) {
+ if (!i->second.size()) {
James Cook 2014/02/12 19:23:29 I think this might be clearer if you stored i->sec
Mr4D (OOO till 08-26) 2014/02/12 20:39:03 Done!
+ app_id_to_web_contents_list_.erase(app_id);
+ return NULL;
+ }
+ WebContents* contents = *i->second.begin();
+ if (chrome::FindBrowserWithWebContents(contents))
+ return contents;
+ i->second.erase(i->second.begin());
+ // This might not be necessary, but since we do not know why the lists
+ // diverged we also erase it since it cannot be correct either.
+ web_contents_to_app_id_.erase(contents);
+ }
}
ash::ShelfID ChromeLauncherController::InsertAppLauncherItem(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698