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

Side by Side Diff: chrome/chrome_watcher/chrome_watcher_main.cc

Issue 2422643002: Windows install_static refactor. (Closed)
Patch Set: sync to position 428354 Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 #include <sddl.h> 6 #include <sddl.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 15 matching lines...) Expand all
26 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_piece.h" 27 #include "base/strings/string_piece.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/synchronization/waitable_event.h" 29 #include "base/synchronization/waitable_event.h"
30 #include "base/threading/platform_thread.h" 30 #include "base/threading/platform_thread.h"
31 #include "base/threading/thread.h" 31 #include "base/threading/thread.h"
32 #include "base/threading/thread_task_runner_handle.h" 32 #include "base/threading/thread_task_runner_handle.h"
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34 #include "base/win/scoped_handle.h" 34 #include "base/win/scoped_handle.h"
35 #include "base/win/win_util.h" 35 #include "base/win/win_util.h"
36
37 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" 36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h"
38 #include "chrome/installer/util/util_constants.h" 37 #include "chrome/common/chrome_constants.h"
38 #include "chrome/install_static/install_details.h"
39 #include "components/browser_watcher/endsession_watcher_window_win.h" 39 #include "components/browser_watcher/endsession_watcher_window_win.h"
40 #include "components/browser_watcher/exit_code_watcher_win.h" 40 #include "components/browser_watcher/exit_code_watcher_win.h"
41 #include "components/browser_watcher/window_hang_monitor_win.h" 41 #include "components/browser_watcher/window_hang_monitor_win.h"
42 42
43 namespace { 43 namespace {
44 44
45 // Use the same log facility as Chrome for convenience. 45 // Use the same log facility as Chrome for convenience.
46 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} 46 // {7FE69228-633E-4f06-80C1-527FEA23E3A7}
47 const GUID kChromeWatcherTraceProviderName = { 47 const GUID kChromeWatcherTraceProviderName = {
48 0x7fe69228, 0x633e, 0x4f06, 48 0x7fe69228, 0x633e, 0x4f06,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 } // namespace 182 } // namespace
183 183
184 // The main entry point to the watcher, declared as extern "C" to avoid name 184 // The main entry point to the watcher, declared as extern "C" to avoid name
185 // mangling. 185 // mangling.
186 extern "C" int WatcherMain(const base::char16* registry_path, 186 extern "C" int WatcherMain(const base::char16* registry_path,
187 HANDLE process_handle, 187 HANDLE process_handle,
188 DWORD main_thread_id, 188 DWORD main_thread_id,
189 HANDLE on_initialized_event_handle, 189 HANDLE on_initialized_event_handle,
190 const base::char16* browser_data_directory, 190 const base::char16* browser_data_directory) {
191 const base::char16* channel_name) { 191 install_static::InstallDetails::InitializeFromPrimaryModule(
192 chrome::kChromeElfDllName);
Sigurður Ásgeirsson 2016/10/28 15:44:16 ah - nice!
192 base::Process process(process_handle); 193 base::Process process(process_handle);
193 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle); 194 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle);
194 195
195 // The exit manager is in charge of calling the dtors of singletons. 196 // The exit manager is in charge of calling the dtors of singletons.
196 base::AtExitManager exit_manager; 197 base::AtExitManager exit_manager;
197 // Initialize the commandline singleton from the environment. 198 // Initialize the commandline singleton from the environment.
198 base::CommandLine::Init(0, nullptr); 199 base::CommandLine::Init(0, nullptr);
199 200
200 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName); 201 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName);
201 202
(...skipping 16 matching lines...) Expand all
218 219
219 // Wind logging down. 220 // Wind logging down.
220 logging::LogEventProvider::Uninitialize(); 221 logging::LogEventProvider::Uninitialize();
221 222
222 return 0; 223 return 0;
223 } 224 }
224 225
225 static_assert( 226 static_assert(
226 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, 227 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value,
227 "WatcherMain() has wrong type"); 228 "WatcherMain() has wrong type");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698