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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(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 PageFilpEventHandler::PageFilpEventHandler()
13 : base::Thread("PageFilpEventHandler"),
14 child_message_loop_proxy_(base::MessageLoopProxy::current()),
15 polling_(true, true) {
brianderson 2014/12/10 22:48:05 This should probably be polling_(true, false).
16 base::Thread::Options options;
17 options.message_loop_type = base::MessageLoop::TYPE_IO;
18 StartWithOptions(options);
19 SetPriority(base::kThreadPriority_Background);
20 }
21
22 PageFilpEventHandler::~PageFilpEventHandler() {
23 }
24
25 void PageFilpEventHandler::EnsurePreviousFlipHandled() {
26 polling_.Wait();
27 }
28
29 void PageFilpEventHandler::GetPageFlipCompleted(
30 HardwareDisplayController* controller,
31 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) {
32 message_loop_proxy()->PostTask(
33 FROM_HERE, base::Bind(&PageFilpEventHandler::CheckPageFlipEvent, this,
34 controller, callback));
35 }
36
37 void PageFilpEventHandler::CleanUp() {
38 SetThreadWasQuitProperly(true);
39 }
40
41 void PageFilpEventHandler::RunFlipEventCallBack(
42 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) {
43 callback.Run();
44 }
45
46 void PageFilpEventHandler::CheckPageFlipEvent(
47 PageFilpEventHandler* data,
48 HardwareDisplayController* controller,
49 const ui::SurfaceOzoneEGL::PageFlipCompletionCallback& callback) {
50 data->polling_.Reset();
brianderson 2014/12/10 22:48:05 This should be a DCHECK that IsSignaled is false.
51 controller->WaitForPageFlipEvent();
52 data->polling_.Signal();
53 data->child_message_loop_proxy_->PostTask(
54 FROM_HERE,
55 base::Bind(&PageFilpEventHandler::RunFlipEventCallBack, callback));
56 }
57
58 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698