| 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/process_util.h" |
| 9 #include "base/win/object_watcher.h" | 10 #include "base/win/object_watcher.h" |
| 10 #include "content/common/result_codes.h" | 11 #include "content/public/common/result_codes.h" |
| 11 | 12 |
| 12 // Maximum amount of time (in milliseconds) to wait for the process to exit. | 13 // Maximum amount of time (in milliseconds) to wait for the process to exit. |
| 13 static const int kWaitInterval = 2000; | 14 static const int kWaitInterval = 2000; |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class TimerExpiredTask : public Task, | 18 class TimerExpiredTask : public Task, |
| 18 public base::win::ObjectWatcher::Delegate { | 19 public base::win::ObjectWatcher::Delegate { |
| 19 public: | 20 public: |
| 20 explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) { | 21 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! | 76 // If already signaled, then we are done! |
| 76 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { | 77 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { |
| 77 CloseHandle(process); | 78 CloseHandle(process); |
| 78 return; | 79 return; |
| 79 } | 80 } |
| 80 | 81 |
| 81 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 82 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 82 new TimerExpiredTask(process), | 83 new TimerExpiredTask(process), |
| 83 kWaitInterval); | 84 kWaitInterval); |
| 84 } | 85 } |
| OLD | NEW |