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

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

Issue 781683005: Ozone: Avoid blocking in Swapbuffer Call. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compiler warning. 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.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
« no previous file with comments | « ui/ozone/platform/dri/page_flip_event_handler.h ('k') | ui/ozone/platform/egltest/ozone_platform_egltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698