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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { 1717 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
1718 SetShelfAutoHideBehaviorFromPrefs(); 1718 SetShelfAutoHideBehaviorFromPrefs();
1719 SetShelfAlignmentFromPrefs(); 1719 SetShelfAlignmentFromPrefs();
1720 } 1720 }
1721 1721
1722 WebContents* ChromeLauncherController::GetLastActiveWebContents( 1722 WebContents* ChromeLauncherController::GetLastActiveWebContents(
1723 const std::string& app_id) { 1723 const std::string& app_id) {
1724 AppIDToWebContentsListMap::const_iterator i = 1724 AppIDToWebContentsListMap::iterator i =
1725 app_id_to_web_contents_list_.find(app_id); 1725 app_id_to_web_contents_list_.find(app_id);
1726 if (i == app_id_to_web_contents_list_.end()) 1726 if (i == app_id_to_web_contents_list_.end())
1727 return NULL; 1727 return NULL;
1728 DCHECK_GT(i->second.size(), 0u); 1728
1729 return *i->second.begin(); 1729 // There are many crash records (crbug.com/341250) which indicate that the
1730 // app_id_to_web_contents_list_ contains deleted content entries - so there
1731 // must be a way that the content does not get properly updated. To fix
1732 // M33 and M34 we filter out the invalid items here, but this should be
1733 // addressed by a later patch correctly. Looking at the code however, the
1734 // real culprit is possibly BrowserStatusMonitor::UpdateAppItemState which
1735 // does not call "UpdateAppState(.., APP_STATE_REMOVED)" because due to a
1736 // Browser::SwapTabContent operation it isn't able to get the browser. I
1737 // think that the real patch is to call anyway when APP_STATE_REMOVED is
1738 // requested, but for a backport that seems risky.
1739 WebContentsList* list = &i->second;
1740 while (!list->empty()) {
1741 WebContents* contents = *list->begin();
1742 if (chrome::FindBrowserWithWebContents(contents))
1743 return contents;
1744 list->erase(list->begin());
1745 // This might not be necessary, but since we do not know why the lists
1746 // diverged we also erase it since it cannot be correct either.
1747 web_contents_to_app_id_.erase(contents);
1748 }
1749 app_id_to_web_contents_list_.erase(app_id);
1750 return NULL;
1730 } 1751 }
1731 1752
1732 ash::ShelfID ChromeLauncherController::InsertAppLauncherItem( 1753 ash::ShelfID ChromeLauncherController::InsertAppLauncherItem(
1733 LauncherItemController* controller, 1754 LauncherItemController* controller,
1734 const std::string& app_id, 1755 const std::string& app_id,
1735 ash::ShelfItemStatus status, 1756 ash::ShelfItemStatus status,
1736 int index, 1757 int index,
1737 ash::ShelfItemType shelf_item_type) { 1758 ash::ShelfItemType shelf_item_type) {
1738 ash::ShelfID id = model_->next_id(); 1759 ash::ShelfID id = model_->next_id();
1739 CHECK(!HasItemController(id)); 1760 CHECK(!HasItemController(id));
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 } 2058 }
2038 2059
2039 void ChromeLauncherController::ReleaseProfile() { 2060 void ChromeLauncherController::ReleaseProfile() {
2040 if (app_sync_ui_state_) 2061 if (app_sync_ui_state_)
2041 app_sync_ui_state_->RemoveObserver(this); 2062 app_sync_ui_state_->RemoveObserver(this);
2042 2063
2043 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2064 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2044 2065
2045 pref_change_registrar_.RemoveAll(); 2066 pref_change_registrar_.RemoveAll();
2046 } 2067 }
OLDNEW
« 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