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

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

Issue 18383003: Move DeleteAfterReboot and Move to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « third_party/leveldatabase/env_chromium.cc ('k') | webkit/browser/database/database_tracker.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <algorithm> 5 #include <algorithm>
6 #include <windows.h> 6 #include <windows.h>
7 #include <tlhelp32.h> // for CreateToolhelp32Snapshot() 7 #include <tlhelp32.h> // for CreateToolhelp32Snapshot()
8 #include <map> 8 #include <map>
9 9
10 #include "tools/memory_watcher/memory_watcher.h" 10 #include "tools/memory_watcher/memory_watcher.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 tmp_name += ".tmp"; 75 tmp_name += ".tmp";
76 file_ = fopen(tmp_name.c_str(), "w+"); 76 file_ = fopen(tmp_name.c_str(), "w+");
77 } 77 }
78 78
79 void MemoryWatcher::CloseLogFile() { 79 void MemoryWatcher::CloseLogFile() {
80 if (file_ != NULL) { 80 if (file_ != NULL) {
81 fclose(file_); 81 fclose(file_);
82 file_ = NULL; 82 file_ = NULL;
83 std::wstring tmp_name = ASCIIToWide(file_name_); 83 std::wstring tmp_name = ASCIIToWide(file_name_);
84 tmp_name += L".tmp"; 84 tmp_name += L".tmp";
85 file_util::Move(base::FilePath(tmp_name), 85 base::Move(base::FilePath(tmp_name),
86 base::FilePath(ASCIIToWide(file_name_))); 86 base::FilePath(ASCIIToWide(file_name_)));
87 } 87 }
88 } 88 }
89 89
90 bool MemoryWatcher::LockedRecursionDetected() const { 90 bool MemoryWatcher::LockedRecursionDetected() const {
91 if (!active_thread_id_) return false; 91 if (!active_thread_id_) return false;
92 DWORD thread_id = GetCurrentThreadId(); 92 DWORD thread_id = GetCurrentThreadId();
93 // TODO(jar): Perchance we should use atomic access to member. 93 // TODO(jar): Perchance we should use atomic access to member.
94 return thread_id == active_thread_id_; 94 return thread_id == active_thread_id_;
95 } 95 }
96 96
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 CallStack* stack = stack_track->stack; 246 CallStack* stack = stack_track->stack;
247 PrivateAllocatorString output; 247 PrivateAllocatorString output;
248 stack->ToString(&output); 248 stack->ToString(&output);
249 fprintf(file_, "%s", output.c_str()); 249 fprintf(file_, "%s", output.c_str());
250 } 250 }
251 fprintf(file_, "Total Leaks: %d\n", total_blocks); 251 fprintf(file_, "Total Leaks: %d\n", total_blocks);
252 fprintf(file_, "Total Stacks: %d\n", stack_tracks.size()); 252 fprintf(file_, "Total Stacks: %d\n", stack_tracks.size());
253 fprintf(file_, "Total Bytes: %d\n", total_bytes); 253 fprintf(file_, "Total Bytes: %d\n", total_bytes);
254 CloseLogFile(); 254 CloseLogFile();
255 } 255 }
OLDNEW
« no previous file with comments | « third_party/leveldatabase/env_chromium.cc ('k') | webkit/browser/database/database_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698