fix: use crashpad on Windows (#18483)

* Initial changes to use crashpad for windows

* Remove crashpad patch

* Report error when failed to connect pipe

* Allow crashpad to communicate with named pipe

* Add patch to make crashpad named pipe work

* Windows also needs crashReporter on main process

* Call SetUnhandledExceptionFilter in node process

Node can also use crash reporter.

* Do not treat node process as browser process

* No more need to manually start crash service

* Use base::StringPrintf for better readbility

* Print error when pipe name not available

* Make sure pipe name is updated

Note that the crashpad may be started after renderer process gets
created.

* Fix some tests

* Update node

* Exclude crashpad files on Linux and MAS

* Fix lint warning

* Remove unused checks

* kCrashpadPipeName is only available on Windows

* Fix uploadToServer tests

* Fix extra params tests

* Fix getCrashesDirectory tests

* Run crashReporter tests on CI

* Style fixes

* Update crashreporter docs

* Rename InitBreakpad to Init

* Add comment for process_type_.empty() and UTF16ToASCII to UTF16ToUTF8.

* Update build.gn include crashpad headers

* Address comment https://github.com/electron/electron/pull/18483#discussion_r290887898

* Avoid using api::WebContents

* Put kRunAsNode in atom_constants

* Remove duplicate settings on upload params

* Fix building on macOS

* Update description for crashpad_pid_check.patch
This commit is contained in:
Nitish Sakhawalkar 2019-06-12 23:42:21 -07:00 committed by Cheng Zhao
parent ddec3c0e78
commit f98454e5dd
39 changed files with 561 additions and 812 deletions

View file

@ -25,6 +25,8 @@ namespace atom {
class InspectableWebContentsDelegate;
class InspectableWebContentsView;
// TODO(zcbenz): Remove this abstract wrapper and rename
// InspectableWebContentsImpl to InspectableWebContents instead.
class InspectableWebContents {
public:
// The returned InspectableWebContents takes ownership of the passed-in

View file

@ -3,11 +3,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#include "atom/browser/ui/inspectable_web_contents_impl.h"
#include <memory>
#include <utility>
#include "atom/browser/ui/inspectable_web_contents_impl.h"
#include "atom/browser/ui/inspectable_web_contents_delegate.h"
#include "atom/browser/ui/inspectable_web_contents_view.h"
#include "atom/browser/ui/inspectable_web_contents_view_delegate.h"
@ -75,6 +75,9 @@ const char kTitleFormat[] = "Developer Tools - %s";
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
// Stores all instances of InspectableWebContentsImpl.
InspectableWebContentsImpl::List g_web_contents_instances_;
base::Value RectToDictionary(const gfx::Rect& bounds) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("x", base::Value(bounds.x()));
@ -227,6 +230,12 @@ class InspectableWebContentsImpl::NetworkResourceLoader
InspectableWebContentsView* CreateInspectableContentsView(
InspectableWebContentsImpl* inspectable_web_contents_impl);
// static
const InspectableWebContentsImpl::List& InspectableWebContentsImpl::GetAll() {
return g_web_contents_instances_;
}
// static
void InspectableWebContentsImpl::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(kDevToolsBoundsPref,
RectToDictionary(gfx::Rect(0, 0, 800, 600)));
@ -270,9 +279,11 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
display.y() + (display.height() - devtools_bounds_.height()) / 2);
}
}
g_web_contents_instances_.push_back(this);
}
InspectableWebContentsImpl::~InspectableWebContentsImpl() {
g_web_contents_instances_.remove(this);
// Unsubscribe from devtools and Clean up resources.
if (GetDevToolsWebContents()) {
if (managed_devtools_web_contents_)

View file

@ -6,6 +6,7 @@
#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_
#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_
#include <list>
#include <map>
#include <memory>
#include <set>
@ -38,6 +39,9 @@ class InspectableWebContentsImpl
public content::WebContentsDelegate,
public DevToolsEmbedderMessageDispatcher::Delegate {
public:
using List = std::list<InspectableWebContentsImpl*>;
static const List& GetAll();
static void RegisterPrefs(PrefRegistrySimple* pref_registry);
InspectableWebContentsImpl(content::WebContents* web_contents,