Index: ui/ozone/platform/dri/page_flip_event_handler.h |
diff --git a/ui/ozone/platform/dri/page_flip_event_handler.h b/ui/ozone/platform/dri/page_flip_event_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..35e53abbeff940427a7be247edbe0d8db845f951 |
--- /dev/null |
+++ b/ui/ozone/platform/dri/page_flip_event_handler.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 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 UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |
+#define UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |
+ |
+#include "base/message_loop/message_loop.h" |
+#include "base/synchronization/waitable_event.h" |
+#include "base/threading/thread.h" |
+#include "ui/ozone/public/surface_ozone_egl.h" |
+ |
+namespace ui { |
+ |
+class HardwareDisplayController; |
+ |
+// Helper class to processes outstanding DRM events of a given HardwareDisplay |
+// Controller in a worker thread. |
+class PageFlipEventHandler : public base::Thread { |
+ public: |
+ PageFlipEventHandler(); |
+ |
+ ~PageFlipEventHandler() override; |
+ |
+ // Checks if any submitted page flip events for Controller have been processed |
+ // and callback is called once this data is available. The function doesn't |
+ // block. Query to check if the page flip events have been processed |
+ // will be done in a worker thread to make sure we dont block the current |
+ // thread but the callback will be posted on the same sequenced thread. |
+ void GetPageFlipCompleted( |
+ HardwareDisplayController* controller, |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
+ |
+ protected: |
+ void CleanUp() override; |
+ |
+ private: |
+ static void RunFlipEventCallBack( |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
+ |
+ static void CheckPageFlipEvent( |
+ PageFlipEventHandler* data, |
+ HardwareDisplayController* controller, |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
+ |
+ private: |
+ // Our original calling message loop for the child thread. |
+ scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
+ DISALLOW_COPY_AND_ASSIGN(PageFlipEventHandler); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |