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

Unified Diff: components/breakpad/tools/crash_service.cc

Issue 26688006: Move CrashService class to breakpad component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates 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
« no previous file with comments | « components/breakpad/tools/crash_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/breakpad/tools/crash_service.cc
diff --git a/chrome/tools/crash_service/crash_service.cc b/components/breakpad/tools/crash_service.cc
similarity index 91%
rename from chrome/tools/crash_service/crash_service.cc
rename to components/breakpad/tools/crash_service.cc
index 8face402ef6d77e1f9fd13ca5a4cf7618a98fa70..343665ed80fa6317e1cf5d162bc2f3145910f7a5 100644
--- a/chrome/tools/crash_service/crash_service.cc
+++ b/components/breakpad/tools/crash_service.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/tools/crash_service/crash_service.h"
+#include "components/breakpad/tools/crash_service.h"
#include <windows.h>
@@ -13,13 +13,12 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/path_service.h"
#include "base/win/windows_version.h"
#include "breakpad/src/client/windows/crash_generation/client_info.h"
#include "breakpad/src/client/windows/crash_generation/crash_generation_server.h"
#include "breakpad/src/client/windows/sender/crash_report_sender.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
+
+namespace breakpad {
namespace {
@@ -152,15 +151,13 @@ const char CrashService::kReporterTag[] = "reporter";
const char CrashService::kDumpsDir[] = "dumps-dir";
const char CrashService::kPipeName[] = "pipe-name";
-CrashService::CrashService(const std::wstring& report_dir)
- : report_path_(report_dir),
- sender_(NULL),
+CrashService::CrashService()
+ : sender_(NULL),
dumper_(NULL),
requests_handled_(0),
requests_sent_(0),
clients_connected_(0),
clients_terminated_(0) {
- chrome::RegisterPathProvider();
}
CrashService::~CrashService() {
@@ -169,8 +166,9 @@ CrashService::~CrashService() {
delete sender_;
}
-
-bool CrashService::Initialize(const std::wstring& command_line) {
+bool CrashService::Initialize(const base::FilePath& operating_dir,
+ const base::FilePath& report_path,
Robert Sesek 2013/10/17 17:21:21 This doesn't match the signature in the other file
+ const base::FilePath& dumps_path) {
using google_breakpad::CrashReportSender;
using google_breakpad::CrashGenerationServer;
@@ -179,28 +177,15 @@ bool CrashService::Initialize(const std::wstring& command_line) {
// The checkpoint file allows CrashReportSender to enforce the the maximum
// reports per day quota. Does not seem to serve any other purpose.
- base::FilePath checkpoint_path = report_path_.Append(kCheckPointFile);
-
- // The dumps path is typically : '<user profile>\Local settings\
- // Application data\Goggle\Chrome\Crash Reports' and the report path is
- // Application data\Google\Chrome\Reported Crashes.txt
- base::FilePath user_data_dir;
- if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
- LOG(ERROR) << "could not get DIR_USER_DATA";
- return false;
- }
- report_path_ = user_data_dir.Append(chrome::kCrashReportLog);
+ base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile);
- CommandLine cmd_line = CommandLine::FromString(command_line);
+ CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
+
+ base::FilePath dumps_path_to_use = dumps_path;
- base::FilePath dumps_path;
if (cmd_line.HasSwitch(kDumpsDir)) {
- dumps_path = base::FilePath(cmd_line.GetSwitchValueNative(kDumpsDir));
- } else {
- if (!PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path)) {
- LOG(ERROR) << "could not get DIR_CRASH_DUMPS";
- return false;
- }
+ dumps_path_to_use =
+ base::FilePath(cmd_line.GetSwitchValueNative(kDumpsDir));
}
// We can override the send reports quota with a command line switch.
@@ -243,7 +228,7 @@ bool CrashService::Initialize(const std::wstring& command_line) {
&CrashService::OnClientDumpRequest, this,
&CrashService::OnClientExited, this,
NULL, NULL,
- true, &dumps_path.value());
+ true, &dumps_path_to_use.value());
if (!dumper_) {
LOG(ERROR) << "could not create dumper";
@@ -266,8 +251,7 @@ bool CrashService::Initialize(const std::wstring& command_line) {
// Log basic information.
VLOG(1) << "pipe name is " << pipe_name
- << "\ndumps at " << dumps_path.value()
- << "\nreports at " << report_path_.value();
+ << "\ndumps at " << dumps_path_to_use.value();
if (sender_) {
VLOG(1) << "checkpoint is " << checkpoint_path.value()
@@ -501,3 +485,5 @@ PSECURITY_DESCRIPTOR CrashService::GetSecurityDescriptorForLowIntegrity() {
return NULL;
}
+
+} // namespace breakpad
« no previous file with comments | « components/breakpad/tools/crash_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698