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 #include "ui/ozone/platform/dri/page_flip_event_handler.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "ui/ozone/platform/dri/hardware_display_controller.h" | |
9 | |
10 namespace ui { | |
11 | |
12 PageFlipEventHandler::PageFlipEventHandler() | |
13 : base::Thread("PageFlipEventHandler"), | |
14 child_message_loop_proxy_(base::MessageLoopProxy::current()) { | |
15 base::Thread::Options options; | |
16 options.message_loop_type = base::MessageLoop::TYPE_IO; | |
17 StartWithOptions(options); | |
18 SetPriority(base::kThreadPriority_Background); | |
19 } | |
20 | |
21 PageFlipEventHandler::~PageFlipEventHandler() { | |
22 } | |
23 | |
24 void PageFlipEventHandler::GetPageFlipCompleted( | |
25 HardwareDisplayController* controller, | |
26 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { | |
27 message_loop_proxy()->PostTask( | |
28 FROM_HERE, base::Bind(&PageFlipEventHandler::CheckPageFlipEvent, this, | |
29 controller, callback)); | |
30 } | |
31 | |
32 void PageFlipEventHandler::CleanUp() { | |
33 SetThreadWasQuitProperly(true); | |
34 } | |
35 | |
36 void PageFlipEventHandler::RunFlipEventCallBack( | |
37 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { | |
38 callback.Run(); | |
39 } | |
40 | |
41 void PageFlipEventHandler::CheckPageFlipEvent( | |
42 PageFlipEventHandler* data, | |
43 HardwareDisplayController* controller, | |
44 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) { | |
45 controller->WaitForPageFlipEvent(); | |
alexst (slow to review)
2014/12/17 19:12:24
Hi Kalyan, thank you for your help, this is very u
| |
46 data->child_message_loop_proxy_->PostTask( | |
47 FROM_HERE, | |
48 base::Bind(&PageFlipEventHandler::RunFlipEventCallBack, callback)); | |
49 } | |
50 | |
51 } // namespace ui | |
OLD | NEW |