summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 08:09:32 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 08:09:32 +0000
commit8ab19f698d84afb4ec3549f79366c0c1cb0aaeae (patch)
treeeda9a3af5aee6ecf72af053ca74a8bdb73a71e3c
parented8f4eb15489241616e8e7374731c203bc3a02f3 (diff)
downloadchromium_src-8ab19f698d84afb4ec3549f79366c0c1cb0aaeae.zip
chromium_src-8ab19f698d84afb4ec3549f79366c0c1cb0aaeae.tar.gz
chromium_src-8ab19f698d84afb4ec3549f79366c0c1cb0aaeae.tar.bz2
Remove dependency from breakpad files on chrome switches.
BUG=247431 R=mark@chromium.org Review URL: https://codereview.chromium.org/19556005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212276 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base_switches.cc8
-rw-r--r--base/base_switches.h6
-rw-r--r--chrome/app/breakpad_linux.cc3
-rw-r--r--chrome/app/breakpad_mac.mm2
-rw-r--r--chrome/app/breakpad_win.cc40
-rw-r--r--chrome/app/chrome_breakpad_client.cc41
-rw-r--r--chrome/app/chrome_breakpad_client.h4
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--components/breakpad/breakpad_client.cc6
-rw-r--r--components/breakpad/breakpad_client.h10
11 files changed, 86 insertions, 41 deletions
diff --git a/base/base_switches.cc b/base/base_switches.cc
index f0ac32b..bdd7b62 100644
--- a/base/base_switches.cc
+++ b/base/base_switches.cc
@@ -49,4 +49,12 @@ const char kWaitForDebugger[] = "wait-for-debugger";
// Sends a pretty-printed version of tracing info to the console.
const char kTraceToConsole[] = "trace-to-console";
+#if defined(OS_POSIX)
+// A flag, generated internally for renderer and other helper process command
+// lines on Linux and Mac. It tells the helper process to enable crash dumping
+// and reporting, because helpers cannot access the files needed to make this
+// decision.
+const char kEnableCrashReporter[] = "enable-crash-reporter";
+#endif
+
} // namespace switches
diff --git a/base/base_switches.h b/base/base_switches.h
index 464493a..7686e76 100644
--- a/base/base_switches.h
+++ b/base/base_switches.h
@@ -7,6 +7,8 @@
#ifndef BASE_BASE_SWITCHES_H_
#define BASE_BASE_SWITCHES_H_
+#include "build/build_config.h"
+
namespace switches {
extern const char kDebugOnStart[];
@@ -20,6 +22,10 @@ extern const char kVModule[];
extern const char kWaitForDebugger[];
extern const char kTraceToConsole[];
+#if defined(OS_POSIX)
+extern const char kEnableCrashReporter[];
+#endif
+
} // namespace switches
#endif // BASE_BASE_SWITCHES_H_
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 06052ebf..93b1a9f 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -22,6 +22,7 @@
#include <algorithm>
#include <string>
+#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/files/file_path.h"
@@ -39,12 +40,12 @@
#include "chrome/app/breakpad_linux_impl.h"
#include "chrome/browser/crash_upload_list.h"
#include "chrome/common/child_process_logging.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info_posix.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/env_vars.h"
#include "components/breakpad/breakpad_client.h"
#include "content/public/common/content_descriptors.h"
+#include "content/public/common/content_switches.h"
#if defined(OS_ANDROID)
#include <android/log.h>
diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm
index 8985521..a647cbd 100644
--- a/chrome/app/breakpad_mac.mm
+++ b/chrome/app/breakpad_mac.mm
@@ -24,10 +24,10 @@
#include "base/threading/thread_restrictions.h"
#import "breakpad/src/client/mac/Framework/Breakpad.h"
#include "chrome/common/child_process_logging.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/env_vars.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "content/public/common/content_switches.h"
#include "components/breakpad/breakpad_client.h"
#include "components/nacl/common/nacl_switches.h"
#include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index 1203872..65c2c25 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -17,7 +17,6 @@
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/environment.h"
-#include "base/file_version_info.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "base/strings/string_split.h"
@@ -33,13 +32,13 @@
#include "chrome/app/hard_error_handler_win.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_result_codes.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/env_vars.h"
#include "chrome/installer/util/google_chrome_sxs_distribution.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
#include "components/breakpad/breakpad_client.h"
+#include "content/public/common/content_switches.h"
#include "policy/policy_constants.h"
#include "sandbox/win/src/nt_internals.h"
#include "sandbox/win/src/sidestep/preamble_patcher.h"
@@ -362,31 +361,10 @@ std::wstring GetProfileType() {
google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
const std::wstring& type,
const std::wstring& channel) {
- scoped_ptr<FileVersionInfo>
- version_info(FileVersionInfo::CreateFileVersionInfo(
- base::FilePath(exe_path)));
-
- std::wstring version, product;
- std::wstring special_build;
- if (version_info.get()) {
- // Get the information from the file.
- version = version_info->product_version();
- if (!version_info->is_official_build())
- version.append(L"-devel");
-
- const CommandLine& command = *CommandLine::ForCurrentProcess();
- if (command.HasSwitch(switches::kChromeFrame)) {
- product = L"ChromeFrame";
- } else {
- product = version_info->product_short_name();
- }
-
- special_build = version_info->special_build();
- } else {
- // No version info found. Make up the values.
- product = L"Chrome";
- version = L"0.0.0.0-devel";
- }
+ base::string16 version, product;
+ base::string16 special_build;
+ breakpad::GetBreakpadClient()->GetProductNameAndVersion(
+ base::FilePath(exe_path), &product, &version, &special_build);
// We only expect this method to be called once per process.
DCHECK(!g_custom_entries);
@@ -394,9 +372,9 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
// Common g_custom_entries.
g_custom_entries->push_back(
- google_breakpad::CustomInfoEntry(L"ver", version.c_str()));
+ google_breakpad::CustomInfoEntry(L"ver", UTF16ToWide(version).c_str()));
g_custom_entries->push_back(
- google_breakpad::CustomInfoEntry(L"prod", product.c_str()));
+ google_breakpad::CustomInfoEntry(L"prod", UTF16ToWide(product).c_str()));
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
g_custom_entries->push_back(
@@ -412,8 +390,8 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
google_breakpad::CustomInfoEntry(L"deferred-upload", L"true"));
if (!special_build.empty())
- g_custom_entries->push_back(
- google_breakpad::CustomInfoEntry(L"special", special_build.c_str()));
+ g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
+ L"special", UTF16ToWide(special_build).c_str()));
g_num_of_extensions_offset = g_custom_entries->size();
g_custom_entries->push_back(
diff --git a/chrome/app/chrome_breakpad_client.cc b/chrome/app/chrome_breakpad_client.cc
index 81c25ef..fa759a0 100644
--- a/chrome/app/chrome_breakpad_client.cc
+++ b/chrome/app/chrome_breakpad_client.cc
@@ -4,11 +4,19 @@
#include "chrome/app/chrome_breakpad_client.h"
+#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
+
+#if defined(OS_WIN)
+#include "base/file_version_info.h"
+#endif
#if defined(OS_POSIX)
#include "chrome/common/dump_without_crashing.h"
@@ -34,6 +42,39 @@ bool ChromeBreakpadClient::GetAlternativeCrashDumpLocation(
return false;
}
+
+void ChromeBreakpadClient::GetProductNameAndVersion(
+ const base::FilePath& exe_path,
+ base::string16* product_name,
+ base::string16* version,
+ base::string16* special_build) {
+ DCHECK(product_name);
+ DCHECK(version);
+ DCHECK(special_build);
+
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfo(exe_path));
+
+ if (version_info.get()) {
+ // Get the information from the file.
+ *version = version_info->product_version();
+ if (!version_info->is_official_build())
+ version->append(base::ASCIIToUTF16("-devel"));
+
+ const CommandLine& command = *CommandLine::ForCurrentProcess();
+ if (command.HasSwitch(switches::kChromeFrame)) {
+ *product_name = base::ASCIIToUTF16("ChromeFrame");
+ } else {
+ *product_name = version_info->product_short_name();
+ }
+
+ *special_build = version_info->special_build();
+ } else {
+ // No version info found. Make up the values.
+ *product_name = base::ASCIIToUTF16("Chrome");
+ *version = base::ASCIIToUTF16("0.0.0.0-devel");
+ }
+}
#endif
bool ChromeBreakpadClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
diff --git a/chrome/app/chrome_breakpad_client.h b/chrome/app/chrome_breakpad_client.h
index cac16cd..e02901f 100644
--- a/chrome/app/chrome_breakpad_client.h
+++ b/chrome/app/chrome_breakpad_client.h
@@ -20,6 +20,10 @@ class ChromeBreakpadClient : public breakpad::BreakpadClient {
#if defined(OS_WIN)
virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir)
OVERRIDE;
+ virtual void GetProductNameAndVersion(const base::FilePath& exe_path,
+ base::string16* product_name,
+ base::string16* version,
+ base::string16* special_build) OVERRIDE;
#endif
virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) OVERRIDE;
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 128dd31..a3f1909 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1458,12 +1458,6 @@ const char kOpenAsh[] = "open-ash";
#endif
#if defined(OS_POSIX)
-// A flag, generated internally by Chrome for renderer and other helper process
-// command lines on Linux and Mac. It tells the helper process to enable crash
-// dumping and reporting, because helpers cannot access the profile or other
-// files needed to make this decision.
-const char kEnableCrashReporter[] = "enable-crash-reporter";
-
// Used for turning on Breakpad crash reporting in a debug environment where
// crash reporting is typically compiled but disabled.
const char kEnableCrashReporterForTesting[] =
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 19dac72..f91f6b4 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -402,7 +402,6 @@ extern const char kOpenAsh[];
#endif
#if defined(OS_POSIX)
-extern const char kEnableCrashReporter[];
extern const char kEnableCrashReporterForTesting[];
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
extern const char kPasswordStore[];
diff --git a/components/breakpad/breakpad_client.cc b/components/breakpad/breakpad_client.cc
index 41271ed..43b512b 100644
--- a/components/breakpad/breakpad_client.cc
+++ b/components/breakpad/breakpad_client.cc
@@ -31,6 +31,12 @@ bool BreakpadClient::GetAlternativeCrashDumpLocation(
base::FilePath* crash_dir) {
return false;
}
+
+void BreakpadClient::GetProductNameAndVersion(const base::FilePath& exe_path,
+ base::string16* product_name,
+ base::string16* version,
+ base::string16* special_build) {
+}
#endif
bool BreakpadClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
diff --git a/components/breakpad/breakpad_client.h b/components/breakpad/breakpad_client.h
index 6d4b6ca..47e285d 100644
--- a/components/breakpad/breakpad_client.h
+++ b/components/breakpad/breakpad_client.h
@@ -5,7 +5,8 @@
#ifndef COMPONENTS_BREAKPAD_BREAKPAD_CLIENT_H_
#define COMPONENTS_BREAKPAD_BREAKPAD_CLIENT_H_
-#include "base/basictypes.h"
+#include "base/strings/string16.h"
+#include "build/build_config.h"
namespace base {
class FilePath;
@@ -32,6 +33,13 @@ class BreakpadClient {
// Returns true if an alternative location to store the minidump files was
// specified. Returns true if |crash_dir| was set.
virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir);
+
+ // Returns a textual description of the product type and version to include
+ // in the crash report.
+ virtual void GetProductNameAndVersion(const base::FilePath& exe_path,
+ base::string16* product_name,
+ base::string16* version,
+ base::string16* special_build);
#endif
// The location where minidump files should be written. Returns true if