| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test_net_log.h" | 5 #include "net/log/test_net_log.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void Clear() { | 43 void Clear() { |
| 44 base::AutoLock lock(lock_); | 44 base::AutoLock lock(lock_); |
| 45 entry_list_.clear(); | 45 entry_list_.clear(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // ThreadSafeObserver implementation: | 49 // ThreadSafeObserver implementation: |
| 50 void OnAddEntry(const NetLog::Entry& entry) override { | 50 void OnAddEntry(const NetLog::Entry& entry) override { |
| 51 // Using Dictionaries instead of Values makes checking values a little | 51 // Using Dictionaries instead of Values makes checking values a little |
| 52 // simpler. | 52 // simpler. |
| 53 scoped_ptr<base::DictionaryValue> param_dict = | 53 std::unique_ptr<base::DictionaryValue> param_dict = |
| 54 base::DictionaryValue::From(entry.ParametersToValue()); | 54 base::DictionaryValue::From(entry.ParametersToValue()); |
| 55 | 55 |
| 56 // Only need to acquire the lock when accessing class variables. | 56 // Only need to acquire the lock when accessing class variables. |
| 57 base::AutoLock lock(lock_); | 57 base::AutoLock lock(lock_); |
| 58 entry_list_.push_back(TestNetLogEntry(entry.type(), base::TimeTicks::Now(), | 58 entry_list_.push_back(TestNetLogEntry(entry.type(), base::TimeTicks::Now(), |
| 59 entry.source(), entry.phase(), | 59 entry.source(), entry.phase(), |
| 60 std::move(param_dict))); | 60 std::move(param_dict))); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Needs to be "mutable" to use it in GetEntries(). | 63 // Needs to be "mutable" to use it in GetEntries(). |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 void BoundTestNetLog::Clear() { | 126 void BoundTestNetLog::Clear() { |
| 127 test_net_log_.Clear(); | 127 test_net_log_.Clear(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { | 130 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { |
| 131 test_net_log_.SetCaptureMode(capture_mode); | 131 test_net_log_.SetCaptureMode(capture_mode); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace net | 134 } // namespace net |
| OLD | NEW |