Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_HANDLE_ENUMERATOR_WIN_H_ | |
| 6 #define CONTENT_BROWSER_HANDLE_ENUMERATOR_WIN_H_ | |
| 7 | |
| 8 //#include <windows.h> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/process.h" | |
| 12 #include "content/common/child_process_info.h" | |
| 13 | |
| 14 enum HandleType { | |
|
jam
2011/06/08 22:06:38
please add put this whole file inside the content
Cris Neckar
2011/06/09 18:20:13
Done.
| |
| 15 ProcessHandle, | |
| 16 ThreadHandle, | |
| 17 FileHandle, | |
| 18 DirectoryHandle, | |
| 19 KeyHandle, | |
| 20 WindowStationHandle, | |
| 21 DesktopHandle, | |
| 22 ServiceHandle, | |
| 23 EventHandle, | |
| 24 MutexHandle, | |
| 25 SemaphoreHandle, | |
| 26 TimerHandle, | |
| 27 NamedPipeHandle, | |
| 28 JobHandle, | |
| 29 FileMapHandle, | |
| 30 OtherHandle | |
| 31 }; | |
| 32 | |
| 33 static HandleType StringToHandleType(const string16& type); | |
| 34 | |
| 35 static string16 ProcessTypeString(ChildProcessInfo::ProcessType process_type); | |
| 36 | |
| 37 static string16 GetAccessString(HandleType handle_type, ACCESS_MASK access); | |
| 38 | |
| 39 class HandleEnumerator : public base::RefCountedThreadSafe<HandleEnumerator> { | |
| 40 public: | |
| 41 enum HandleEnumStatus { | |
| 42 Starting, | |
| 43 InProgress, | |
| 44 Finished | |
| 45 }; | |
| 46 | |
| 47 HandleEnumerator(base::ProcessHandle handle, bool all_handles): | |
| 48 handle_(handle), | |
| 49 type_(ChildProcessInfo::UNKNOWN_PROCESS), | |
| 50 status_(Starting), | |
| 51 all_handles_(all_handles) { } | |
| 52 | |
| 53 ChildProcessInfo::ProcessType type() const { return type_; } | |
| 54 | |
| 55 HandleEnumStatus status() const { return status_; } | |
| 56 | |
| 57 void RunHandleEnumeration(); | |
| 58 | |
| 59 void EnumerateHandles(); | |
| 60 | |
| 61 private: | |
| 62 void FindProcessOnIOThread(); | |
| 63 | |
| 64 void FindProcessOnUIThread(); | |
| 65 | |
| 66 void EnumerateHandlesAndTerminateProcess(); | |
| 67 | |
| 68 base::ProcessHandle handle_; | |
| 69 ChildProcessInfo::ProcessType type_; | |
| 70 HandleEnumStatus status_; | |
| 71 bool all_handles_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(HandleEnumerator); | |
| 74 }; | |
| 75 | |
| 76 #endif // CONTENT_BROWSER_HANDLE_ENUMERATOR_WIN_H_ | |
| OLD | NEW |