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

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

Issue 276016: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lint Created 11 years, 2 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 | « skia/ext/vector_canvas_unittest.cc ('k') | webkit/default_plugin/plugin_database_handler.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) 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 #include <windows.h> 5 #include <windows.h>
6 #include <tlhelp32.h> // for CreateToolhelp32Snapshot() 6 #include <tlhelp32.h> // for CreateToolhelp32Snapshot()
7 #include <map> 7 #include <map>
8 8
9 #include "tools/memory_watcher/memory_watcher.h" 9 #include "tools/memory_watcher/memory_watcher.h"
10 #include "base/file_util.h" 10 #include "base/file_util.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(tmp_name, ASCIIToWide(file_name_)); 85 file_util::Move(FilePath::FromWStringHack(tmp_name),
86 FilePath::FromWStringHack(ASCIIToWide(file_name_)));
86 } 87 }
87 } 88 }
88 89
89 void MemoryWatcher::OnTrack(HANDLE heap, int32 id, int32 size) { 90 void MemoryWatcher::OnTrack(HANDLE heap, int32 id, int32 size) {
90 // AllocationStack overrides new/delete to not allocate 91 // AllocationStack overrides new/delete to not allocate
91 // from the main heap. 92 // from the main heap.
92 AllocationStack* stack = new AllocationStack(size); 93 AllocationStack* stack = new AllocationStack(size);
93 { 94 {
94 // Don't track zeroes. It's a waste of time. 95 // Don't track zeroes. It's a waste of time.
95 if (size == 0) { 96 if (size == 0) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 std::string output; 198 std::string output;
198 stack->ToString(&output); 199 stack->ToString(&output);
199 fprintf(file_, "%s", output.c_str()); 200 fprintf(file_, "%s", output.c_str());
200 it++; 201 it++;
201 } 202 }
202 fprintf(file_, "Total Leaks: %d\n", block_map_->size()); 203 fprintf(file_, "Total Leaks: %d\n", block_map_->size());
203 fprintf(file_, "Total Stacks: %d\n", stack_map_->size()); 204 fprintf(file_, "Total Stacks: %d\n", stack_map_->size());
204 fprintf(file_, "Total Bytes: %d\n", block_map_size_); 205 fprintf(file_, "Total Bytes: %d\n", block_map_size_);
205 CloseLogFile(); 206 CloseLogFile();
206 } 207 }
OLDNEW
« no previous file with comments | « skia/ext/vector_canvas_unittest.cc ('k') | webkit/default_plugin/plugin_database_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698