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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "pdf/features.h" | 55 #include "pdf/features.h" |
56 #include "ppapi/features/features.h" | 56 #include "ppapi/features/features.h" |
57 #include "printing/features/features.h" | 57 #include "printing/features/features.h" |
58 #include "ui/base/material_design/material_design_controller.h" | 58 #include "ui/base/material_design/material_design_controller.h" |
59 #include "ui/base/resource/resource_bundle.h" | 59 #include "ui/base/resource/resource_bundle.h" |
60 #include "ui/base/ui_base_switches.h" | 60 #include "ui/base/ui_base_switches.h" |
61 | 61 |
62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
63 #include <atlbase.h> | 63 #include <atlbase.h> |
64 #include <malloc.h> | 64 #include <malloc.h> |
| 65 |
65 #include <algorithm> | 66 #include <algorithm> |
| 67 |
66 #include "base/debug/close_handle_hook_win.h" | 68 #include "base/debug/close_handle_hook_win.h" |
67 #include "chrome/browser/downgrade/user_data_downgrade.h" | 69 #include "chrome/browser/downgrade/user_data_downgrade.h" |
68 #include "chrome/child/v8_breakpad_support_win.h" | 70 #include "chrome/child/v8_breakpad_support_win.h" |
69 #include "chrome/common/child_process_logging.h" | 71 #include "chrome/common/child_process_logging.h" |
70 #include "components/crash/content/app/crashpad.h" | |
71 #include "sandbox/win/src/sandbox.h" | 72 #include "sandbox/win/src/sandbox.h" |
72 #include "ui/base/resource/resource_bundle_win.h" | 73 #include "ui/base/resource/resource_bundle_win.h" |
73 #endif | 74 #endif |
74 | 75 |
75 #if defined(OS_MACOSX) | 76 #if defined(OS_MACOSX) |
76 #include "base/mac/foundation_util.h" | 77 #include "base/mac/foundation_util.h" |
77 #include "chrome/app/chrome_main_mac.h" | 78 #include "chrome/app/chrome_main_mac.h" |
78 #include "chrome/browser/mac/relauncher.h" | 79 #include "chrome/browser/mac/relauncher.h" |
79 #include "chrome/browser/shell_integration.h" | 80 #include "chrome/browser/shell_integration.h" |
80 #include "chrome/common/mac/cfbundle_blocker.h" | 81 #include "chrome/common/mac/cfbundle_blocker.h" |
81 #include "components/crash/content/app/crashpad.h" | |
82 #include "components/crash/core/common/objc_zombie.h" | 82 #include "components/crash/core/common/objc_zombie.h" |
83 #include "ui/base/l10n/l10n_util_mac.h" | 83 #include "ui/base/l10n/l10n_util_mac.h" |
84 #endif | 84 #endif |
85 | 85 |
86 #if defined(OS_POSIX) | 86 #if defined(OS_POSIX) |
87 #include <locale.h> | 87 #include <locale.h> |
88 #include <signal.h> | 88 #include <signal.h> |
89 #include "chrome/app/chrome_crash_reporter_client.h" | 89 #include "chrome/app/chrome_crash_reporter_client.h" |
90 #endif | 90 #endif |
91 | 91 |
(...skipping 28 matching lines...) Expand all Loading... |
120 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 120 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
121 #include "components/crash/content/app/breakpad_linux.h" | 121 #include "components/crash/content/app/breakpad_linux.h" |
122 #endif | 122 #endif |
123 | 123 |
124 #if defined(OS_LINUX) | 124 #if defined(OS_LINUX) |
125 #include "base/environment.h" | 125 #include "base/environment.h" |
126 #endif | 126 #endif |
127 | 127 |
128 #if defined(OS_MACOSX) || defined(OS_WIN) | 128 #if defined(OS_MACOSX) || defined(OS_WIN) |
129 #include "chrome/browser/policy/policy_path_parser.h" | 129 #include "chrome/browser/policy/policy_path_parser.h" |
| 130 #include "components/crash/content/app/crashpad.h" |
130 #endif | 131 #endif |
131 | 132 |
132 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
133 #include "components/metrics/leak_detector/leak_detector.h" | 134 #include "components/metrics/leak_detector/leak_detector.h" |
134 #endif | 135 #endif |
135 | 136 |
136 #if !defined(DISABLE_NACL) | 137 #if !defined(DISABLE_NACL) |
137 #include "components/nacl/common/nacl_switches.h" | 138 #include "components/nacl/common/nacl_switches.h" |
138 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h" | 139 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h" |
139 #endif | 140 #endif |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 216 |
216 return false; | 217 return false; |
217 #else // NDEBUG | 218 #else // NDEBUG |
218 return true; | 219 return true; |
219 #endif | 220 #endif |
220 } | 221 } |
221 | 222 |
222 #endif // defined(OS_WIN) | 223 #endif // defined(OS_WIN) |
223 | 224 |
224 #if defined(OS_LINUX) | 225 #if defined(OS_LINUX) |
225 static void AdjustLinuxOOMScore(const std::string& process_type) { | 226 void AdjustLinuxOOMScore(const std::string& process_type) { |
226 // Browsers and zygotes should still be killable, but killed last. | 227 // Browsers and zygotes should still be killable, but killed last. |
227 const int kZygoteScore = 0; | 228 const int kZygoteScore = 0; |
228 // The minimum amount to bump a score by. This is large enough that | 229 // The minimum amount to bump a score by. This is large enough that |
229 // even if it's translated into the old values, it will still go up | 230 // even if it's translated into the old values, it will still go up |
230 // by at least one. | 231 // by at least one. |
231 const int kScoreBump = 100; | 232 const int kScoreBump = 100; |
232 // This is the lowest score that renderers and extensions start with | 233 // This is the lowest score that renderers and extensions start with |
233 // in the OomPriorityManager. | 234 // in the OomPriorityManager. |
234 const int kRendererScore = chrome::kLowestRendererOomScore; | 235 const int kRendererScore = chrome::kLowestRendererOomScore; |
235 // For "miscellaneous" things, we want them after renderers, | 236 // For "miscellaneous" things, we want them after renderers, |
(...skipping 28 matching lines...) Expand all Loading... |
264 } else if (process_type == switches::kRendererProcess) { | 265 } else if (process_type == switches::kRendererProcess) { |
265 LOG(WARNING) << "process type 'renderer' " | 266 LOG(WARNING) << "process type 'renderer' " |
266 << "should be created through the zygote."; | 267 << "should be created through the zygote."; |
267 // When debugging, this process type can end up being run directly, but | 268 // When debugging, this process type can end up being run directly, but |
268 // this isn't the typical path for assigning the OOM score for it. Still, | 269 // this isn't the typical path for assigning the OOM score for it. Still, |
269 // we want to assign a score that is somewhat representative for debugging. | 270 // we want to assign a score that is somewhat representative for debugging. |
270 score = kRendererScore; | 271 score = kRendererScore; |
271 } else { | 272 } else { |
272 NOTREACHED() << "Unknown process type"; | 273 NOTREACHED() << "Unknown process type"; |
273 } | 274 } |
| 275 // In the case of a 0 score, still try to adjust it. Most likely the score is |
| 276 // 0 already, but it may not be if this process inherited a higher score from |
| 277 // its parent process. |
274 if (score > -1) | 278 if (score > -1) |
275 base::AdjustOOMScore(base::GetCurrentProcId(), score); | 279 base::AdjustOOMScore(base::GetCurrentProcId(), score); |
276 } | 280 } |
277 #endif // defined(OS_LINUX) | 281 #endif // defined(OS_LINUX) |
278 | 282 |
279 // Returns true if this subprocess type needs the ResourceBundle initialized | 283 // Returns true if this subprocess type needs the ResourceBundle initialized |
280 // and resources loaded. | 284 // and resources loaded. |
281 bool SubprocessNeedsResourceBundle(const std::string& process_type) { | 285 bool SubprocessNeedsResourceBundle(const std::string& process_type) { |
282 return | 286 return |
283 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 287 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 case version_info::Channel::CANARY: | 1084 case version_info::Channel::CANARY: |
1081 return true; | 1085 return true; |
1082 case version_info::Channel::DEV: | 1086 case version_info::Channel::DEV: |
1083 case version_info::Channel::BETA: | 1087 case version_info::Channel::BETA: |
1084 case version_info::Channel::STABLE: | 1088 case version_info::Channel::STABLE: |
1085 default: | 1089 default: |
1086 // Don't enable instrumentation. | 1090 // Don't enable instrumentation. |
1087 return false; | 1091 return false; |
1088 } | 1092 } |
1089 } | 1093 } |
OLD | NEW |