Chromium Code Reviews| Index: chrome/chrome_watcher/chrome_watcher_main.cc |
| diff --git a/chrome/chrome_watcher/chrome_watcher_main.cc b/chrome/chrome_watcher/chrome_watcher_main.cc |
| index e28de01888ade2841c223e7624ef16656db24249..03a787b7bfecf48ebe4d045624ab0ff09079ea86 100644 |
| --- a/chrome/chrome_watcher/chrome_watcher_main.cc |
| +++ b/chrome/chrome_watcher/chrome_watcher_main.cc |
| @@ -59,14 +59,13 @@ const int kDelayTimeSeconds = 30; |
| // an exit funnel, for reporting the next time Chrome runs. |
| class BrowserMonitor { |
| public: |
| - BrowserMonitor(base::RunLoop* run_loop, const base::char16* registry_path); |
| + BrowserMonitor(const base::string16& registry_path, base::RunLoop* run_loop); |
| ~BrowserMonitor(); |
| // Initiates the asynchronous monitoring process, returns true on success. |
| // |on_initialized_event| will be signaled immediately before blocking on the |
| // exit of |process|. |
| - bool StartWatching(const base::char16* registry_path, |
| - base::Process process, |
| + bool StartWatching(base::Process process, |
| base::win::ScopedHandle on_initialized_event); |
| private: |
| @@ -97,8 +96,8 @@ class BrowserMonitor { |
| DISALLOW_COPY_AND_ASSIGN(BrowserMonitor); |
| }; |
| -BrowserMonitor::BrowserMonitor(base::RunLoop* run_loop, |
| - const base::char16* registry_path) |
| +BrowserMonitor::BrowserMonitor(const base::string16& registry_path, |
| + base::RunLoop* run_loop) |
| : exit_code_watcher_(registry_path), |
| end_session_watcher_window_( |
| base::Bind(&BrowserMonitor::OnEndSessionMessage, |
| @@ -113,7 +112,6 @@ BrowserMonitor::~BrowserMonitor() { |
| } |
| bool BrowserMonitor::StartWatching( |
| - const base::char16* registry_path, |
| base::Process process, |
| base::win::ScopedHandle on_initialized_event) { |
| if (!exit_code_watcher_.Initialize(process.Pass())) |
| @@ -185,7 +183,6 @@ void BrowserMonitor::BrowserExited() { |
| } |
| void OnWindowEvent( |
| - const base::string16& registry_path, |
| base::Process process, |
| const base::Callback<void(const base::Process&)>& on_hung_callback, |
| browser_watcher::WindowHangMonitor::WindowEvent window_event) { |
| @@ -349,7 +346,7 @@ void OnCrashReportUpload(void* context, |
| // The main entry point to the watcher, declared as extern "C" to avoid name |
| // mangling. |
| -extern "C" int WatcherMain(const base::char16* registry_path, |
| +extern "C" int WatcherMain(const base::string16& registry_path, |
|
Sigurður Ásgeirsson
2016/01/25 20:50:24
this crosses a module boundary and hence an alloca
gab
2016/01/26 02:55:05
Gotcha, would a base::string16* be okay? i.e given
|
| HANDLE process_handle, |
| DWORD main_thread_id, |
| HANDLE on_initialized_event_handle, |
| @@ -404,8 +401,8 @@ extern "C" int WatcherMain(const base::char16* registry_path, |
| msg_loop.set_thread_name("WatcherMainThread"); |
| base::RunLoop run_loop; |
| - BrowserMonitor monitor(&run_loop, registry_path); |
| - if (!monitor.StartWatching(registry_path, process.Duplicate(), |
| + BrowserMonitor monitor(registry_path, &run_loop); |
| + if (!monitor.StartWatching(process.Duplicate(), |
| on_initialized_event.Pass())) { |
| return 1; |
| } |
| @@ -414,8 +411,8 @@ extern "C" int WatcherMain(const base::char16* registry_path, |
| // Scoped to force |hang_monitor| destruction before Kasko is shut down. |
| browser_watcher::WindowHangMonitor hang_monitor( |
| base::TimeDelta::FromSeconds(60), base::TimeDelta::FromSeconds(20), |
| - base::Bind(&OnWindowEvent, registry_path, |
| - base::Passed(process.Duplicate()), on_hung_callback)); |
| + base::Bind(&OnWindowEvent, base::Passed(process.Duplicate()), |
| + on_hung_callback)); |
| hang_monitor.Initialize(process.Duplicate(), message_window_name); |
| run_loop.Run(); |