OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |
| 6 #define UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |
| 7 |
| 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread.h" |
| 11 #include "ui/ozone/public/surface_ozone_egl.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 class HardwareDisplayController; |
| 16 |
| 17 // Helper class to processes outstanding DRM events of a given HardwareDisplay |
| 18 // Controller in a worker thread. |
| 19 class PageFilpEventHandler : public base::Thread { |
| 20 public: |
| 21 PageFilpEventHandler(); |
| 22 |
| 23 ~PageFilpEventHandler() override; |
| 24 |
| 25 // Blocks till any previous GetFlipCompleted requests are handled. |
| 26 void EnsurePreviousFlipHandled(); |
| 27 |
| 28 // Checks if any submitted page flip events for Controller have been processed |
| 29 // and callback is called once this data is available. The function doesn't |
| 30 // block. Query to check if the page flip events have been processed |
| 31 // will be done in a worker thread to make sure we dont block the current |
| 32 // thread but the callback will be posted on the same sequenced thread. |
| 33 void GetPageFlipCompleted( |
| 34 HardwareDisplayController* controller, |
| 35 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
| 36 |
| 37 protected: |
| 38 void CleanUp() override; |
| 39 |
| 40 private: |
| 41 static void RunFlipEventCallBack( |
| 42 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
| 43 |
| 44 static void CheckPageFlipEvent( |
| 45 PageFilpEventHandler* data, |
| 46 HardwareDisplayController* controller, |
| 47 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback); |
| 48 |
| 49 private: |
| 50 // Our original calling message loop for the child thread. |
| 51 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
| 52 base::WaitableEvent polling_; |
| 53 DISALLOW_COPY_AND_ASSIGN(PageFilpEventHandler); |
| 54 }; |
| 55 |
| 56 } // namespace ui |
| 57 |
| 58 #endif // UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_ |
OLD | NEW |