summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_frame_reporting.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 21:52:37 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 21:52:37 +0000
commitea8ab2aa7cb4e3b441fa6df657d140d84e946c8e (patch)
treea4110812afb096198beb54635c24f348f71587cc /chrome_frame/chrome_frame_reporting.cc
parent222885dd16eb6cf90212adabdecab51cafa529ca (diff)
downloadchromium_src-ea8ab2aa7cb4e3b441fa6df657d140d84e946c8e.zip
chromium_src-ea8ab2aa7cb4e3b441fa6df657d140d84e946c8e.tar.gz
chromium_src-ea8ab2aa7cb4e3b441fa6df657d140d84e946c8e.tar.bz2
Start and stop crash reporting outside of the loader lock.
Instead of using DllMain to start/stop crash reporting, it is now done by way of a specialization of a new ScopedInitializationManager template. Instances of this specialization are created on the stack in entrypoints to the DLL (for registration or to get a COM object). The lifetime of crash reporting is ordinarily bound to the lifetime of the ATL module. The exception to this is when the module is pinned, at which point crash reporting is also pinned. This change removes the breakpad_handler_dll target (by reverting http://crrev.com/70898) since it is no longer needed. BUG=163455 TEST=install chrome frame and notice that installation doesn't block for 1 minute while npchrome_frame.dll is registered. Review URL: https://chromiumcodereview.appspot.com/12521002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_frame_reporting.cc')
-rw-r--r--chrome_frame/chrome_frame_reporting.cc41
1 files changed, 29 insertions, 12 deletions
diff --git a/chrome_frame/chrome_frame_reporting.cc b/chrome_frame/chrome_frame_reporting.cc
index f9fa490..0a0608a 100644
--- a/chrome_frame/chrome_frame_reporting.cc
+++ b/chrome_frame/chrome_frame_reporting.cc
@@ -4,15 +4,22 @@
// Implementation of wrapper around common crash reporting.
+#include "chrome_frame/chrome_frame_reporting.h"
+
+#include "base/basictypes.h"
#include "base/file_util.h"
#include "base/file_version_info.h"
#include "base/win/win_util.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
-#include "chrome_frame/chrome_frame_reporting.h"
+#include "chrome_frame/crash_reporting/crash_report.h"
#include "chrome_frame/exception_barrier.h"
#include "chrome_frame/utils.h"
+extern "C" IMAGE_DOS_HEADER __ImageBase;
+
+namespace {
+
// Well known SID for the system principal.
const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
@@ -45,15 +52,13 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* dll_path) {
return &custom_info;
}
-extern "C" IMAGE_DOS_HEADER __ImageBase;
-
bool InitializeCrashReporting() {
// In headless mode we want crashes to be reported back.
bool always_take_dump = IsHeadlessMode();
// We want to use the Google Update crash reporting. We need to check if the
// user allows it first.
if (!always_take_dump && !GoogleUpdateSettings::GetCollectStatsConsent())
- return true;
+ return true;
// If we got here, we want to report crashes, so make sure all
// ExceptionBarrierBase instances do so.
@@ -61,17 +66,16 @@ bool InitializeCrashReporting() {
// Get the alternate dump directory. We use the temp path.
base::FilePath temp_directory;
- if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) {
+ if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty())
return false;
- }
wchar_t dll_path[MAX_PATH * 2] = {0};
GetModuleFileName(reinterpret_cast<HMODULE>(&__ImageBase), dll_path,
arraysize(dll_path));
if (always_take_dump) {
- return InitializeVectoredCrashReportingWithPipeName(true, kChromePipeName,
- temp_directory.value(), GetCustomInfo(dll_path));
+ return InitializeVectoredCrashReportingWithPipeName(
+ true, kChromePipeName, temp_directory.value(), GetCustomInfo(dll_path));
}
// Build the pipe name. It can be either:
@@ -79,18 +83,31 @@ bool InitializeCrashReporting() {
// Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
std::wstring user_sid;
if (InstallUtil::IsPerUserInstall(dll_path)) {
- if (!base::win::GetUserSidString(&user_sid)) {
+ if (!base::win::GetUserSidString(&user_sid))
return false;
- }
} else {
user_sid = kSystemPrincipalSid;
}
- return InitializeVectoredCrashReporting(false, user_sid.c_str(),
- temp_directory.value(), GetCustomInfo(dll_path));
+ return InitializeVectoredCrashReporting(
+ false, user_sid.c_str(), temp_directory.value(), GetCustomInfo(dll_path));
}
bool ShutdownCrashReporting() {
ExceptionBarrierConfig::set_enabled(false);
return ShutdownVectoredCrashReporting();
}
+
+} // namespace
+
+namespace chrome_frame {
+
+void CrashReportingTraits::Initialize() {
+ InitializeCrashReporting();
+}
+
+void CrashReportingTraits::Shutdown() {
+ ShutdownCrashReporting();
+}
+
+} // namespace chrome_frame