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

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

Issue 2030663002: Migrate WaitableEvent to enum-based constructor in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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
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 <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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 CountingObserver observer_; 234 CountingObserver observer_;
235 235
236 DISALLOW_COPY_AND_ASSIGN(AddRemoveObserverTestThread); 236 DISALLOW_COPY_AND_ASSIGN(AddRemoveObserverTestThread);
237 }; 237 };
238 238
239 // Creates |kThreads| threads of type |ThreadType| and then runs them all 239 // Creates |kThreads| threads of type |ThreadType| and then runs them all
240 // to completion. 240 // to completion.
241 template <class ThreadType> 241 template <class ThreadType>
242 void RunTestThreads(NetLog* net_log) { 242 void RunTestThreads(NetLog* net_log) {
243 ThreadType threads[kThreads]; 243 ThreadType threads[kThreads];
244 base::WaitableEvent start_event(true, false); 244 base::WaitableEvent start_event(
245 base::WaitableEvent::ResetPolicy::MANUAL,
246 base::WaitableEvent::InitialState::NOT_SIGNALED);
245 247
246 for (size_t i = 0; i < arraysize(threads); ++i) { 248 for (size_t i = 0; i < arraysize(threads); ++i) {
247 threads[i].Init(net_log, &start_event); 249 threads[i].Init(net_log, &start_event);
248 threads[i].Start(); 250 threads[i].Start();
249 } 251 }
250 252
251 start_event.Signal(); 253 start_event.Signal();
252 254
253 for (size_t i = 0; i < arraysize(threads); ++i) 255 for (size_t i = 0; i < arraysize(threads); ++i)
254 threads[i].Join(); 256 threads[i].Join();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 NetLog net_log; 396 NetLog net_log;
395 397
396 // 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
397 // and remove an observer, and set its logging level. 399 // and remove an observer, and set its logging level.
398 RunTestThreads<AddRemoveObserverTestThread>(&net_log); 400 RunTestThreads<AddRemoveObserverTestThread>(&net_log);
399 } 401 }
400 402
401 } // namespace 403 } // namespace
402 404
403 } // namespace net 405 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc ('k') | net/proxy/multi_threaded_proxy_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698