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

Side by Side Diff: net/log/trace_net_log_observer.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 | « net/log/test_net_log_entry.cc ('k') | net/log/write_to_file_net_log_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/log/trace_net_log_observer.h" 5 #include "net/log/trace_net_log_observer.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 class TracedValue : public base::trace_event::ConvertableToTraceFormat { 25 class TracedValue : public base::trace_event::ConvertableToTraceFormat {
26 public: 26 public:
27 explicit TracedValue(scoped_ptr<base::Value> value) : value_(value.Pass()) {} 27 explicit TracedValue(scoped_ptr<base::Value> value) : value_(value.Pass()) {}
28 28
29 private: 29 private:
30 ~TracedValue() override {} 30 ~TracedValue() override {}
31 31
32 void AppendAsTraceFormat(std::string* out) const override { 32 void AppendAsTraceFormat(std::string* out) const override {
33 if (value_) { 33 if (value_) {
34 std::string tmp; 34 std::string tmp;
35 base::JSONWriter::Write(value_.get(), &tmp); 35 base::JSONWriter::Write(*value_, &tmp);
36 *out += tmp; 36 *out += tmp;
37 } else { 37 } else {
38 *out += "\"\""; 38 *out += "\"\"";
39 } 39 }
40 } 40 }
41 41
42 private: 42 private:
43 scoped_ptr<base::Value> value_; 43 scoped_ptr<base::Value> value_;
44 }; 44 };
45 45
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void TraceNetLogObserver::OnTraceLogEnabled() { 102 void TraceNetLogObserver::OnTraceLogEnabled() {
103 net_log_to_watch_->DeprecatedAddObserver(this, NetLogCaptureMode::Default()); 103 net_log_to_watch_->DeprecatedAddObserver(this, NetLogCaptureMode::Default());
104 } 104 }
105 105
106 void TraceNetLogObserver::OnTraceLogDisabled() { 106 void TraceNetLogObserver::OnTraceLogDisabled() {
107 if (net_log()) 107 if (net_log())
108 net_log()->DeprecatedRemoveObserver(this); 108 net_log()->DeprecatedRemoveObserver(this);
109 } 109 }
110 110
111 } // namespace net 111 } // namespace net
OLDNEW
« no previous file with comments | « net/log/test_net_log_entry.cc ('k') | net/log/write_to_file_net_log_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698