Commit fd162f77 authored by oshima@chromium.org's avatar oshima@chromium.org

Close notification windows while message loop is still active

Reset tooltip_controller explicitly so that timer stops at shutdown.
Use tray_ reference in SystemTrayDelegate instead of going through ash instance.
Make sure delegates doesn't access tray after the tray has been deleted.

BUG=104998
TEST=none

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=131902

Review URL: http://codereview.chromium.org/9968101

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132320 0039d316-1c4b-4281-b951-d872f2087c98
parent 422a5adc
......@@ -566,6 +566,7 @@ Shell::~Shell() {
// The system tray needs to be reset before all the windows are destroyed.
tray_.reset();
tray_delegate_.reset();
// Desroy secondary monitor's widgets before all the windows are destroyed.
monitor_controller_.reset();
......@@ -588,6 +589,7 @@ Shell::~Shell() {
window_cycle_controller_.reset();
event_client_.reset();
monitor_controller_.reset();
tooltip_controller_.reset();
// Launcher widget has a InputMethodBridge that references to
// input_method_filter_'s input_method_. So explicitly release launcher_
......
......@@ -625,22 +625,19 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
void UpdateClockType(PrefService* service) {
clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ?
base::k24HourClock : base::k12HourClock;
ash::ClockObserver* observer =
ash::Shell::GetInstance()->tray()->clock_observer();
ash::ClockObserver* observer = tray_->clock_observer();
if (observer)
observer->OnDateFormatChanged();
}
void NotifyRefreshClock() {
ash::ClockObserver* observer =
ash::Shell::GetInstance()->tray()->clock_observer();
ash::ClockObserver* observer = tray_->clock_observer();
if (observer)
observer->Refresh();
}
void NotifyRefreshNetwork() {
ash::NetworkObserver* observer =
ash::Shell::GetInstance()->tray()->network_observer();
ash::NetworkObserver* observer = tray_->network_observer();
if (observer) {
NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
ash::NetworkIconInfo info;
......@@ -652,15 +649,13 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
void NotifyRefreshBluetooth() {
ash::BluetoothObserver* observer =
ash::Shell::GetInstance()->tray()->bluetooth_observer();
ash::BluetoothObserver* observer = tray_->bluetooth_observer();
if (observer)
observer->OnBluetoothRefresh();
}
void NotifyRefreshIME() {
ash::IMEObserver* observer =
ash::Shell::GetInstance()->tray()->ime_observer();
ash::IMEObserver* observer = tray_->ime_observer();
if (observer)
observer->OnIMERefresh();
}
......@@ -688,20 +683,18 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Overridden from AudioHandler::VolumeObserver.
virtual void OnVolumeChanged() OVERRIDE {
float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f;
ash::Shell::GetInstance()->tray()->audio_observer()->
OnVolumeChanged(level);
tray_->audio_observer()->OnVolumeChanged(level);
}
// Overridden from PowerManagerClient::Observer.
virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE {
ash::Shell::GetInstance()->tray()->brightness_observer()->
tray_->brightness_observer()->
OnBrightnessChanged(static_cast<double>(level), user_initiated);
}
virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE {
power_supply_status_ = power_status;
ash::PowerStatusObserver* observer =
ash::Shell::GetInstance()->tray()->power_status_observer();
ash::PowerStatusObserver* observer = tray_->power_status_observer();
if (observer)
observer->OnPowerStatusChanged(power_status);
}
......@@ -754,8 +747,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
virtual void OnNetworkManagerChanged(NetworkLibrary* crosnet) OVERRIDE {
RefreshNetworkObserver(crosnet);
RefreshNetworkDeviceObserver(crosnet);
data_promo_notification_->ShowOptionalMobileDataPromoNotification(crosnet,
tray_, this);
data_promo_notification_->ShowOptionalMobileDataPromoNotification(
crosnet, tray_, this);
NotifyRefreshNetwork();
}
......@@ -781,8 +774,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
break;
}
case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
ash::UpdateObserver* observer =
ash::Shell::GetInstance()->tray()->update_observer();
ash::UpdateObserver* observer = tray_->update_observer();
if (observer)
observer->OnUpdateRecommended();
break;
......@@ -791,8 +783,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// This notification is also sent on login screen when user avatar
// is loaded from file.
if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) {
ash::UserObserver* observer =
ash::Shell::GetInstance()->tray()->user_observer();
ash::UserObserver* observer = tray_->user_observer();
if (observer)
observer->OnUserUpdate();
}
......@@ -808,7 +799,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
service->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo);
} else if (pref == prefs::kSpokenFeedbackEnabled) {
ash::AccessibilityObserver* observer =
ash::Shell::GetInstance()->tray()->accessibility_observer();
tray_->accessibility_observer();
if (observer) {
observer->OnAccessibilityModeChanged(
service->GetBoolean(prefs::kSpokenFeedbackEnabled),
......@@ -900,8 +891,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
search_key_mapped_to_ == input_method::kCapsLockKey)
id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SEARCH;
ash::CapsLockObserver* observer =
ash::Shell::GetInstance()->tray()->caps_lock_observer();
ash::CapsLockObserver* observer = tray_->caps_lock_observer();
if (observer)
observer->OnCapsLockChanged(enabled, id);
}
......
......@@ -6,9 +6,16 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
// static
void BrowserList::HandleAppExitingForPlatform() {
// Close All non browser windows now. Those includes notifications
// and windows created by Ash (launcher, background, etc).
g_browser_process->notification_ui_manager()->CancelAll();
// TODO(oshima): Close all non browser windows here while
// the message loop is still alive.
#if defined(OS_CHROMEOS)
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) {
......
......@@ -4441,51 +4441,6 @@
fun:_ZN15tracked_objects10ThreadData11TallyADeathERKNS_6BirthsEii
fun:_ZN15tracked_objects10ThreadData32TallyRunOnWorkerThreadIfTrackingEPKNS_6BirthsERKNS_11TrackedTimeES6_S6_
}
{
bug_104998a
Memcheck:Leak
fun:_Znw*
...
fun:_ZN16SiteInstanceImpl10GetProcessEv
...
fun:_ZN21RenderViewHostFactory6CreateEPN7content12SiteInstanceEPNS0_22RenderViewHostDelegate*SessionStorageNamespace*
fun:_ZN21RenderViewHostManager4InitEPN7content14BrowserContextEPNS0_12SiteInstanceEi
fun:_ZN15WebContentsImplC1EPN7content14BrowserContextEPNS0_12SiteInstance*SessionStorageNamespace*
fun:_ZN7content11WebContents6CreateEPNS_14BrowserContextEPNS_12SiteInstance*SessionStorageNamespace*
fun:_ZN11BalloonHost4InitEv
}
{
bug_104998c
Memcheck:Leak
fun:_Znw*
fun:_ZN20ChildProcessLauncherC1EbRKSt6vectorISt4pairISsSsESaIS2_EEiP11CommandLinePNS_6ClientE
fun:_ZN21RenderProcessHostImpl4InitEb
...
fun:_ZN21RenderViewHostManager14InitRenderView*
fun:_ZN21RenderViewHostManager8NavigateERKN7content19NavigationEntryImplE
fun:_ZN15WebContentsImpl15NavigateToEntryERKN7content19NavigationEntryImplENS0_20NavigationController10ReloadTypeE
fun:_ZN15WebContentsImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl9LoadEntryEPN7content19NavigationEntryImplE
fun:_ZN24NavigationControllerImpl7LoadURLERK4GURLRKN7content8ReferrerENS3_14PageTransitionERKSs
fun:_ZN11BalloonHost4InitEv
}
{
bug_104998d
Memcheck:Leak
fun:_Znw*
fun:_ZN21RenderProcessHostImpl4InitEb
...
fun:_ZN15WebContentsImpl32CreateRenderViewForRenderManager*
fun:_ZN21RenderViewHostManager14InitRenderView*
fun:_ZN21RenderViewHostManager8NavigateERKN7content19NavigationEntryImplE
fun:_ZN15WebContentsImpl15NavigateToEntryERKN7content19NavigationEntryImplENS0_20NavigationController10ReloadTypeE
fun:_ZN15WebContentsImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl9LoadEntryEPN7content19NavigationEntryImplE
fun:_ZN24NavigationControllerImpl7LoadURLERK4GURLRKN7content8ReferrerENS3_14PageTransitionERKSs
fun:_ZN11BalloonHost4InitEv
}
{
bug_105715
Memcheck:Uninitialized
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment