OLD | NEW |
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 | 4 |
5 #include "net/log/net_log.h" | 5 #include "net/log/net_log.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 public: | 127 public: |
128 LoggingObserver() {} | 128 LoggingObserver() {} |
129 | 129 |
130 ~LoggingObserver() override { | 130 ~LoggingObserver() override { |
131 if (net_log()) | 131 if (net_log()) |
132 net_log()->DeprecatedRemoveObserver(this); | 132 net_log()->DeprecatedRemoveObserver(this); |
133 } | 133 } |
134 | 134 |
135 void OnAddEntry(const NetLog::Entry& entry) override { | 135 void OnAddEntry(const NetLog::Entry& entry) override { |
136 std::unique_ptr<base::DictionaryValue> dict = | 136 std::unique_ptr<base::DictionaryValue> dict = |
137 base::DictionaryValue::From(base::WrapUnique(entry.ToValue())); | 137 base::DictionaryValue::From(entry.ToValue()); |
138 ASSERT_TRUE(dict); | 138 ASSERT_TRUE(dict); |
139 values_.push_back(std::move(dict)); | 139 values_.push_back(std::move(dict)); |
140 } | 140 } |
141 | 141 |
142 size_t GetNumValues() const { return values_.size(); } | 142 size_t GetNumValues() const { return values_.size(); } |
143 base::DictionaryValue* GetValue(size_t index) const { | 143 base::DictionaryValue* GetValue(size_t index) const { |
144 return values_[index].get(); | 144 return values_[index].get(); |
145 } | 145 } |
146 | 146 |
147 private: | 147 private: |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 NetLog net_log; | 396 NetLog net_log; |
397 | 397 |
398 // Run a bunch of threads to completion, each of which will repeatedly add | 398 // Run a bunch of threads to completion, each of which will repeatedly add |
399 // and remove an observer, and set its logging level. | 399 // and remove an observer, and set its logging level. |
400 RunTestThreads<AddRemoveObserverTestThread>(&net_log); | 400 RunTestThreads<AddRemoveObserverTestThread>(&net_log); |
401 } | 401 } |
402 | 402 |
403 } // namespace | 403 } // namespace |
404 | 404 |
405 } // namespace net | 405 } // namespace net |
OLD | NEW |