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

Unified Diff: net/tools/quic/test_tools/server_thread.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/test_tools/server_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/server_thread.cc
diff --git a/net/tools/quic/test_tools/server_thread.cc b/net/tools/quic/test_tools/server_thread.cc
index fbb762ceaf04d84934949ed682fa125546cbfcaf..5d50565c851006f7bdee03f6ccb59f60f64e7d2e 100644
--- a/net/tools/quic/test_tools/server_thread.cc
+++ b/net/tools/quic/test_tools/server_thread.cc
@@ -61,6 +61,7 @@ void ServerThread::Run() {
resume_.Wait();
}
server_->WaitForEvents();
+ ExecuteScheduledActions();
MaybeNotifyOfHandshakeConfirmation();
}
@@ -74,6 +75,12 @@ int ServerThread::GetPort() {
return rc;
}
+void ServerThread::Schedule(std::function<void()> action) {
+ DCHECK(!quit_.IsSignaled());
+ base::AutoLock lock(scheduled_actions_lock_);
+ scheduled_actions_.push_back(std::move(action));
+}
+
void ServerThread::WaitForCryptoHandshakeConfirmed() {
confirmed_.Wait();
}
@@ -113,5 +120,17 @@ void ServerThread::MaybeNotifyOfHandshakeConfirmation() {
}
}
+void ServerThread::ExecuteScheduledActions() {
+ std::deque<std::function<void()>> actions;
+ {
+ base::AutoLock lock(scheduled_actions_lock_);
+ actions.swap(scheduled_actions_);
+ }
+ while (!actions.empty()) {
+ actions.front()();
+ actions.pop_front();
+ }
+}
+
} // namespace test
} // namespace net
« no previous file with comments | « net/tools/quic/test_tools/server_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698