| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |