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

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

Issue 892213004: Mechanical rename of base::debug -> base::trace_event for /content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_trace_part3_1
Patch Set: Rebase. Created 5 years, 10 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
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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 12 matching lines...) Expand all
23 : dump_file_name_(dump_file_name), 23 : dump_file_name_(dump_file_name),
24 blocks_(0), 24 blocks_(0),
25 dump_file_(NULL) { 25 dump_file_(NULL) {
26 } 26 }
27 27
28 BrowserShutdownProfileDumper::~BrowserShutdownProfileDumper() { 28 BrowserShutdownProfileDumper::~BrowserShutdownProfileDumper() {
29 WriteTracesToDisc(); 29 WriteTracesToDisc();
30 } 30 }
31 31
32 static float GetTraceBufferPercentFull() { 32 static float GetTraceBufferPercentFull() {
33 base::debug::TraceLogStatus status = 33 base::trace_event::TraceLogStatus status =
34 base::debug::TraceLog::GetInstance()->GetStatus(); 34 base::trace_event::TraceLog::GetInstance()->GetStatus();
35 return 100 * static_cast<float>(static_cast<double>(status.event_count) / 35 return 100 * static_cast<float>(static_cast<double>(status.event_count) /
36 status.event_capacity); 36 status.event_capacity);
37 } 37 }
38 38
39 void BrowserShutdownProfileDumper::WriteTracesToDisc() { 39 void BrowserShutdownProfileDumper::WriteTracesToDisc() {
40 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily. 40 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily.
41 // Since the tracer stops when the trace buffer is filled, we'd rather save 41 // Since the tracer stops when the trace buffer is filled, we'd rather save
42 // what we have than nothing since we might see from the amount of events 42 // what we have than nothing since we might see from the amount of events
43 // that caused the problem. 43 // that caused the problem.
44 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is " 44 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is "
(...skipping 20 matching lines...) Expand all
65 base::Unretained(this), 65 base::Unretained(this),
66 base::Unretained(&flush_complete_event))); 66 base::Unretained(&flush_complete_event)));
67 67
68 bool original_wait_allowed = base::ThreadRestrictions::SetWaitAllowed(true); 68 bool original_wait_allowed = base::ThreadRestrictions::SetWaitAllowed(true);
69 flush_complete_event.Wait(); 69 flush_complete_event.Wait();
70 base::ThreadRestrictions::SetWaitAllowed(original_wait_allowed); 70 base::ThreadRestrictions::SetWaitAllowed(original_wait_allowed);
71 } 71 }
72 72
73 void BrowserShutdownProfileDumper::EndTraceAndFlush( 73 void BrowserShutdownProfileDumper::EndTraceAndFlush(
74 base::WaitableEvent* flush_complete_event) { 74 base::WaitableEvent* flush_complete_event) {
75 base::debug::TraceLog::GetInstance()->SetDisabled(); 75 base::trace_event::TraceLog::GetInstance()->SetDisabled();
76 base::debug::TraceLog::GetInstance()->Flush( 76 base::trace_event::TraceLog::GetInstance()->Flush(
77 base::Bind(&BrowserShutdownProfileDumper::WriteTraceDataCollected, 77 base::Bind(&BrowserShutdownProfileDumper::WriteTraceDataCollected,
78 base::Unretained(this), 78 base::Unretained(this),
79 base::Unretained(flush_complete_event))); 79 base::Unretained(flush_complete_event)));
80 } 80 }
81 81
82 // static 82 // static
83 base::FilePath BrowserShutdownProfileDumper::GetShutdownProfileFileName() { 83 base::FilePath BrowserShutdownProfileDumper::GetShutdownProfileFileName() {
84 const base::CommandLine& command_line = 84 const base::CommandLine& command_line =
85 *base::CommandLine::ForCurrentProcess(); 85 *base::CommandLine::ForCurrentProcess();
86 base::FilePath trace_file = 86 base::FilePath trace_file =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 void BrowserShutdownProfileDumper::CloseFile() { 141 void BrowserShutdownProfileDumper::CloseFile() {
142 if (!dump_file_) 142 if (!dump_file_)
143 return; 143 return;
144 base::CloseFile(dump_file_); 144 base::CloseFile(dump_file_);
145 dump_file_ = NULL; 145 dump_file_ = NULL;
146 } 146 }
147 147
148 } // namespace content 148 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/devtools/protocol/tracing_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698