| Index: chrome/test/chromedriver/net/sync_websocket_impl.cc
|
| diff --git a/chrome/test/chromedriver/net/sync_websocket_impl.cc b/chrome/test/chromedriver/net/sync_websocket_impl.cc
|
| index 2451fcaf23722727e3c583f263825a4a3d3fecfd..30de762405e8da59bc93ad04be9639361217110e 100644
|
| --- a/chrome/test/chromedriver/net/sync_websocket_impl.cc
|
| +++ b/chrome/test/chromedriver/net/sync_websocket_impl.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/location.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/synchronization/waitable_event.h"
|
| +#include "chrome/test/chromedriver/util.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "url/gurl.h"
|
| @@ -32,7 +33,7 @@ bool SyncWebSocketImpl::Send(const std::string& message) {
|
| }
|
|
|
| SyncWebSocket::StatusCode SyncWebSocketImpl::ReceiveNextMessage(
|
| - std::string* message, const base::TimeDelta& timeout) {
|
| + std::string* message, const Timeout& timeout) {
|
| return core_->ReceiveNextMessage(message, timeout);
|
| }
|
|
|
| @@ -74,15 +75,13 @@ bool SyncWebSocketImpl::Core::Send(const std::string& message) {
|
|
|
| SyncWebSocket::StatusCode SyncWebSocketImpl::Core::ReceiveNextMessage(
|
| std::string* message,
|
| - const base::TimeDelta& timeout) {
|
| + const Timeout& timeout) {
|
| base::AutoLock lock(lock_);
|
| - base::TimeTicks deadline = base::TimeTicks::Now() + timeout;
|
| - base::TimeDelta next_wait = timeout;
|
| while (received_queue_.empty() && is_connected_) {
|
| + base::TimeDelta next_wait = timeout.GetRemainingTime();
|
| if (next_wait <= base::TimeDelta())
|
| return SyncWebSocket::kTimeout;
|
| on_update_event_.TimedWait(next_wait);
|
| - next_wait = deadline - base::TimeTicks::Now();
|
| }
|
| if (!is_connected_)
|
| return SyncWebSocket::kDisconnected;
|
|
|