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

Side by Side Diff: components/cronet/ios/test/quic_test_server.cc

Issue 2056443002: Manual refactor to enum-based WaitableEvent for remaining mac/ios files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_1_explicit_bools
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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/cronet/ios/test/quic_test_server.h" 5 #include "components/cronet/ios/test/quic_test_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DCHECK(!g_quic_server_thread); 97 DCHECK(!g_quic_server_thread);
98 g_quic_server_thread = new base::Thread("quic server thread"); 98 g_quic_server_thread = new base::Thread("quic server thread");
99 base::Thread::Options thread_options; 99 base::Thread::Options thread_options;
100 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; 100 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
101 bool started = g_quic_server_thread->StartWithOptions(thread_options); 101 bool started = g_quic_server_thread->StartWithOptions(thread_options);
102 DCHECK(started); 102 DCHECK(started);
103 base::FilePath test_files_root; 103 base::FilePath test_files_root;
104 if (!PathService::Get(base::DIR_EXE, &test_files_root)) 104 if (!PathService::Get(base::DIR_EXE, &test_files_root))
105 return false; 105 return false;
106 106
107 base::WaitableEvent server_started_event(true, false); 107 base::WaitableEvent server_started_event(
108 base::WaitableEvent::ResetPolicy::MANUAL,
109 base::WaitableEvent::InitialState::NOT_SIGNALED);
108 g_quic_server_thread->task_runner()->PostTask( 110 g_quic_server_thread->task_runner()->PostTask(
109 FROM_HERE, base::Bind(&StartQuicServerOnServerThread, test_files_root, 111 FROM_HERE, base::Bind(&StartQuicServerOnServerThread, test_files_root,
110 &server_started_event)); 112 &server_started_event));
111 server_started_event.Wait(); 113 server_started_event.Wait();
112 return true; 114 return true;
113 } 115 }
114 116
115 void ShutdownQuicTestServer() { 117 void ShutdownQuicTestServer() {
116 if (!g_quic_server_thread) 118 if (!g_quic_server_thread)
117 return; 119 return;
118 DCHECK(!g_quic_server_thread->task_runner()->BelongsToCurrentThread()); 120 DCHECK(!g_quic_server_thread->task_runner()->BelongsToCurrentThread());
119 base::WaitableEvent server_stopped_event(true, false); 121 base::WaitableEvent server_stopped_event(
122 base::WaitableEvent::ResetPolicy::MANUAL,
123 base::WaitableEvent::InitialState::NOT_SIGNALED);
120 g_quic_server_thread->task_runner()->PostTask( 124 g_quic_server_thread->task_runner()->PostTask(
121 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event)); 125 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event));
122 server_stopped_event.Wait(); 126 server_stopped_event.Wait();
123 delete g_quic_server_thread; 127 delete g_quic_server_thread;
124 g_quic_server_thread = nullptr; 128 g_quic_server_thread = nullptr;
125 } 129 }
126 130
127 } // namespace cronet 131 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/ios/test/cronet_bidirectional_stream_test.mm ('k') | content/browser/mach_broker_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698