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

Unified Diff: content/browser/browser_shutdown_profile_dumper.cc

Issue 22962004: Thread-local trace-event buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update browser_shutdown_profile_dumper Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/browser_shutdown_profile_dumper.h ('k') | content/browser/tracing/trace_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_shutdown_profile_dumper.cc
diff --git a/content/browser/browser_shutdown_profile_dumper.cc b/content/browser/browser_shutdown_profile_dumper.cc
index 228e323ee7da0bcd3459cc01d35bb53872305562..fcf2299507f7c90045dd5af83682cfbf7ea62fd6 100644
--- a/content/browser/browser_shutdown_profile_dumper.cc
+++ b/content/browser/browser_shutdown_profile_dumper.cc
@@ -46,10 +46,6 @@ void BrowserShutdownProfileDumper::WriteTracesToDisc(
base::debug::TraceLog::GetInstance()->Flush(
base::Bind(&BrowserShutdownProfileDumper::WriteTraceDataCollected,
base::Unretained(this)));
-
- WriteString("]");
- WriteString("}");
- CloseFile();
}
base::FilePath BrowserShutdownProfileDumper::GetFileName() {
@@ -65,7 +61,8 @@ base::FilePath BrowserShutdownProfileDumper::GetFileName() {
}
void BrowserShutdownProfileDumper::WriteTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str) {
+ const scoped_refptr<base::RefCountedString>& events_str,
+ bool has_more_events) {
if (!IsFileValid())
return;
if (blocks_) {
@@ -75,6 +72,12 @@ void BrowserShutdownProfileDumper::WriteTraceDataCollected(
}
++blocks_;
WriteString(events_str->data());
+
+ if (!has_more_events) {
+ WriteString("]");
+ WriteString("}");
+ CloseFile();
+ }
}
bool BrowserShutdownProfileDumper::IsFileValid() {
« no previous file with comments | « content/browser/browser_shutdown_profile_dumper.h ('k') | content/browser/tracing/trace_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698