mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add breakpad support (issue #1131).
- General usage instructions are available at https://sites.google.com/a/chromium.org/dev/developers/testing/webkit-layout-tests/using-breakpad-with-content-shell. - Mac: Generate "Chromium Embedded Framework.framework" using a new cef_framework target (the libcef target is now only used on Windows and Linux). Rename "Libraries/libcef.dylib" to "Chromium Embedded Framework". Distribute Release and Debug builds of the "Chromium Embedded Framework.framework" folder as part of the binary distribution. - Mac: Fix the Xcode target compiler setting for the binary distribution so that it no longer needs to be set manually. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1524 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -5,13 +5,16 @@
|
||||
#include "libcef/common/main_delegate.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/common/breakpad_client.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/command_line_impl.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -28,16 +31,26 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <Objbase.h> // NOLINT(build/include_order)
|
||||
#include "components/breakpad/app/breakpad_win.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "base/mac/os_crash_dumps.h"
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "components/breakpad/app/breakpad_mac.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#include "components/breakpad/app/breakpad_linux.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
base::LazyInstance<CefBreakpadClient>::Leaky g_shell_breakpad_client =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
||||
base::FilePath GetFrameworksPath() {
|
||||
@@ -345,6 +358,26 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
void CefMainDelegate::PreSandboxStartup() {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line.HasSwitch(switches::kEnableCrashReporter)) {
|
||||
breakpad::SetBreakpadClient(g_shell_breakpad_client.Pointer());
|
||||
#if defined(OS_MACOSX)
|
||||
base::mac::DisableOSCrashDumps();
|
||||
breakpad::InitCrashReporter();
|
||||
breakpad::InitCrashProcessInfo();
|
||||
#elif defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
std::string process_type = command_line.GetSwitchValueASCII(
|
||||
switches::kProcessType);
|
||||
if (process_type != switches::kZygoteProcess)
|
||||
breakpad::InitCrashReporter();
|
||||
#elif defined(OS_WIN)
|
||||
UINT new_flags =
|
||||
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
|
||||
UINT existing_flags = SetErrorMode(new_flags);
|
||||
SetErrorMode(existing_flags | new_flags);
|
||||
breakpad::InitCrashReporter();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
if (!command_line.HasSwitch(switches::kProcessType)) {
|
||||
// Only override the child process path when executing the main process.
|
||||
@@ -396,6 +429,14 @@ void CefMainDelegate::ProcessExiting(const std::string& process_type) {
|
||||
ResourceBundle::CleanupSharedInstance();
|
||||
}
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
void CefMainDelegate::ZygoteForked() {
|
||||
if (CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnableCrashReporter)) {
|
||||
breakpad::InitCrashReporter();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
content::ContentBrowserClient* CefMainDelegate::CreateContentBrowserClient() {
|
||||
browser_client_.reset(new CefContentBrowserClient);
|
||||
|
Reference in New Issue
Block a user