Remove some of the APIs from epoll_server/platform Use Abseil where appropriate; remove EPOLL_EXPORT as it's never required. PiperOrigin-RevId: 443108467
diff --git a/quiche/epoll_server/fake_simple_epoll_server.h b/quiche/epoll_server/fake_simple_epoll_server.h index 4338afe..62c9dd1 100644 --- a/quiche/epoll_server/fake_simple_epoll_server.h +++ b/quiche/epoll_server/fake_simple_epoll_server.h
@@ -10,7 +10,6 @@ #include <map> -#include "quiche/epoll_server/platform/api/epoll_export.h" #include "quiche/epoll_server/simple_epoll_server.h" namespace epoll_server { @@ -19,8 +18,7 @@ // Unlike the full FakeEpollServer, this only lies about the time but lets // fd events operate normally. Usefully when interacting with real backends // but wanting to skip forward in time to trigger timeouts. -class EPOLL_EXPORT_PRIVATE FakeTimeSimpleEpollServer - : public SimpleEpollServer { +class FakeTimeSimpleEpollServer : public SimpleEpollServer { public: FakeTimeSimpleEpollServer(); FakeTimeSimpleEpollServer(const FakeTimeSimpleEpollServer&) = delete; @@ -53,8 +51,7 @@ int64_t now_in_usec_; }; -class EPOLL_EXPORT_PRIVATE FakeSimpleEpollServer - : public FakeTimeSimpleEpollServer { +class FakeSimpleEpollServer : public FakeTimeSimpleEpollServer { public: // type definitions using EventQueue = std::multimap<int64_t, struct epoll_event>;
diff --git a/quiche/epoll_server/platform/api/epoll_export.h b/quiche/epoll_server/platform/api/epoll_export.h deleted file mode 100644 index 4283cf9..0000000 --- a/quiche/epoll_server/platform/api/epoll_export.h +++ /dev/null
@@ -1,10 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_EXPORT_H_ -#define QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_EXPORT_H_ - -#include "quiche_platform_impl/epoll_export_impl.h" - -#endif // QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_EXPORT_H_
diff --git a/quiche/epoll_server/platform/api/epoll_ptr_util.h b/quiche/epoll_server/platform/api/epoll_ptr_util.h deleted file mode 100644 index 3ad17f4..0000000 --- a/quiche/epoll_server/platform/api/epoll_ptr_util.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_PTR_UTIL_H_ -#define QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_PTR_UTIL_H_ - -#include <memory> - -#include "quiche_platform_impl/epoll_ptr_util_impl.h" - -namespace epoll_server { - -template <typename T, typename... Args> -std::unique_ptr<T> EpollMakeUnique(Args&&... args) { - return EpollMakeUniqueImpl<T>(std::forward<Args>(args)...); -} - -} // namespace epoll_server - -#endif // QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_PTR_UTIL_H_
diff --git a/quiche/epoll_server/platform/api/epoll_time.h b/quiche/epoll_server/platform/api/epoll_time.h deleted file mode 100644 index 4c7419b..0000000 --- a/quiche/epoll_server/platform/api/epoll_time.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_TIME_H_ -#define QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_TIME_H_ - -#include "quiche_platform_impl/epoll_time_impl.h" - -namespace epoll_server { - -inline int64_t WallTimeNowInUsec() { return WallTimeNowInUsecImpl(); } - -} // namespace epoll_server - -#endif // QUICHE_EPOLL_SERVER_PLATFORM_API_EPOLL_TIME_H_
diff --git a/quiche/epoll_server/simple_epoll_server.cc b/quiche/epoll_server/simple_epoll_server.cc index 227089e..eb9d6c4 100644 --- a/quiche/epoll_server/simple_epoll_server.cc +++ b/quiche/epoll_server/simple_epoll_server.cc
@@ -12,8 +12,8 @@ #include <algorithm> #include <utility> +#include "absl/time/clock.h" #include "quiche/epoll_server/platform/api/epoll_bug.h" -#include "quiche/epoll_server/platform/api/epoll_time.h" // Design notes: An efficient implementation of ready list has the following // desirable properties: @@ -485,7 +485,9 @@ DCHECK_EQ(rv, 1); } -int64_t SimpleEpollServer::NowInUsec() const { return WallTimeNowInUsec(); } +int64_t SimpleEpollServer::NowInUsec() const { + return absl::GetCurrentTimeNanos() / 1000; +} int64_t SimpleEpollServer::ApproximateNowInUsec() const { if (recorded_now_in_us_ != 0) {
diff --git a/quiche/epoll_server/simple_epoll_server.h b/quiche/epoll_server/simple_epoll_server.h index 7aeba67..405e306 100644 --- a/quiche/epoll_server/simple_epoll_server.h +++ b/quiche/epoll_server/simple_epoll_server.h
@@ -37,7 +37,6 @@ #include <sys/epoll.h> -#include "quiche/epoll_server/platform/api/epoll_export.h" #include "quiche/epoll_server/platform/api/epoll_logging.h" namespace epoll_server { @@ -122,7 +121,7 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -class EPOLL_EXPORT_PRIVATE SimpleEpollServer { +class SimpleEpollServer { public: typedef EpollAlarmCallbackInterface AlarmCB; typedef EpollCallbackInterface CB; @@ -1011,7 +1010,7 @@ // Any classes overriding these functions must either call the implementation // of the parent class, or is must otherwise make sure that the 'registered_' // boolean and the token, 'token_', are updated appropriately. -class EPOLL_EXPORT_PRIVATE EpollAlarm : public EpollAlarmCallbackInterface { +class EpollAlarm : public EpollAlarmCallbackInterface { public: EpollAlarm();
diff --git a/quiche/epoll_server/simple_epoll_server_test.cc b/quiche/epoll_server/simple_epoll_server_test.cc index 3b64002..ba85038 100644 --- a/quiche/epoll_server/simple_epoll_server_test.cc +++ b/quiche/epoll_server/simple_epoll_server_test.cc
@@ -24,13 +24,12 @@ #include <utility> #include <vector> +#include "absl/time/clock.h" #include "quiche/epoll_server/fake_simple_epoll_server.h" #include "quiche/epoll_server/platform/api/epoll_address_test_utils.h" #include "quiche/epoll_server/platform/api/epoll_expect_bug.h" -#include "quiche/epoll_server/platform/api/epoll_ptr_util.h" #include "quiche/epoll_server/platform/api/epoll_test.h" #include "quiche/epoll_server/platform/api/epoll_thread.h" -#include "quiche/epoll_server/platform/api/epoll_time.h" namespace epoll_server { @@ -55,6 +54,8 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// +int64_t WallTimeNowInUsec() { return absl::GetCurrentTimeNanos() / 1000; } + //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -1738,7 +1739,7 @@ break; default: { // Parent will receive message. close(writer_pipe); - auto ep = EpollMakeUnique<SimpleEpollServer>(); + auto ep = std::make_unique<SimpleEpollServer>(); ep->set_timeout_in_us(1); EpollReader reader(len); ep->RegisterFD(reader_pipe, &reader, EPOLLIN); @@ -1782,7 +1783,7 @@ int read_fd = pipe_fds[0]; int write_fd = pipe_fds[1]; - auto reader = EpollMakeUnique<EpollReader>(len); + auto reader = std::make_unique<EpollReader>(len); // Check that registering a FD for read alerts us when there is data to be // read.