Chromium Code Reviews| Index: content/browser/handle_enumerator_win.h |
| =================================================================== |
| --- content/browser/handle_enumerator_win.h (revision 0) |
| +++ content/browser/handle_enumerator_win.h (revision 0) |
| @@ -0,0 +1,81 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_HANDLE_ENUMERATION_WIN_H_ |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
the header guards are not to chrome standard
Cris Neckar
2011/06/08 18:39:21
Done.
|
| +#define BASE_HANDLE_ENUMERATION_WIN_H_ |
| + |
| +#include <windows.h> |
| + |
| +#include "base/base_api.h" |
| +#include "base/basictypes.h" |
| +#include "base/process.h" |
| +#include "base/utf_string_conversions.h" |
| +#include "build/build_config.h" |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
some of these headers seem not necessary, like bui
Cris Neckar
2011/06/08 18:39:21
Done.
|
| +#include "content/browser/renderer_host/render_process_host.h" |
| +#include "content/common/child_process_info.h" |
| +#include "sandbox/tools/finder/ntundoc.h" |
| + |
| +const wchar_t kNtdllDllName[] = L"ntdll.dll"; |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
can this constant and the next move to the cc file
Cris Neckar
2011/06/08 18:39:21
Done.
|
| +const size_t kMaxHandleNameLength = 1024; |
| + |
| +typedef enum _HANDLE_TYPE { |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
c++ does not need the typedef thing and the _HANDL
Cris Neckar
2011/06/08 18:39:21
Done.
|
| + ProcessHandle, |
| + ThreadHandle, |
| + FileHandle, |
| + DirectoryHandle, |
| + KeyHandle, |
| + WindowStationHandle, |
| + DesktopHandle, |
| + ServiceHandle, |
| + EventHandle, |
| + MutexHandle, |
| + SemaphoreHandle, |
| + TimerHandle, |
| + NamedPipeHandle, |
| + JobHandle, |
| + FileMapHandle, |
| + OtherHandle |
| +} HandleType; |
| + |
| +class HandleEnumerator : public base::RefCountedThreadSafe<HandleEnumerator> { |
| + public: |
| + enum HandleEnumStatus { |
| + Starting, |
| + InProgress, |
| + Finished |
| + }; |
| + |
| + HandleEnumerator(base::ProcessHandle handle): |
| + handle_(handle), |
| + type_(ChildProcessInfo::UNKNOWN_PROCESS), |
| + status_(Starting) { } |
| + |
| + ChildProcessInfo::ProcessType type() { return type_; } |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
this function and the next can be const
Cris Neckar
2011/06/08 18:39:21
Done.
|
| + |
| + HandleEnumStatus status() { return status_; } |
| + |
| + void RunHandleEnumeration(); |
| + |
| + void EnumerateHandles(); |
| + |
| + static HandleType StringToHandleType(string16 type); |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
const string16& type ?
Cris Neckar
2011/06/08 18:39:21
Done.
|
| + |
| + static string16 ProcessTypeString(ChildProcessInfo::ProcessType process_type); |
| + |
| + static string16 GetAccessString(HandleType handle_type, |
| + ACCESS_MASK access); |
| + |
| + private: |
| + void FindProcessOnIOThread(); |
| + |
| + void FindProcessOnUIThread(); |
| + |
| + void EnumerateHandlesAndTerminateProcess(); |
| + |
| + base::ProcessHandle handle_; |
| + ChildProcessInfo::ProcessType type_; |
| + HandleEnumStatus status_; |
| +}; |
|
cpu_(ooo_6.6-7.5)
2011/06/08 02:23:28
DISALLOW_COPY_AND_ASSIGN
Cris Neckar
2011/06/08 18:39:21
Done.
|
| + |
| +#endif // BASE_HANDLE_ENUMERATION_WIN_H_ |