Index: ui/ozone/platform/dri/page_flip_event_handler.cc |
diff --git a/ui/ozone/platform/dri/page_flip_event_handler.cc b/ui/ozone/platform/dri/page_flip_event_handler.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..707e0bc5eacc9f38147fc1c2abbbedfbc367549c |
--- /dev/null |
+++ b/ui/ozone/platform/dri/page_flip_event_handler.cc |
@@ -0,0 +1,51 @@ |
+// 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. |
+ |
+#include "ui/ozone/platform/dri/page_flip_event_handler.h" |
+ |
+#include "base/bind.h" |
+#include "ui/ozone/platform/dri/hardware_display_controller.h" |
+ |
+namespace ui { |
+ |
+PageFlipEventHandler::PageFlipEventHandler() |
+ : base::Thread("PageFlipEventHandler"), |
+ child_message_loop_proxy_(base::MessageLoopProxy::current()) { |
+ base::Thread::Options options; |
+ options.message_loop_type = base::MessageLoop::TYPE_IO; |
+ StartWithOptions(options); |
+ SetPriority(base::kThreadPriority_Background); |
+} |
+ |
+PageFlipEventHandler::~PageFlipEventHandler() { |
+} |
+ |
+void PageFlipEventHandler::GetPageFlipCompleted( |
+ HardwareDisplayController* controller, |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { |
+ message_loop_proxy()->PostTask( |
+ FROM_HERE, base::Bind(&PageFlipEventHandler::CheckPageFlipEvent, this, |
+ controller, callback)); |
+} |
+ |
+void PageFlipEventHandler::CleanUp() { |
+ SetThreadWasQuitProperly(true); |
+} |
+ |
+void PageFlipEventHandler::RunFlipEventCallBack( |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { |
+ callback.Run(); |
+} |
+ |
+void PageFlipEventHandler::CheckPageFlipEvent( |
+ PageFlipEventHandler* data, |
+ HardwareDisplayController* controller, |
+ const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { |
+ controller->WaitForPageFlipEvent(); |
alexst (slow to review)
2014/12/17 19:12:24
Hi Kalyan, thank you for your help, this is very u
|
+ data->child_message_loop_proxy_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&PageFlipEventHandler::RunFlipEventCallBack, callback)); |
+} |
+ |
+} // namespace ui |