OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/process/kill.h" | 5 #include "base/process/kill.h" |
6 | 6 |
7 #include <io.h> | 7 #include <io.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // The process that we are watching. | 51 // The process that we are watching. |
52 Process process_; | 52 Process process_; |
53 | 53 |
54 win::ObjectWatcher watcher_; | 54 win::ObjectWatcher watcher_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(TimerExpiredTask); | 56 DISALLOW_COPY_AND_ASSIGN(TimerExpiredTask); |
57 }; | 57 }; |
58 | 58 |
59 TimerExpiredTask::TimerExpiredTask(Process process) : process_(process.Pass()) { | 59 TimerExpiredTask::TimerExpiredTask(Process process) : process_(process.Pass()) { |
60 watcher_.StartWatching(process_.Handle(), this); | 60 watcher_.StartWatching(process_.Handle(), this, false); |
61 } | 61 } |
62 | 62 |
63 TimerExpiredTask::~TimerExpiredTask() { | 63 TimerExpiredTask::~TimerExpiredTask() { |
64 TimedOut(); | 64 TimedOut(); |
65 } | 65 } |
66 | 66 |
67 void TimerExpiredTask::TimedOut() { | 67 void TimerExpiredTask::TimedOut() { |
68 if (process_.IsValid()) | 68 if (process_.IsValid()) |
69 KillProcess(); | 69 KillProcess(); |
70 } | 70 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 MessageLoop::current()->PostDelayedTask( | 188 MessageLoop::current()->PostDelayedTask( |
189 FROM_HERE, | 189 FROM_HERE, |
190 Bind(&TimerExpiredTask::TimedOut, | 190 Bind(&TimerExpiredTask::TimedOut, |
191 Owned(new TimerExpiredTask(process.Pass()))), | 191 Owned(new TimerExpiredTask(process.Pass()))), |
192 TimeDelta::FromMilliseconds(kWaitInterval)); | 192 TimeDelta::FromMilliseconds(kWaitInterval)); |
193 } | 193 } |
194 | 194 |
195 } // namespace base | 195 } // namespace base |
OLD | NEW |