OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "base/at_exit.h" | |
8 #include "base/files/file_path.h" | |
9 #include "base/path_service.h" | |
10 #include "base/version.h" | |
11 #include "chrome/tools/crash_service/caps/logger_win.h" | |
12 #include "chrome/tools/crash_service/caps/process_singleton_win.h" | |
13 #include "chrome/tools/crash_service/caps/return_codes.h" | |
14 | |
7 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | 15 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
8 return 0; | 16 base::AtExitManager at_exit_manager; |
17 base::FilePath dir_exe; | |
18 if (!PathService::Get(base::DIR_EXE, &dir_exe)) | |
19 return caps::RC_INIT_ERROR; | |
20 | |
21 // 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.
| |
22 // location (a versioned directory) or from a build output directory. | |
23 base::Version version(dir_exe.BaseName().MaybeAsASCII()); | |
24 auto data_path = version.IsValid() ? dir_exe.DirName() : dir_exe; | |
25 | |
26 // 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
| |
27 caps::Logger logger(data_path); | |
28 | |
29 // check for an existing running instance. | |
30 caps::ProcessSingleton process_singleton; | |
31 if (process_singleton.other_instance()) | |
32 return caps::RC_EXISTING_INSTANCE; | |
33 | |
34 return caps::RC_NORMAL_EXIT; | |
9 } | 35 } |
36 | |
OLD | NEW |