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

Side by Side Diff: components/browser_watcher/window_hang_monitor_win.cc

Issue 1752233002: Convert Pass()→std::move() on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 #include "components/browser_watcher/window_hang_monitor_win.h" 4 #include "components/browser_watcher/window_hang_monitor_win.h"
5 5
6 #include <utility>
7
6 #include "base/callback.h" 8 #include "base/callback.h"
7 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
13 #include "base/win/message_window.h" 15 #include "base/win/message_window.h"
14 16
15 namespace browser_watcher { 17 namespace browser_watcher {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 WindowHangMonitor::~WindowHangMonitor() { 67 WindowHangMonitor::~WindowHangMonitor() {
66 if (outstanding_ping_) { 68 if (outstanding_ping_) {
67 // We have an outstanding ping, disable it and leak it intentionally as 69 // We have an outstanding ping, disable it and leak it intentionally as
68 // if the callback arrives eventually, it'll cause a use-after-free. 70 // if the callback arrives eventually, it'll cause a use-after-free.
69 outstanding_ping_->monitor = nullptr; 71 outstanding_ping_->monitor = nullptr;
70 outstanding_ping_ = nullptr; 72 outstanding_ping_ = nullptr;
71 } 73 }
72 } 74 }
73 75
74 void WindowHangMonitor::Initialize(base::Process process) { 76 void WindowHangMonitor::Initialize(base::Process process) {
75 window_process_ = process.Pass(); 77 window_process_ = std::move(process);
76 timer_.SetTaskRunner(base::MessageLoop::current()->task_runner()); 78 timer_.SetTaskRunner(base::MessageLoop::current()->task_runner());
77 79
78 ScheduleFindWindow(); 80 ScheduleFindWindow();
79 } 81 }
80 82
81 void WindowHangMonitor::ScheduleFindWindow() { 83 void WindowHangMonitor::ScheduleFindWindow() {
82 // TODO(erikwright): We could reduce the polling by using WaitForInputIdle, 84 // TODO(erikwright): We could reduce the polling by using WaitForInputIdle,
83 // but it is hard to test (requiring a non-Console executable). 85 // but it is hard to test (requiring a non-Console executable).
84 timer_.Start( 86 timer_.Start(
85 FROM_HERE, ping_interval_, 87 FROM_HERE, ping_interval_,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // at any point after we found it. 182 // at any point after we found it.
181 HWND hwnd = FindChromeMessageWindow(window_process_.Pid()); 183 HWND hwnd = FindChromeMessageWindow(window_process_.Pid());
182 if (hwnd) { 184 if (hwnd) {
183 SendPing(hwnd); 185 SendPing(hwnd);
184 } else { 186 } else {
185 callback_.Run(WINDOW_VANISHED); 187 callback_.Run(WINDOW_VANISHED);
186 } 188 }
187 } 189 }
188 190
189 } // namespace browser_watcher 191 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « components/browser_watcher/exit_code_watcher_win_unittest.cc ('k') | components/nacl/browser/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698