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

Unified Diff: base/debug/trace_event.cc

Issue 8369021: Revert: Internalize JSON chunk merging to trace_event.h API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | « base/debug/trace_event.h ('k') | base/debug/trace_event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event.cc
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index 3e03d4afae69a0a909658a40f1b0ea70bf97c015..347644f982ef3a4f3cd260b55a8b452e5217db3e 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -9,7 +9,6 @@
#if defined(OS_WIN)
#include "base/debug/trace_event_win.h"
#endif
-#include "base/bind.h"
#include "base/format_macros.h"
#include "base/memory/ref_counted_memory.h"
#include "base/process_util.h"
@@ -225,11 +224,13 @@ void TraceEvent::AppendEventsAsJSON(const std::vector<TraceEvent>& events,
size_t start,
size_t count,
std::string* out) {
+ *out += "[";
for (size_t i = 0; i < count && start + i < events.size(); ++i) {
if (i > 0)
*out += ",";
events[i + start].AppendAsJSON(out);
}
+ *out += "]";
}
void TraceEvent::AppendAsJSON(std::string* out) const {
@@ -261,48 +262,6 @@ void TraceEvent::AppendAsJSON(std::string* out) const {
////////////////////////////////////////////////////////////////////////////////
//
-// TraceResultBuffer
-//
-////////////////////////////////////////////////////////////////////////////////
-
-TraceResultBuffer::OutputCallback
- TraceResultBuffer::SimpleOutput::GetCallback() {
- return base::Bind(&SimpleOutput::Append, base::Unretained(this));
-}
-
-void TraceResultBuffer::SimpleOutput::Append(
- const std::string& json_trace_output) {
- json_output += json_trace_output;
-}
-
-TraceResultBuffer::TraceResultBuffer() : append_comma_(false) {
-}
-
-TraceResultBuffer::~TraceResultBuffer() {
-}
-
-void TraceResultBuffer::SetOutputCallback(OutputCallback json_chunk_callback) {
- output_callback_ = json_chunk_callback;
-}
-
-void TraceResultBuffer::Start() {
- append_comma_ = false;
- output_callback_.Run("[");
-}
-
-void TraceResultBuffer::AddFragment(const std::string& trace_fragment) {
- if (append_comma_)
- output_callback_.Run(",");
- append_comma_ = true;
- output_callback_.Run(trace_fragment);
-}
-
-void TraceResultBuffer::Finish() {
- output_callback_.Run("]");
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
// TraceLog
//
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698