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

Unified Diff: chrome/tools/crash_service/caps/main_win.cc

Issue 890213002: Add basic support for CAPS exe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/tools/crash_service/caps/main_win.cc
diff --git a/chrome/tools/crash_service/caps/main_win.cc b/chrome/tools/crash_service/caps/main_win.cc
index b2c0174548f349bd3a899a0cb049054db5a423cb..7aad5bd4e2caa5dbfa5775df44280f8d7c96c0f7 100644
--- a/chrome/tools/crash_service/caps/main_win.cc
+++ b/chrome/tools/crash_service/caps/main_win.cc
@@ -4,6 +4,33 @@
#include <windows.h>
+#include "base/at_exit.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+#include "base/version.h"
+#include "chrome/tools/crash_service/caps/logger_win.h"
+#include "chrome/tools/crash_service/caps/process_singleton_win.h"
+#include "chrome/tools/crash_service/caps/return_codes.h"
+
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) {
- return 0;
+ base::AtExitManager at_exit_manager;
+ base::FilePath dir_exe;
+ if (!PathService::Get(base::DIR_EXE, &dir_exe))
+ return caps::RC_INIT_ERROR;
+
+ // what directory we write depends if we are being run from the actual
scottmg 2015/02/01 19:55:35 capital at start of comments
cpu_(ooo_6.6-7.5) 2015/02/03 02:44:58 Done.
+ // location (a versioned directory) or from a build output directory.
+ base::Version version(dir_exe.BaseName().MaybeAsASCII());
+ auto data_path = version.IsValid() ? dir_exe.DirName() : dir_exe;
+
+ // start logging.
scottmg 2015/02/01 19:55:35 Do you want the logging start and the singleton ch
cpu_(ooo_6.6-7.5) 2015/02/03 02:44:58 Ya, it should be able to handle different processe
+ caps::Logger logger(data_path);
+
+ // check for an existing running instance.
+ caps::ProcessSingleton process_singleton;
+ if (process_singleton.other_instance())
+ return caps::RC_EXISTING_INSTANCE;
+
+ return caps::RC_NORMAL_EXIT;
}
+

Powered by Google App Engine
This is Rietveld 408576698