Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5232)

Unified Diff: chrome/browser/crash_handler_host_linux.cc

Issue 29943005: Prepare CrashHandlerHostLinux for move to breakpad component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/crash_handler_host_linux.cc
diff --git a/chrome/browser/crash_handler_host_linux.cc b/chrome/browser/crash_handler_host_linux.cc
index 41b0f55f545f478e61939d0a36973096859c9091..a50fad26c5a7efe0fa279bf23c42cfbb76de4612 100644
--- a/chrome/browser/crash_handler_host_linux.cc
+++ b/chrome/browser/crash_handler_host_linux.cc
@@ -28,8 +28,6 @@
#include "breakpad/src/client/linux/minidump_writer/linux_dumper.h"
#include "breakpad/src/client/linux/minidump_writer/minidump_writer.h"
#include "chrome/app/breakpad_linux_impl.h"
Nico 2013/10/19 01:28:46 This is for a folllow-up I suppose.
jochen (gone - plz use gerrit) 2013/10/19 02:38:36 Right, those files will be moved all together to t
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/env_vars.h"
#include "content/public/browser/browser_thread.h"
#if defined(OS_ANDROID)
@@ -64,13 +62,18 @@ void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) {
} // namespace
-// Since classes derived from CrashHandlerHostLinux are singletons, it's only
-// destroyed at the end of the processes lifetime, which is greater in span than
-// the lifetime of the IO message loop. Thus, all calls to base::Bind() use
+// Since instances of CrashHandlerHostLinux are leaked, it's only destroyed at
Nico 2013/10/19 01:28:46 s/it's/they are/ :-P
jochen (gone - plz use gerrit) 2013/10/19 02:38:36 Done.
+// the end of the processes lifetime, which is greater in span than the
+// lifetime of the IO message loop. Thus, all calls to base::Bind() use
// non-refcounted pointers.
-CrashHandlerHostLinux::CrashHandlerHostLinux()
- : shutting_down_(false),
+CrashHandlerHostLinux::CrashHandlerHostLinux(const std::string& process_type,
+ const base::FilePath& dumps_path,
+ bool upload)
+ : process_type_(process_type),
+ dumps_path_(dumps_path),
+ upload_(upload),
+ shutting_down_(false),
worker_pool_token_(BrowserThread::GetBlockingPool()->GetSequenceToken()) {
int fds[2];
// We use SOCK_SEQPACKET rather than SOCK_DGRAM to prevent the process from
@@ -91,6 +94,10 @@ CrashHandlerHostLinux::CrashHandlerHostLinux()
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&CrashHandlerHostLinux::Init, base::Unretained(this)));
+
+ uploader_thread_.reset(
+ new base::Thread(std::string(process_type_ + "_crash_uploader").c_str()));
+ uploader_thread_->Start();
Nico 2013/10/19 01:28:46 Can this stay in a method? Constructors that start
jochen (gone - plz use gerrit) 2013/10/19 02:38:36 Done.
}
CrashHandlerHostLinux::~CrashHandlerHostLinux() {
@@ -107,13 +114,6 @@ void CrashHandlerHostLinux::Init() {
ml->AddDestructionObserver(this);
}
-void CrashHandlerHostLinux::InitCrashUploaderThread() {
- SetProcessType();
- uploader_thread_.reset(
- new base::Thread(std::string(process_type_ + "_crash_uploader").c_str()));
- uploader_thread_->Start();
-}
-
void CrashHandlerHostLinux::OnFileCanWriteWithoutBlocking(int fd) {
NOTREACHED();
}
@@ -330,7 +330,7 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
// Nothing gets uploaded in android.
info->upload = false;
#else
- info->upload = (getenv(env_vars::kHeadless) == NULL);
+ info->upload = upload_;
#endif
info->crash_keys = crash_keys;
@@ -363,7 +363,7 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
base::FilePath dumps_path("/tmp");
PathService::Get(base::DIR_TEMP, &dumps_path);
if (!info->upload)
- PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
+ dumps_path = dumps_path_;
const uint64 rand = base::RandUint64();
const std::string minidump_filename =
base::StringPrintf("%s/chromium-%s-minidump-%016" PRIx64 ".dmp",
@@ -448,83 +448,3 @@ void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() {
bool CrashHandlerHostLinux::IsShuttingDown() const {
return shutting_down_;
}
-
-ExtensionCrashHandlerHostLinux::ExtensionCrashHandlerHostLinux() {
Nico 2013/10/19 01:28:46 These classes were weird.
- InitCrashUploaderThread();
-}
-
-ExtensionCrashHandlerHostLinux::~ExtensionCrashHandlerHostLinux() {
-}
-
-void ExtensionCrashHandlerHostLinux::SetProcessType() {
- process_type_ = "extension";
-}
-
-// static
-ExtensionCrashHandlerHostLinux* ExtensionCrashHandlerHostLinux::GetInstance() {
- return Singleton<ExtensionCrashHandlerHostLinux>::get();
-}
-
-GpuCrashHandlerHostLinux::GpuCrashHandlerHostLinux() {
- InitCrashUploaderThread();
-}
-
-GpuCrashHandlerHostLinux::~GpuCrashHandlerHostLinux() {
-}
-
-void GpuCrashHandlerHostLinux::SetProcessType() {
- process_type_ = "gpu-process";
-}
-
-// static
-GpuCrashHandlerHostLinux* GpuCrashHandlerHostLinux::GetInstance() {
- return Singleton<GpuCrashHandlerHostLinux>::get();
-}
-
-PluginCrashHandlerHostLinux::PluginCrashHandlerHostLinux() {
- InitCrashUploaderThread();
-}
-
-PluginCrashHandlerHostLinux::~PluginCrashHandlerHostLinux() {
-}
-
-void PluginCrashHandlerHostLinux::SetProcessType() {
- process_type_ = "plugin";
-}
-
-// static
-PluginCrashHandlerHostLinux* PluginCrashHandlerHostLinux::GetInstance() {
- return Singleton<PluginCrashHandlerHostLinux>::get();
-}
-
-PpapiCrashHandlerHostLinux::PpapiCrashHandlerHostLinux() {
- InitCrashUploaderThread();
-}
-
-PpapiCrashHandlerHostLinux::~PpapiCrashHandlerHostLinux() {
-}
-
-void PpapiCrashHandlerHostLinux::SetProcessType() {
- process_type_ = "ppapi";
-}
-
-// static
-PpapiCrashHandlerHostLinux* PpapiCrashHandlerHostLinux::GetInstance() {
- return Singleton<PpapiCrashHandlerHostLinux>::get();
-}
-
-RendererCrashHandlerHostLinux::RendererCrashHandlerHostLinux() {
- InitCrashUploaderThread();
-}
-
-RendererCrashHandlerHostLinux::~RendererCrashHandlerHostLinux() {
-}
-
-void RendererCrashHandlerHostLinux::SetProcessType() {
- process_type_ = "renderer";
-}
-
-// static
-RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() {
- return Singleton<RendererCrashHandlerHostLinux>::get();
-}
« chrome/browser/chrome_content_browser_client.cc ('K') | « chrome/browser/crash_handler_host_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698