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

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

Issue 1466653002: Remove ScopedVector from message_pump_perftest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 4
5 #include "net/log/net_log.h" 5 #include "net/log/net_log.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h"
9 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/simple_thread.h" 9 #include "base/threading/simple_thread.h"
11 #include "base/values.h" 10 #include "base/values.h"
12 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
13 #include "net/log/test_net_log.h" 12 #include "net/log/test_net_log.h"
14 #include "net/log/test_net_log_entry.h" 13 #include "net/log/test_net_log_entry.h"
15 #include "net/log/test_net_log_util.h" 14 #include "net/log/test_net_log_util.h"
16 15
17 namespace net { 16 namespace net {
18 17
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 class LoggingObserver : public NetLog::ThreadSafeObserver { 120 class LoggingObserver : public NetLog::ThreadSafeObserver {
122 public: 121 public:
123 LoggingObserver() {} 122 LoggingObserver() {}
124 123
125 ~LoggingObserver() override { 124 ~LoggingObserver() override {
126 if (net_log()) 125 if (net_log())
127 net_log()->DeprecatedRemoveObserver(this); 126 net_log()->DeprecatedRemoveObserver(this);
128 } 127 }
129 128
130 void OnAddEntry(const NetLog::Entry& entry) override { 129 void OnAddEntry(const NetLog::Entry& entry) override {
131 base::Value* value = entry.ToValue(); 130 scoped_ptr<base::DictionaryValue> dict =
132 base::DictionaryValue* dict = NULL; 131 base::DictionaryValue::From(make_scoped_ptr(entry.ToValue()));
133 ASSERT_TRUE(value->GetAsDictionary(&dict)); 132 ASSERT_TRUE(dict);
134 values_.push_back(dict); 133 values_.push_back(std::move(dict));
135 } 134 }
136 135
137 size_t GetNumValues() const { return values_.size(); } 136 size_t GetNumValues() const { return values_.size(); }
138 base::DictionaryValue* GetValue(size_t index) const { return values_[index]; } 137 base::DictionaryValue* GetValue(size_t index) const {
138 return values_[index].get();
139 }
139 140
140 private: 141 private:
141 ScopedVector<base::DictionaryValue> values_; 142 std::vector<scoped_ptr<base::DictionaryValue>> values_;
142 }; 143 };
143 144
144 void AddEvent(NetLog* net_log) { 145 void AddEvent(NetLog* net_log) {
145 net_log->AddGlobalEntry(NetLog::TYPE_CANCELLED, 146 net_log->AddGlobalEntry(NetLog::TYPE_CANCELLED,
146 base::Bind(CaptureModeToValue)); 147 base::Bind(CaptureModeToValue));
147 } 148 }
148 149
149 // A thread that waits until an event has been signalled before calling 150 // A thread that waits until an event has been signalled before calling
150 // RunTestThread. 151 // RunTestThread.
151 class NetLogTestThread : public base::SimpleThread { 152 class NetLogTestThread : public base::SimpleThread {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 NetLog net_log; 388 NetLog net_log;
388 389
389 // Run a bunch of threads to completion, each of which will repeatedly add 390 // Run a bunch of threads to completion, each of which will repeatedly add
390 // and remove an observer, and set its logging level. 391 // and remove an observer, and set its logging level.
391 RunTestThreads<AddRemoveObserverTestThread>(&net_log); 392 RunTestThreads<AddRemoveObserverTestThread>(&net_log);
392 } 393 }
393 394
394 } // namespace 395 } // namespace
395 396
396 } // namespace net 397 } // namespace net
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