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

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

Issue 1210013007: clang/win: Fix warnings to prepare for building without -Wno-reorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clang-unsequenced
Patch Set: Created 5 years, 5 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 "base/callback.h" 6 #include "base/callback.h"
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/win/message_window.h" 10 #include "base/win/message_window.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 return nullptr; 24 return nullptr;
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 WindowHangMonitor::WindowHangMonitor(base::TimeDelta ping_interval, 29 WindowHangMonitor::WindowHangMonitor(base::TimeDelta ping_interval,
30 base::TimeDelta timeout, 30 base::TimeDelta timeout,
31 const WindowEventCallback& callback) 31 const WindowEventCallback& callback)
32 : callback_(callback), 32 : callback_(callback),
33 outstanding_ping_(nullptr), 33 ping_interval_(ping_interval),
34 hang_timeout_(timeout),
34 timer_(false /* don't retain user task */, false /* don't repeat */), 35 timer_(false /* don't retain user task */, false /* don't repeat */),
35 ping_interval_(ping_interval), 36 outstanding_ping_(nullptr) {
36 hang_timeout_(timeout) {
37 } 37 }
38 38
39 WindowHangMonitor::~WindowHangMonitor() { 39 WindowHangMonitor::~WindowHangMonitor() {
40 if (outstanding_ping_) { 40 if (outstanding_ping_) {
41 // We have an outstanding ping, disable it and leak it intentionally as 41 // We have an outstanding ping, disable it and leak it intentionally as
42 // if the callback arrives eventually, it'll cause a use-after-free. 42 // if the callback arrives eventually, it'll cause a use-after-free.
43 outstanding_ping_->monitor = nullptr; 43 outstanding_ping_->monitor = nullptr;
44 outstanding_ping_ = nullptr; 44 outstanding_ping_ = nullptr;
45 } 45 }
46 } 46 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // 2. The window handle might have been re-assigned to a different process 156 // 2. The window handle might have been re-assigned to a different process
157 // at any point after we found it. 157 // at any point after we found it.
158 HWND hwnd = FindNamedWindowForProcess(window_name_, window_process_.Pid()); 158 HWND hwnd = FindNamedWindowForProcess(window_name_, window_process_.Pid());
159 if (hwnd) 159 if (hwnd)
160 SendPing(hwnd); 160 SendPing(hwnd);
161 else 161 else
162 callback_.Run(WINDOW_VANISHED); 162 callback_.Run(WINDOW_VANISHED);
163 } 163 }
164 164
165 } // namespace browser_watcher 165 } // namespace browser_watcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698