| 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. Honoring this |
| 296 // variable is required in order to symbolize stack traces in |
| 297 // Telemetry based tests: http://crbug.com/561763. |
| 298 *crash_dir = crash_dumps_dir_path; |
| 299 return true; |
| 300 #else |
| 297 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); | 301 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); |
| 302 #endif |
| 298 } | 303 } |
| 299 | 304 |
| 305 #if defined(OS_WIN) |
| 306 // TODO(scottmg): Consider supporting --user-data-dir. See |
| 307 // https://crbug.com/565446. |
| 308 return chrome::GetDefaultCrashDumpLocation(crash_dir); |
| 309 #else |
| 300 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); | 310 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); |
| 301 #endif | 311 #endif |
| 302 } | 312 } |
| 303 | 313 |
| 304 size_t ChromeCrashReporterClient::RegisterCrashKeys() { | 314 size_t ChromeCrashReporterClient::RegisterCrashKeys() { |
| 305 return crash_keys::RegisterChromeCrashKeys(); | 315 return crash_keys::RegisterChromeCrashKeys(); |
| 306 } | 316 } |
| 307 | 317 |
| 308 bool ChromeCrashReporterClient::IsRunningUnattended() { | 318 bool ChromeCrashReporterClient::IsRunningUnattended() { |
| 309 scoped_ptr<base::Environment> env(base::Environment::Create()); | 319 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 #endif | 355 #endif |
| 346 | 356 |
| 347 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 357 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 348 const std::string& process_type) { | 358 const std::string& process_type) { |
| 349 return process_type == switches::kRendererProcess || | 359 return process_type == switches::kRendererProcess || |
| 350 process_type == switches::kPluginProcess || | 360 process_type == switches::kPluginProcess || |
| 351 process_type == switches::kPpapiPluginProcess || | 361 process_type == switches::kPpapiPluginProcess || |
| 352 process_type == switches::kZygoteProcess || | 362 process_type == switches::kZygoteProcess || |
| 353 process_type == switches::kGpuProcess; | 363 process_type == switches::kGpuProcess; |
| 354 } | 364 } |
| OLD | NEW |