| OLD | NEW |
| 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_child_process_host.h" | 5 #include "chrome/browser/browser_child_process_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 13 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 14 #include "base/stl_util-inl.h" | 14 #include "base/stl_util-inl.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome/app/breakpad_mac.h" | 16 #include "chrome/app/breakpad_mac.h" |
| 17 #include "chrome/browser/browser_process.h" | |
| 18 #include "chrome/browser/chrome_thread.h" | 17 #include "chrome/browser/chrome_thread.h" |
| 19 #include "chrome/browser/pref_service.h" | 18 #include "chrome/browser/pref_service.h" |
| 19 #include "chrome/common/child_process_logging.h" |
| 20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/chrome_paths_internal.h" | 21 #include "chrome/common/chrome_paths_internal.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
| 24 #include "chrome/common/plugin_messages.h" | 24 #include "chrome/common/plugin_messages.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/process_watcher.h" | 26 #include "chrome/common/process_watcher.h" |
| 27 #include "chrome/common/result_codes.h" | 27 #include "chrome/common/result_codes.h" |
| 28 #include "chrome/installer/util/google_update_settings.h" | 28 #include "chrome/installer/util/google_update_settings.h" |
| 29 | 29 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 if (resource_dispatcher_host_) | 73 if (resource_dispatcher_host_) |
| 74 resource_dispatcher_host_->CancelRequestsForProcess(id()); | 74 resource_dispatcher_host_->CancelRequestsForProcess(id()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // static | 77 // static |
| 78 void BrowserChildProcessHost::SetCrashReporterCommandLine( | 78 void BrowserChildProcessHost::SetCrashReporterCommandLine( |
| 79 CommandLine* command_line) { | 79 CommandLine* command_line) { |
| 80 #if defined(USE_LINUX_BREAKPAD) | 80 #if defined(USE_LINUX_BREAKPAD) |
| 81 if (IsCrashReporterEnabled()) { | 81 if (IsCrashReporterEnabled()) { |
| 82 std::string client_id = | |
| 83 g_browser_process->local_state()->GetString(prefs::kMetricsClientID); | |
| 84 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, | 82 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, |
| 85 client_id + "," + base::GetLinuxDistro()); | 83 child_process_logging::GetClientId() + "," + base::GetLinuxDistro()); |
| 86 } | 84 } |
| 87 #elif defined(OS_MACOSX) | 85 #elif defined(OS_MACOSX) |
| 88 if (IsCrashReporterEnabled()) { | 86 if (IsCrashReporterEnabled()) { |
| 89 std::string client_id = | 87 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, |
| 90 g_browser_process->local_state()->GetString(prefs::kMetricsClientID); | 88 child_process_logging::GetClientId()); |
| 91 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, client_id); | |
| 92 } | 89 } |
| 93 #endif // OS_MACOSX | 90 #endif // OS_MACOSX |
| 94 } | 91 } |
| 95 | 92 |
| 96 // static | 93 // static |
| 97 void BrowserChildProcessHost::TerminateAll() { | 94 void BrowserChildProcessHost::TerminateAll() { |
| 98 // Make a copy since the ChildProcessHost dtor mutates the original list. | 95 // Make a copy since the ChildProcessHost dtor mutates the original list. |
| 99 ChildProcessList copy = *(Singleton<ChildProcessList>::get()); | 96 ChildProcessList copy = *(Singleton<ChildProcessList>::get()); |
| 100 STLDeleteElements(©); | 97 STLDeleteElements(©); |
| 101 } | 98 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 208 |
| 212 return *iterator_; | 209 return *iterator_; |
| 213 } while (true); | 210 } while (true); |
| 214 | 211 |
| 215 return NULL; | 212 return NULL; |
| 216 } | 213 } |
| 217 | 214 |
| 218 bool BrowserChildProcessHost::Iterator::Done() { | 215 bool BrowserChildProcessHost::Iterator::Done() { |
| 219 return iterator_ == Singleton<ChildProcessList>::get()->end(); | 216 return iterator_ == Singleton<ChildProcessList>::get()->end(); |
| 220 } | 217 } |
| OLD | NEW |