| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 void TimerExpiredTask::TimedOut() { | 68 void TimerExpiredTask::TimedOut() { |
| 69 if (process_.IsValid()) | 69 if (process_.IsValid()) |
| 70 KillProcess(); | 70 KillProcess(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void TimerExpiredTask::OnObjectSignaled(HANDLE object) { | 73 void TimerExpiredTask::OnObjectSignaled(HANDLE object) { |
| 74 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed. | 74 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed. |
| 75 tracked_objects::ScopedTracker tracking_profile( | 75 tracked_objects::ScopedTracker tracking_profile( |
| 76 FROM_HERE_WITH_EXPLICIT_FUNCTION("TimerExpiredTask_OnObjectSignaled")); | 76 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 77 "418183 TimerExpiredTask::OnObjectSignaled")); |
| 77 | 78 |
| 78 process_.Close(); | 79 process_.Close(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void TimerExpiredTask::KillProcess() { | 82 void TimerExpiredTask::KillProcess() { |
| 82 // Stop watching the process handle since we're killing it. | 83 // Stop watching the process handle since we're killing it. |
| 83 watcher_.StopWatching(); | 84 watcher_.StopWatching(); |
| 84 | 85 |
| 85 // OK, time to get frisky. We don't actually care when the process | 86 // OK, time to get frisky. We don't actually care when the process |
| 86 // terminates. We just care that it eventually terminates, and that's what | 87 // terminates. We just care that it eventually terminates, and that's what |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 249 } |
| 249 | 250 |
| 250 MessageLoop::current()->PostDelayedTask( | 251 MessageLoop::current()->PostDelayedTask( |
| 251 FROM_HERE, | 252 FROM_HERE, |
| 252 base::Bind(&TimerExpiredTask::TimedOut, | 253 base::Bind(&TimerExpiredTask::TimedOut, |
| 253 base::Owned(new TimerExpiredTask(process.Pass()))), | 254 base::Owned(new TimerExpiredTask(process.Pass()))), |
| 254 base::TimeDelta::FromMilliseconds(kWaitInterval)); | 255 base::TimeDelta::FromMilliseconds(kWaitInterval)); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace base | 258 } // namespace base |
| OLD | NEW |