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

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 while (true) {
1740 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!
1741 app_id_to_web_contents_list_.erase(app_id);
1742 return NULL;
1743 }
1744 WebContents* contents = *i->second.begin();
1745 if (chrome::FindBrowserWithWebContents(contents))
1746 return contents;
1747 i->second.erase(i->second.begin());
1748 // This might not be necessary, but since we do not know why the lists
1749 // diverged we also erase it since it cannot be correct either.
1750 web_contents_to_app_id_.erase(contents);
1751 }
1730 } 1752 }
1731 1753
1732 ash::ShelfID ChromeLauncherController::InsertAppLauncherItem( 1754 ash::ShelfID ChromeLauncherController::InsertAppLauncherItem(
1733 LauncherItemController* controller, 1755 LauncherItemController* controller,
1734 const std::string& app_id, 1756 const std::string& app_id,
1735 ash::ShelfItemStatus status, 1757 ash::ShelfItemStatus status,
1736 int index, 1758 int index,
1737 ash::ShelfItemType shelf_item_type) { 1759 ash::ShelfItemType shelf_item_type) {
1738 ash::ShelfID id = model_->next_id(); 1760 ash::ShelfID id = model_->next_id();
1739 CHECK(!HasItemController(id)); 1761 CHECK(!HasItemController(id));
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 } 2059 }
2038 2060
2039 void ChromeLauncherController::ReleaseProfile() { 2061 void ChromeLauncherController::ReleaseProfile() {
2040 if (app_sync_ui_state_) 2062 if (app_sync_ui_state_)
2041 app_sync_ui_state_->RemoveObserver(this); 2063 app_sync_ui_state_->RemoveObserver(this);
2042 2064
2043 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2065 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2044 2066
2045 pref_change_registrar_.RemoveAll(); 2067 pref_change_registrar_.RemoveAll();
2046 } 2068 }
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