perfetto: round 3 of periodic task compile fix in Chromium

Change-Id: I43db384299711c3317c655360dc57c96245cd03a
diff --git a/include/perfetto/ext/base/scoped_file.h b/include/perfetto/ext/base/scoped_file.h
index 978843e..5a99de6 100644
--- a/include/perfetto/ext/base/scoped_file.h
+++ b/include/perfetto/ext/base/scoped_file.h
@@ -53,8 +53,10 @@
           class Checker = internal::DefaultValidityChecker<T, InvalidValue>>
 class PERFETTO_EXPORT ScopedResource {
  public:
-  explicit ScopedResource(T t = InvalidValue) : t_(t) {}
+  using ValidityChecker = Checker;
   static constexpr T kInvalid = InvalidValue;
+
+  explicit ScopedResource(T t = InvalidValue) : t_(t) {}
   ScopedResource(ScopedResource&& other) noexcept {
     t_ = other.t_;
     other.t_ = InvalidValue;
diff --git a/src/base/periodic_task.cc b/src/base/periodic_task.cc
index deeed9a..fcbc9de 100644
--- a/src/base/periodic_task.cc
+++ b/src/base/periodic_task.cc
@@ -118,6 +118,9 @@
     return;  // Destroyed or Reset() in the meanwhile.
   PERFETTO_DCHECK_THREAD(thiz->thread_checker_);
   if (thiz->timer_fd_) {
+#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
+    PERFETTO_FATAL("timerfd for periodic tasks unsupported on Windows");
+#else
     // If we are using a timerfd there is no need to repeatedly call
     // PostDelayedTask(). The kernel will wakeup the timer fd periodically. We
     // just need to read() it.
@@ -130,6 +133,7 @@
       PERFETTO_PLOG("read(timerfd) failed, falling back on PostDelayedTask");
       thiz->ResetTimerFd();
     }
+#endif
   }
   // The repetition of the if() is to deal with the ResetTimerFd() case above.
   if (!thiz->timer_fd_) {
diff --git a/src/base/periodic_task_unittest.cc b/src/base/periodic_task_unittest.cc
index 11bafda..4919720 100644
--- a/src/base/periodic_task_unittest.cc
+++ b/src/base/periodic_task_unittest.cc
@@ -90,7 +90,8 @@
       dup2(*dev_null, pt.timer_fd_for_testing());
     }
 #else
-    EXPECT_EQ(pt.timer_fd_for_testing(), base::ScopedPlatformHandle::kInvalid);
+    EXPECT_FALSE(base::ScopedPlatformHandle::ValidityChecker::IsValid(
+        pt.timer_fd_for_testing()));
 #endif
     if (num_callbacks == 6)
       quit_closure();