OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 base::Unretained(this), | 58 base::Unretained(this), |
59 base::Unretained(&flush_complete_event))); | 59 base::Unretained(&flush_complete_event))); |
60 | 60 |
61 bool original_wait_allowed = base::ThreadRestrictions::SetWaitAllowed(true); | 61 bool original_wait_allowed = base::ThreadRestrictions::SetWaitAllowed(true); |
62 flush_complete_event.Wait(); | 62 flush_complete_event.Wait(); |
63 base::ThreadRestrictions::SetWaitAllowed(original_wait_allowed); | 63 base::ThreadRestrictions::SetWaitAllowed(original_wait_allowed); |
64 } | 64 } |
65 | 65 |
66 void BrowserShutdownProfileDumper::EndTraceAndFlush( | 66 void BrowserShutdownProfileDumper::EndTraceAndFlush( |
67 base::WaitableEvent* flush_complete_event) { | 67 base::WaitableEvent* flush_complete_event) { |
68 while (base::debug::TraceLog::GetInstance()->IsEnabled()) | 68 base::debug::TraceLog::GetInstance()->SetDisabled(); |
69 base::debug::TraceLog::GetInstance()->SetDisabled(); | |
70 base::debug::TraceLog::GetInstance()->Flush( | 69 base::debug::TraceLog::GetInstance()->Flush( |
71 base::Bind(&BrowserShutdownProfileDumper::WriteTraceDataCollected, | 70 base::Bind(&BrowserShutdownProfileDumper::WriteTraceDataCollected, |
72 base::Unretained(this), | 71 base::Unretained(this), |
73 base::Unretained(flush_complete_event))); | 72 base::Unretained(flush_complete_event))); |
74 } | 73 } |
75 | 74 |
76 base::FilePath BrowserShutdownProfileDumper::GetFileName() { | 75 base::FilePath BrowserShutdownProfileDumper::GetFileName() { |
77 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 76 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
78 base::FilePath trace_file = | 77 base::FilePath trace_file = |
79 command_line.GetSwitchValuePath(switches::kTraceShutdownFile); | 78 command_line.GetSwitchValuePath(switches::kTraceShutdownFile); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 129 } |
131 | 130 |
132 void BrowserShutdownProfileDumper::CloseFile() { | 131 void BrowserShutdownProfileDumper::CloseFile() { |
133 if (!dump_file_) | 132 if (!dump_file_) |
134 return; | 133 return; |
135 file_util::CloseFile(dump_file_); | 134 file_util::CloseFile(dump_file_); |
136 dump_file_ = NULL; | 135 dump_file_ = NULL; |
137 } | 136 } |
138 | 137 |
139 } // namespace content | 138 } // namespace content |
OLD | NEW |