Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: content/browser/handle_enumerator_win.h

Issue 7054080: Add a flag to print the handles held by a child process when it shuts down. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 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.
6 #define BASE_HANDLE_ENUMERATION_WIN_H_
7
8 #include <windows.h>
9
10 #include "base/base_api.h"
11 #include "base/basictypes.h"
12 #include "base/process.h"
13 #include "base/utf_string_conversions.h"
14 #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.
15 #include "content/browser/renderer_host/render_process_host.h"
16 #include "content/common/child_process_info.h"
17 #include "sandbox/tools/finder/ntundoc.h"
18
19 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.
20 const size_t kMaxHandleNameLength = 1024;
21
22 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.
23 ProcessHandle,
24 ThreadHandle,
25 FileHandle,
26 DirectoryHandle,
27 KeyHandle,
28 WindowStationHandle,
29 DesktopHandle,
30 ServiceHandle,
31 EventHandle,
32 MutexHandle,
33 SemaphoreHandle,
34 TimerHandle,
35 NamedPipeHandle,
36 JobHandle,
37 FileMapHandle,
38 OtherHandle
39 } HandleType;
40
41 class HandleEnumerator : public base::RefCountedThreadSafe<HandleEnumerator> {
42 public:
43 enum HandleEnumStatus {
44 Starting,
45 InProgress,
46 Finished
47 };
48
49 HandleEnumerator(base::ProcessHandle handle):
50 handle_(handle),
51 type_(ChildProcessInfo::UNKNOWN_PROCESS),
52 status_(Starting) { }
53
54 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.
55
56 HandleEnumStatus status() { return status_; }
57
58 void RunHandleEnumeration();
59
60 void EnumerateHandles();
61
62 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.
63
64 static string16 ProcessTypeString(ChildProcessInfo::ProcessType process_type);
65
66 static string16 GetAccessString(HandleType handle_type,
67 ACCESS_MASK access);
68
69 private:
70 void FindProcessOnIOThread();
71
72 void FindProcessOnUIThread();
73
74 void EnumerateHandlesAndTerminateProcess();
75
76 base::ProcessHandle handle_;
77 ChildProcessInfo::ProcessType type_;
78 HandleEnumStatus status_;
79 };
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.
80
81 #endif // BASE_HANDLE_ENUMERATION_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698