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

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

Issue 567383002: Fixed a leak in StringTraceDataSink following b47076f (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/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 virtual void SetSystemTrace(const std::string& data) OVERRIDE { 129 virtual void SetSystemTrace(const std::string& data) OVERRIDE {
130 system_trace_ = data; 130 system_trace_ = data;
131 } 131 }
132 virtual void Close() OVERRIDE { 132 virtual void Close() OVERRIDE {
133 std::string result = "{\"traceEvents\":[" + trace_ + "]"; 133 std::string result = "{\"traceEvents\":[" + trace_ + "]";
134 if (!system_trace_.empty()) 134 if (!system_trace_.empty())
135 result += ",\"systemTraceEvents\": " + system_trace_; 135 result += ",\"systemTraceEvents\": " + system_trace_;
136 result += "}"; 136 result += "}";
137 137
138 completion_callback_.Run(base::RefCountedString::TakeString(&result)); 138 scoped_refptr<base::RefCountedString> str =
139 base::RefCountedString::TakeString(&result);
140 completion_callback_.Run(str.get());
139 } 141 }
140 142
141 private: 143 private:
142 virtual ~StringTraceDataSink() {} 144 virtual ~StringTraceDataSink() {}
143 145
144 std::string trace_; 146 std::string trace_;
145 std::string system_trace_; 147 std::string system_trace_;
146 CompletionCallback completion_callback_; 148 CompletionCallback completion_callback_;
147 149
148 DISALLOW_COPY_AND_ASSIGN(StringTraceDataSink); 150 DISALLOW_COPY_AND_ASSIGN(StringTraceDataSink);
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 is_monitoring_ = is_monitoring; 871 is_monitoring_ = is_monitoring;
870 #if !defined(OS_ANDROID) 872 #if !defined(OS_ANDROID)
871 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); 873 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin();
872 it != tracing_uis_.end(); it++) { 874 it != tracing_uis_.end(); it++) {
873 (*it)->OnMonitoringStateChanged(is_monitoring); 875 (*it)->OnMonitoringStateChanged(is_monitoring);
874 } 876 }
875 #endif 877 #endif
876 } 878 }
877 879
878 } // namespace content 880 } // 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