Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: ui/ozone/platform/dri/page_flip_event_handler.h

Issue 781683005: Ozone: Avoid blocking in Swapbuffer Call. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unintended changes. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..737e145c2620943c566f70391dbf98d146f6ea66
--- /dev/null
+++ b/ui/ozone/platform/dri/page_flip_event_handler.h
@@ -0,0 +1,58 @@
+// 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 PageFilpEventHandler : public base::Thread {
+ public:
+ PageFilpEventHandler();
+
+ ~PageFilpEventHandler() override;
+
+ // Blocks till any previous GetFlipCompleted requests are handled.
+ void EnsurePreviousFlipHandled();
+
+ // 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(
+ PageFilpEventHandler* 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_;
+ base::WaitableEvent polling_;
+ DISALLOW_COPY_AND_ASSIGN(PageFilpEventHandler);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_PAGE_FLIP_EVENT_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698