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

Side by Side Diff: trunk/src/content/browser/browser_shutdown_profile_dumper.cc

Issue 105823009: Revert 239280 "Move more file_util functions to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/browser_shutdown_profile_dumper.h" 5 #include "content/browser/browser_shutdown_profile_dumper.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/debug/trace_event_impl.h" 10 #include "base/debug/trace_event_impl.h"
(...skipping 19 matching lines...) Expand all
30 void BrowserShutdownProfileDumper::WriteTracesToDisc( 30 void BrowserShutdownProfileDumper::WriteTracesToDisc(
31 const base::FilePath& file_name) { 31 const base::FilePath& file_name) {
32 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily. 32 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily.
33 // Since the tracer stops when the trace buffer is filled, we'd rather save 33 // Since the tracer stops when the trace buffer is filled, we'd rather save
34 // what we have than nothing since we might see from the amount of events 34 // what we have than nothing since we might see from the amount of events
35 // that caused the problem. 35 // that caused the problem.
36 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is %" << 36 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is %" <<
37 base::debug::TraceLog::GetInstance()->GetBufferPercentFull() << 37 base::debug::TraceLog::GetInstance()->GetBufferPercentFull() <<
38 " full."; 38 " full.";
39 DCHECK(!dump_file_); 39 DCHECK(!dump_file_);
40 dump_file_ = base::OpenFile(file_name, "w+"); 40 dump_file_ = file_util::OpenFile(file_name, "w+");
41 if (!IsFileValid()) { 41 if (!IsFileValid()) {
42 LOG(ERROR) << "Failed to open performance trace file: " << 42 LOG(ERROR) << "Failed to open performance trace file: " <<
43 file_name.value(); 43 file_name.value();
44 return; 44 return;
45 } 45 }
46 WriteString("{\"traceEvents\":"); 46 WriteString("{\"traceEvents\":");
47 WriteString("["); 47 WriteString("[");
48 48
49 // TraceLog::Flush() requires the calling thread to have a message loop. 49 // TraceLog::Flush() requires the calling thread to have a message loop.
50 // As the message loop of the current thread may have quit, start another 50 // As the message loop of the current thread may have quit, start another
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (written != size) { 124 if (written != size) {
125 LOG(ERROR) << "Error " << ferror(dump_file_) << 125 LOG(ERROR) << "Error " << ferror(dump_file_) <<
126 " in fwrite() to trace file"; 126 " in fwrite() to trace file";
127 CloseFile(); 127 CloseFile();
128 } 128 }
129 } 129 }
130 130
131 void BrowserShutdownProfileDumper::CloseFile() { 131 void BrowserShutdownProfileDumper::CloseFile() {
132 if (!dump_file_) 132 if (!dump_file_)
133 return; 133 return;
134 base::CloseFile(dump_file_); 134 file_util::CloseFile(dump_file_);
135 dump_file_ = NULL; 135 dump_file_ = NULL;
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698