| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // since we can't safely count the number of plugin processes from this | 58 // since we can't safely count the number of plugin processes from this |
| 59 // thread, and we'd really like to avoid anything which might add further | 59 // thread, and we'd really like to avoid anything which might add further |
| 60 // delays to shutdown time. | 60 // delays to shutdown time. |
| 61 shutdown_num_processes_ = static_cast<int>(RenderProcessHost::size()); | 61 shutdown_num_processes_ = static_cast<int>(RenderProcessHost::size()); |
| 62 shutdown_started_ = Time::Now(); | 62 shutdown_started_ = Time::Now(); |
| 63 | 63 |
| 64 // Call FastShutdown on all of the RenderProcessHosts. This will be | 64 // Call FastShutdown on all of the RenderProcessHosts. This will be |
| 65 // a no-op in some cases, so we still need to go through the normal | 65 // a no-op in some cases, so we still need to go through the normal |
| 66 // shutdown path for the ones that didn't exit here. | 66 // shutdown path for the ones that didn't exit here. |
| 67 shutdown_num_processes_slow_ = 0; | 67 shutdown_num_processes_slow_ = 0; |
| 68 size_t start_rph_size = RenderProcessHost::size(); |
| 68 for (RenderProcessHost::iterator hosts = RenderProcessHost::begin(); | 69 for (RenderProcessHost::iterator hosts = RenderProcessHost::begin(); |
| 69 hosts != RenderProcessHost::end(); | 70 hosts != RenderProcessHost::end(); |
| 70 ++hosts) { | 71 ++hosts) { |
| 71 RenderProcessHost* rph = hosts->second; | 72 RenderProcessHost* rph = hosts->second; |
| 72 if (!rph->FastShutdownIfPossible()) | 73 if (!rph->FastShutdownIfPossible()) |
| 73 // TODO(ojan): I think now that we deal with beforeunload/unload | 74 // TODO(ojan): I think now that we deal with beforeunload/unload |
| 74 // higher up, it's not possible to get here. Confirm this and change | 75 // higher up, it's not possible to get here. Confirm this and change |
| 75 // FastShutdownIfPossible to just be FastShutdown. | 76 // FastShutdownIfPossible to just be FastShutdown. |
| 76 shutdown_num_processes_slow_++; | 77 shutdown_num_processes_slow_++; |
| 78 // The number of RPHs should not have changed as the result of invoking |
| 79 // FastShutdownIfPossible. |
| 80 CHECK(start_rph_size == RenderProcessHost::size()); |
| 77 } | 81 } |
| 78 } | 82 } |
| 79 } | 83 } |
| 80 | 84 |
| 81 FilePath GetShutdownMsPath() { | 85 FilePath GetShutdownMsPath() { |
| 82 FilePath shutdown_ms_file; | 86 FilePath shutdown_ms_file; |
| 83 PathService::Get(base::DIR_TEMP, &shutdown_ms_file); | 87 PathService::Get(base::DIR_TEMP, &shutdown_ms_file); |
| 84 return shutdown_ms_file.AppendASCII(kShutdownMsFile); | 88 return shutdown_ms_file.AppendASCII(kShutdownMsFile); |
| 85 } | 89 } |
| 86 | 90 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 TimeDelta::FromMilliseconds(shutdown_ms)); | 204 TimeDelta::FromMilliseconds(shutdown_ms)); |
| 201 UMA_HISTOGRAM_TIMES(time_per.c_str(), | 205 UMA_HISTOGRAM_TIMES(time_per.c_str(), |
| 202 TimeDelta::FromMilliseconds(shutdown_ms / num_procs)); | 206 TimeDelta::FromMilliseconds(shutdown_ms / num_procs)); |
| 203 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.total", num_procs); | 207 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.total", num_procs); |
| 204 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.slow", num_procs_slow); | 208 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.slow", num_procs_slow); |
| 205 } | 209 } |
| 206 } | 210 } |
| 207 } | 211 } |
| 208 | 212 |
| 209 } // namespace browser_shutdown | 213 } // namespace browser_shutdown |
| OLD | NEW |