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

Side by Side Diff: tools/memory_watcher/dllmain.cc

Issue 366031: Support running memory watch under vista, plus other tweaks... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « tools/memory_watcher/call_stack.cc ('k') | tools/memory_watcher/memory_hook.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // The memory_watcher.dll is hooked by simply linking it. When we get the 5 // The memory_watcher.dll is hooked by simply linking it. When we get the
6 // windows notification that this DLL is loaded, we do a few things: 6 // windows notification that this DLL is loaded, we do a few things:
7 // 1) Register a Hot Key. 7 // 1) Register a Hot Key.
8 // Only one process can hook the Hot Key, so one will get it, and the 8 // Only one process can hook the Hot Key, so one will get it, and the
9 // others will silently fail. 9 // others will silently fail.
10 // 2) Create a thread to wait on an event. 10 // 2) Create a thread to wait on an event.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Thread for watching for key events. 53 // Thread for watching for key events.
54 DWORD WINAPI ThreadMain(LPVOID) { 54 DWORD WINAPI ThreadMain(LPVOID) {
55 bool stopping = false; 55 bool stopping = false;
56 HANDLE events[2] = { g_dump_event, g_quit_event }; 56 HANDLE events[2] = { g_dump_event, g_quit_event };
57 while (!stopping) { 57 while (!stopping) {
58 DWORD rv = WaitForMultipleObjects(2, events, FALSE, INFINITE); 58 DWORD rv = WaitForMultipleObjects(2, events, FALSE, INFINITE);
59 switch (rv) { 59 switch (rv) {
60 case WAIT_OBJECT_0: 60 case WAIT_OBJECT_0:
61 if (g_memory_watcher) { 61 if (g_memory_watcher) {
62 g_memory_watcher->DumpLeaks(); 62 g_memory_watcher->DumpLeaks();
63 // After dumping, we teardown.
64 ExitProcess(0);
65 } 63 }
64 stopping = true;
66 break; 65 break;
67 case WAIT_OBJECT_0 + 1: 66 case WAIT_OBJECT_0 + 1:
68 stopping = true; 67 stopping = true;
69 break; 68 break;
70 default: 69 default:
71 NOTREACHED(); 70 NOTREACHED();
72 break; 71 break;
73 } 72 }
74 } 73 }
75 return 0; 74 return 0;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 break; 135 break;
137 } 136 }
138 return TRUE; 137 return TRUE;
139 } 138 }
140 139
141 __declspec(dllexport) void __cdecl SetLogName(char* name) { 140 __declspec(dllexport) void __cdecl SetLogName(char* name) {
142 g_memory_watcher->SetLogName(name); 141 g_memory_watcher->SetLogName(name);
143 } 142 }
144 143
145 } // extern "C" 144 } // extern "C"
OLDNEW
« no previous file with comments | « tools/memory_watcher/call_stack.cc ('k') | tools/memory_watcher/memory_hook.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698