OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/test/chrome_process_util.h" | 5 #include "chrome/test/chrome_process_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 std::vector<base::ProcessHandle>::const_iterator it; | 37 std::vector<base::ProcessHandle>::const_iterator it; |
38 for (it = handles.begin(); it != handles.end(); ++it) | 38 for (it = handles.begin(); it != handles.end(); ++it) |
39 base::KillProcess(*it, ResultCodes::TASKMAN_KILL, false); | 39 base::KillProcess(*it, ResultCodes::TASKMAN_KILL, false); |
40 | 40 |
41 const Time start = Time::Now(); | 41 const Time start = Time::Now(); |
42 for (it = handles.begin(); | 42 for (it = handles.begin(); |
43 it != handles.end() && Time::Now() - start < kExitTimeout; | 43 it != handles.end() && Time::Now() - start < kExitTimeout; |
44 ++it) { | 44 ++it) { |
45 // TODO(phajdan.jr): Fix int/int64 problems with TimeDelta::InMilliseconds. | 45 int64 wait_time_ms = (Time::Now() - start).InMilliseconds(); |
46 int wait_time_ms = static_cast<int>((Time::Now() - start).InMilliseconds()); | |
47 base::WaitForSingleProcess(*it, wait_time_ms); | 46 base::WaitForSingleProcess(*it, wait_time_ms); |
48 } | 47 } |
49 | 48 |
50 for (it = handles.begin(); it != handles.end(); ++it) | 49 for (it = handles.begin(); it != handles.end(); ++it) |
51 base::CloseProcessHandle(*it); | 50 base::CloseProcessHandle(*it); |
52 } | 51 } |
53 | 52 |
54 class ChildProcessFilter : public base::ProcessFilter { | 53 class ChildProcessFilter : public base::ProcessFilter { |
55 public: | 54 public: |
56 explicit ChildProcessFilter(base::ProcessId parent_pid) | 55 explicit ChildProcessFilter(base::ProcessId parent_pid) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 &filter); | 97 &filter); |
99 while ((process_entry = it.NextProcessEntry())) | 98 while ((process_entry = it.NextProcessEntry())) |
100 result.push_back(process_entry->pid); | 99 result.push_back(process_entry->pid); |
101 } | 100 } |
102 #endif | 101 #endif |
103 | 102 |
104 result.push_back(browser_pid); | 103 result.push_back(browser_pid); |
105 | 104 |
106 return result; | 105 return result; |
107 } | 106 } |
OLD | NEW |