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

Side by Side Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 583583002: Tracing: fix missing comma between trace chunks written to file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "content/browser/tracing/tracing_controller_impl.h" 4 #include "content/browser/tracing/tracing_controller_impl.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 BrowserThread::FILE, 61 BrowserThread::FILE,
62 FROM_HERE, 62 FROM_HERE,
63 base::Bind(&FileTraceDataSink::CloseOnFileThread, this)); 63 base::Bind(&FileTraceDataSink::CloseOnFileThread, this));
64 } 64 }
65 65
66 private: 66 private:
67 virtual ~FileTraceDataSink() { DCHECK(file_ == NULL); } 67 virtual ~FileTraceDataSink() { DCHECK(file_ == NULL); }
68 68
69 void AddTraceChunkOnFileThread( 69 void AddTraceChunkOnFileThread(
70 const scoped_refptr<base::RefCountedString> chunk) { 70 const scoped_refptr<base::RefCountedString> chunk) {
71 if (!OpenFileIfNeededOnFileThread()) 71 if (file_ != NULL)
72 fputc(',', file_);
73 else if (!OpenFileIfNeededOnFileThread())
72 return; 74 return;
73 ignore_result(fwrite(chunk->data().c_str(), strlen(chunk->data().c_str()), 75 ignore_result(fwrite(chunk->data().c_str(), strlen(chunk->data().c_str()),
74 1, file_)); 76 1, file_));
75 } 77 }
76 78
77 bool OpenFileIfNeededOnFileThread() { 79 bool OpenFileIfNeededOnFileThread() {
78 if (file_ != NULL) 80 if (file_ != NULL)
79 return true; 81 return true;
80 file_ = base::OpenFile(file_path_, "w"); 82 file_ = base::OpenFile(file_path_, "w");
81 if (file_ == NULL) { 83 if (file_ == NULL) {
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 is_monitoring_ = is_monitoring; 877 is_monitoring_ = is_monitoring;
876 #if !defined(OS_ANDROID) 878 #if !defined(OS_ANDROID)
877 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); 879 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin();
878 it != tracing_uis_.end(); it++) { 880 it != tracing_uis_.end(); it++) {
879 (*it)->OnMonitoringStateChanged(is_monitoring); 881 (*it)->OnMonitoringStateChanged(is_monitoring);
880 } 882 }
881 #endif 883 #endif
882 } 884 }
883 885
884 } // namespace content 886 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698