Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_crash_reporter_client.h" | 5 #include "chrome/app/chrome_crash_reporter_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 *version = PRODUCT_VERSION; | 275 *version = PRODUCT_VERSION; |
| 276 } | 276 } |
| 277 | 277 |
| 278 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { | 278 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { |
| 279 return base::FilePath(CrashUploadList::kReporterLogFilename); | 279 return base::FilePath(CrashUploadList::kReporterLogFilename); |
| 280 } | 280 } |
| 281 #endif | 281 #endif |
| 282 | 282 |
| 283 bool ChromeCrashReporterClient::GetCrashDumpLocation( | 283 bool ChromeCrashReporterClient::GetCrashDumpLocation( |
| 284 base::FilePath* crash_dir) { | 284 base::FilePath* crash_dir) { |
| 285 #if defined(OS_WIN) | |
| 286 // TODO(scottmg): Consider supporting --user-data-dir. See | |
| 287 // https://crbug.com/565446. | |
| 288 return chrome::GetDefaultCrashDumpLocation(crash_dir); | |
| 289 #else | |
| 290 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate | 285 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
| 291 // location to write breakpad crash dumps can be set. | 286 // location to write breakpad crash dumps can be set. |
| 292 scoped_ptr<base::Environment> env(base::Environment::Create()); | 287 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 293 std::string alternate_crash_dump_location; | 288 std::string alternate_crash_dump_location; |
| 294 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { | 289 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { |
| 295 base::FilePath crash_dumps_dir_path = | 290 base::FilePath crash_dumps_dir_path = |
| 296 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); | 291 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); |
| 292 | |
| 293 #if defined(OS_WIN) | |
| 294 // If this environment variable exists, then for the time being, | |
| 295 // short-circuit how it's handled on Windows. | |
| 296 *crash_dir = crash_dumps_dir_path; | |
|
scottmg
2016/04/04 19:22:02
Is this directory guaranteed to exist? PathService
Ken Russell (switch to Gerrit)
2016/04/04 20:26:44
Not currently guaranteed by this code, no.
The cu
scottmg
2016/04/04 21:04:58
I don't think PathService can be used, in general,
Ken Russell (switch to Gerrit)
2016/04/04 21:59:25
OK. Can we proceed with this change as written the
scottmg
2016/04/04 22:12:04
OK, lgtm with a comment saying why we need to (tel
| |
| 297 return true; | |
| 298 #else | |
| 297 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); | 299 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); |
| 300 #endif | |
| 298 } | 301 } |
| 299 | 302 |
| 303 #if defined(OS_WIN) | |
| 304 // TODO(scottmg): Consider supporting --user-data-dir. See | |
| 305 // https://crbug.com/565446. | |
| 306 return chrome::GetDefaultCrashDumpLocation(crash_dir); | |
| 307 #else | |
| 300 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); | 308 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); |
| 301 #endif | 309 #endif |
| 302 } | 310 } |
| 303 | 311 |
| 304 size_t ChromeCrashReporterClient::RegisterCrashKeys() { | 312 size_t ChromeCrashReporterClient::RegisterCrashKeys() { |
| 305 return crash_keys::RegisterChromeCrashKeys(); | 313 return crash_keys::RegisterChromeCrashKeys(); |
| 306 } | 314 } |
| 307 | 315 |
| 308 bool ChromeCrashReporterClient::IsRunningUnattended() { | 316 bool ChromeCrashReporterClient::IsRunningUnattended() { |
| 309 scoped_ptr<base::Environment> env(base::Environment::Create()); | 317 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 #endif | 353 #endif |
| 346 | 354 |
| 347 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 355 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 348 const std::string& process_type) { | 356 const std::string& process_type) { |
| 349 return process_type == switches::kRendererProcess || | 357 return process_type == switches::kRendererProcess || |
| 350 process_type == switches::kPluginProcess || | 358 process_type == switches::kPluginProcess || |
| 351 process_type == switches::kPpapiPluginProcess || | 359 process_type == switches::kPpapiPluginProcess || |
| 352 process_type == switches::kZygoteProcess || | 360 process_type == switches::kZygoteProcess || |
| 353 process_type == switches::kGpuProcess; | 361 process_type == switches::kGpuProcess; |
| 354 } | 362 } |
| OLD | NEW |