| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/process_watcher.h" | 5 #include "content/common/process_watcher.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/win/object_watcher.h" | 9 #include "base/win/object_watcher.h" |
| 10 #include "content/common/result_codes.h" | 10 #include "content/public/common/result_codes.h" |
| 11 | 11 |
| 12 // Maximum amount of time (in milliseconds) to wait for the process to exit. | 12 // Maximum amount of time (in milliseconds) to wait for the process to exit. |
| 13 static const int kWaitInterval = 2000; | 13 static const int kWaitInterval = 2000; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class TimerExpiredTask : public Task, | 17 class TimerExpiredTask : public Task, |
| 18 public base::win::ObjectWatcher::Delegate { | 18 public base::win::ObjectWatcher::Delegate { |
| 19 public: | 19 public: |
| 20 explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) { | 20 explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // If already signaled, then we are done! | 75 // If already signaled, then we are done! |
| 76 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { | 76 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { |
| 77 CloseHandle(process); | 77 CloseHandle(process); |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 | 80 |
| 81 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 81 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 82 new TimerExpiredTask(process), | 82 new TimerExpiredTask(process), |
| 83 kWaitInterval); | 83 kWaitInterval); |
| 84 } | 84 } |
| OLD | NEW |