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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 1884543004: Android: Avoid linking with --gc-sections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « chrome/android/chrome_apk.gyp ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 #endif // !defined(OS_ANDROID) 73 #endif // !defined(OS_ANDROID)
74 74
75 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
76 // Whether chrome should send stop request to a session manager. 76 // Whether chrome should send stop request to a session manager.
77 bool g_send_stop_request_to_session_manager = false; 77 bool g_send_stop_request_to_session_manager = false;
78 #endif 78 #endif
79 79
80 } // namespace 80 } // namespace
81 81
82 #if !defined(OS_ANDROID)
82 void MarkAsCleanShutdown() { 83 void MarkAsCleanShutdown() {
83 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles() instead? 84 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles() instead?
84 for (auto* browser : *BrowserList::GetInstance()) 85 for (auto* browser : *BrowserList::GetInstance())
85 browser->profile()->SetExitType(Profile::EXIT_NORMAL); 86 browser->profile()->SetExitType(Profile::EXIT_NORMAL);
86 } 87 }
88 #endif
87 89
88 void AttemptExitInternal(bool try_to_quit_application) { 90 void AttemptExitInternal(bool try_to_quit_application) {
89 // On Mac, the platform-specific part handles setting this. 91 // On Mac, the platform-specific part handles setting this.
90 #if !defined(OS_MACOSX) 92 #if !defined(OS_MACOSX)
91 if (try_to_quit_application) 93 if (try_to_quit_application)
92 browser_shutdown::SetTryingToQuit(true); 94 browser_shutdown::SetTryingToQuit(true);
93 #endif 95 #endif
94 96
95 content::NotificationService::current()->Notify( 97 content::NotificationService::current()->Notify(
96 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 98 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 state->CommitPendingWrite(); 167 state->CommitPendingWrite();
166 } 168 }
167 } 169 }
168 g_send_stop_request_to_session_manager = true; 170 g_send_stop_request_to_session_manager = true;
169 // On ChromeOS, always terminate the browser, regardless of the result of 171 // On ChromeOS, always terminate the browser, regardless of the result of
170 // AreAllBrowsersCloseable(). See crbug.com/123107. 172 // AreAllBrowsersCloseable(). See crbug.com/123107.
171 chrome::NotifyAndTerminate(true); 173 chrome::NotifyAndTerminate(true);
172 #else 174 #else
173 // Reset the restart bit that might have been set in cancelled restart 175 // Reset the restart bit that might have been set in cancelled restart
174 // request. 176 // request.
177 #if !defined(OS_ANDROID)
175 UserManager::Hide(); 178 UserManager::Hide();
179 #endif
176 PrefService* pref_service = g_browser_process->local_state(); 180 PrefService* pref_service = g_browser_process->local_state();
177 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); 181 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false);
178 AttemptExitInternal(false); 182 AttemptExitInternal(false);
179 #endif 183 #endif // defined(OS_CHROMEOS)
180 } 184 }
181 185
182 // The Android implementation is in application_lifetime_android.cc 186 // The Android implementation is in application_lifetime_android.cc
183 #if !defined(OS_ANDROID) 187 #if !defined(OS_ANDROID)
184 void AttemptRestart() { 188 void AttemptRestart() {
185 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? 189 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
186 for (auto* browser : *BrowserList::GetInstance()) 190 for (auto* browser : *BrowserList::GetInstance())
187 content::BrowserContext::SaveSessionState(browser->profile()); 191 content::BrowserContext::SaveSessionState(browser->profile());
188 192
189 PrefService* pref_service = g_browser_process->local_state(); 193 PrefService* pref_service = g_browser_process->local_state();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void OnAppExiting() { 352 void OnAppExiting() {
349 static bool notified = false; 353 static bool notified = false;
350 if (notified) 354 if (notified)
351 return; 355 return;
352 notified = true; 356 notified = true;
353 HandleAppExitingForPlatform(); 357 HandleAppExitingForPlatform();
354 } 358 }
355 #endif // !defined(OS_ANDROID) 359 #endif // !defined(OS_ANDROID)
356 360
357 } // namespace chrome 361 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/android/chrome_apk.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698