OLD | NEW |
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/browser_shutdown.h" | 5 #include "chrome/browser/browser_shutdown.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 Time* g_shutdown_started = nullptr; | 76 Time* g_shutdown_started = nullptr; |
77 ShutdownType g_shutdown_type = NOT_VALID; | 77 ShutdownType g_shutdown_type = NOT_VALID; |
78 int g_shutdown_num_processes; | 78 int g_shutdown_num_processes; |
79 int g_shutdown_num_processes_slow; | 79 int g_shutdown_num_processes_slow; |
80 | 80 |
81 const char kShutdownMsFile[] = "chrome_shutdown_ms.txt"; | 81 const char kShutdownMsFile[] = "chrome_shutdown_ms.txt"; |
82 | 82 |
83 const char* ToShutdownTypeString(ShutdownType type) { | 83 const char* ToShutdownTypeString(ShutdownType type) { |
84 switch (type) { | 84 switch (type) { |
85 case NOT_VALID: | 85 case NOT_VALID: |
| 86 case SHUTDOWN_TYPE_MAX_VALUE: |
86 NOTREACHED(); | 87 NOTREACHED(); |
87 return ""; | 88 return ""; |
88 case WINDOW_CLOSE: | 89 case WINDOW_CLOSE: |
89 return "close"; | 90 return "close"; |
90 case BROWSER_EXIT: | 91 case BROWSER_EXIT: |
91 return "exit"; | 92 return "exit"; |
92 case END_SESSION: | 93 case END_SESSION: |
93 return "end"; | 94 return "end"; |
94 } | 95 } |
95 return ""; | 96 return ""; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 PrefService* prefs = g_browser_process->local_state(); | 321 PrefService* prefs = g_browser_process->local_state(); |
321 ShutdownType type = | 322 ShutdownType type = |
322 static_cast<ShutdownType>(prefs->GetInteger(prefs::kShutdownType)); | 323 static_cast<ShutdownType>(prefs->GetInteger(prefs::kShutdownType)); |
323 int num_procs = prefs->GetInteger(prefs::kShutdownNumProcesses); | 324 int num_procs = prefs->GetInteger(prefs::kShutdownNumProcesses); |
324 int num_procs_slow = prefs->GetInteger(prefs::kShutdownNumProcessesSlow); | 325 int num_procs_slow = prefs->GetInteger(prefs::kShutdownNumProcessesSlow); |
325 // clear the prefs immediately so we don't pick them up on a future run | 326 // clear the prefs immediately so we don't pick them up on a future run |
326 prefs->SetInteger(prefs::kShutdownType, NOT_VALID); | 327 prefs->SetInteger(prefs::kShutdownType, NOT_VALID); |
327 prefs->SetInteger(prefs::kShutdownNumProcesses, 0); | 328 prefs->SetInteger(prefs::kShutdownNumProcesses, 0); |
328 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 0); | 329 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 0); |
329 | 330 |
| 331 UMA_HISTOGRAM_ENUMERATION("Shutdown.ShutdownType", type, |
| 332 SHUTDOWN_TYPE_MAX_VALUE); |
| 333 |
330 // Read and delete the file on the file thread. | 334 // Read and delete the file on the file thread. |
331 BrowserThread::PostTask( | 335 BrowserThread::PostTask( |
332 BrowserThread::FILE, FROM_HERE, | 336 BrowserThread::FILE, FROM_HERE, |
333 base::Bind(&ReadLastShutdownFile, type, num_procs, num_procs_slow)); | 337 base::Bind(&ReadLastShutdownFile, type, num_procs, num_procs_slow)); |
334 } | 338 } |
335 | 339 |
336 void SetTryingToQuit(bool quitting) { | 340 void SetTryingToQuit(bool quitting) { |
337 g_trying_to_quit = quitting; | 341 g_trying_to_quit = quitting; |
338 | 342 |
339 if (quitting) | 343 if (quitting) |
(...skipping 26 matching lines...) Expand all Loading... |
366 base::trace_event::TraceConfig trace_config( | 370 base::trace_event::TraceConfig trace_config( |
367 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); | 371 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); |
368 content::TracingController::GetInstance()->StartTracing( | 372 content::TracingController::GetInstance()->StartTracing( |
369 trace_config, | 373 trace_config, |
370 content::TracingController::StartTracingDoneCallback()); | 374 content::TracingController::StartTracingDoneCallback()); |
371 } | 375 } |
372 TRACE_EVENT0("shutdown", "StartShutdownTracing"); | 376 TRACE_EVENT0("shutdown", "StartShutdownTracing"); |
373 } | 377 } |
374 | 378 |
375 } // namespace browser_shutdown | 379 } // namespace browser_shutdown |
OLD | NEW |