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

Side by Side Diff: chrome/browser/browser_shutdown.cc

Issue 6286131: Splits ChromeURLDataManager into 2 chunks:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser_shutdown.h" 5 #include "chrome/browser/browser_shutdown.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
20 #include "base/time.h" 20 #include "base/time.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/about_flags.h" 22 #include "chrome/browser/about_flags.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/browser_thread.h" 24 #include "chrome/browser/browser_thread.h"
25 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 25 #include "chrome/browser/dom_ui/chrome_url_data_manager_backend.h"
26 #include "chrome/browser/first_run/first_run.h" 26 #include "chrome/browser/first_run/first_run.h"
27 #include "chrome/browser/jankometer.h" 27 #include "chrome/browser/jankometer.h"
28 #include "chrome/browser/metrics/metrics_service.h" 28 #include "chrome/browser/metrics/metrics_service.h"
29 #include "chrome/browser/plugin_process_host.h" 29 #include "chrome/browser/plugin_process_host.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/profiles/profile_manager.h" 31 #include "chrome/browser/profiles/profile_manager.h"
32 #include "chrome/browser/renderer_host/render_process_host.h" 32 #include "chrome/browser/renderer_host/render_process_host.h"
33 #include "chrome/browser/renderer_host/render_view_host.h" 33 #include "chrome/browser/renderer_host/render_view_host.h"
34 #include "chrome/browser/renderer_host/render_widget_host.h" 34 #include "chrome/browser/renderer_host/render_widget_host.h"
35 #include "chrome/browser/service/service_process_control_manager.h" 35 #include "chrome/browser/service/service_process_control_manager.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 prefs->SavePersistentPrefs(); 168 prefs->SavePersistentPrefs();
169 169
170 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) 170 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
171 // Cleanup any statics created by RLZ. Must be done before NotificationService 171 // Cleanup any statics created by RLZ. Must be done before NotificationService
172 // is destroyed. 172 // is destroyed.
173 RLZTracker::CleanupRlz(); 173 RLZTracker::CleanupRlz();
174 #endif 174 #endif
175 175
176 // Deleting the IO thread deletes the ChromeURLDataManagerBackends and their
177 // DataSources. We need the DataSources to be released on the UI thread after
178 // the IO thread has been shutdown. PrepareForShutdown makes sure none of the
179 // existing DataSources are released on the IO thread.
180 ChromeURLDataManagerBackend::PrepareForShutdown();
181
176 // The jank'o'meter requires that the browser process has been destroyed 182 // The jank'o'meter requires that the browser process has been destroyed
177 // before calling UninstallJankometer(). 183 // before calling UninstallJankometer().
178 delete g_browser_process; 184 delete g_browser_process;
179 g_browser_process = NULL; 185 g_browser_process = NULL;
180 #if defined(OS_CHROMEOS) 186 #if defined(OS_CHROMEOS)
181 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted", 187 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted",
182 true); 188 true);
183 #endif 189 #endif
184 190
185 // Uninstall Jank-O-Meter here after the IO thread is no longer running. 191 // Uninstall Jank-O-Meter here after the IO thread is no longer running.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // and then write it to a file to be read at startup. 249 // and then write it to a file to be read at startup.
244 // We can't use prefs since all services are shutdown at this point. 250 // We can't use prefs since all services are shutdown at this point.
245 TimeDelta shutdown_delta = Time::Now() - shutdown_started_; 251 TimeDelta shutdown_delta = Time::Now() - shutdown_started_;
246 std::string shutdown_ms = 252 std::string shutdown_ms =
247 base::Int64ToString(shutdown_delta.InMilliseconds()); 253 base::Int64ToString(shutdown_delta.InMilliseconds());
248 int len = static_cast<int>(shutdown_ms.length()) + 1; 254 int len = static_cast<int>(shutdown_ms.length()) + 1;
249 FilePath shutdown_ms_file = GetShutdownMsPath(); 255 FilePath shutdown_ms_file = GetShutdownMsPath();
250 file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); 256 file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len);
251 } 257 }
252 258
253 UnregisterURLRequestChromeJob();
254
255 #if defined(OS_CHROMEOS) 259 #if defined(OS_CHROMEOS)
256 BrowserList::NotifyAndTerminate(false); 260 BrowserList::NotifyAndTerminate(false);
257 #endif 261 #endif
258 262
259 // Clean up data sources before the UI thread is removed. 263 // Finish the shutdown started in PrepareForShutdown.
260 ChromeURLDataManager* data_manager = ChromeURLDataManager::GetInstance(); 264 ChromeURLDataManagerBackend::CompleteShutdown();
261 if (data_manager)
262 data_manager->RemoveAllDataSources();
263 } 265 }
264 266
265 void ReadLastShutdownFile( 267 void ReadLastShutdownFile(
266 ShutdownType type, 268 ShutdownType type,
267 int num_procs, 269 int num_procs,
268 int num_procs_slow) { 270 int num_procs_slow) {
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
270 272
271 FilePath shutdown_ms_file = GetShutdownMsPath(); 273 FilePath shutdown_ms_file = GetShutdownMsPath();
272 std::string shutdown_ms_str; 274 std::string shutdown_ms_str;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 337
336 bool ShuttingDownWithoutClosingBrowsers() { 338 bool ShuttingDownWithoutClosingBrowsers() {
337 #if defined(USE_X11) 339 #if defined(USE_X11)
338 if (GetShutdownType() == browser_shutdown::END_SESSION) 340 if (GetShutdownType() == browser_shutdown::END_SESSION)
339 return true; 341 return true;
340 #endif 342 #endif
341 return false; 343 return false;
342 } 344 }
343 345
344 } // namespace browser_shutdown 346 } // namespace browser_shutdown
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698