OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" | 5 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" |
6 | 6 |
7 #include "base/barrier_closure.h" | 7 #include "base/barrier_closure.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 PageFlipRequest::PageFlipRequest(int crtc_count, const base::Closure& callback) | 11 PageFlipRequest::PageFlipRequest( |
12 : callback_(base::BarrierClosure(crtc_count, callback)) { | 12 int crtc_count, |
13 const base::Callback<void(gfx::SwapResult)>& callback) | |
14 : callback_(callback), count_(crtc_count), result_(gfx::SwapAck) { | |
13 } | 15 } |
14 | 16 |
15 PageFlipRequest::~PageFlipRequest() { | 17 PageFlipRequest::~PageFlipRequest() { |
16 } | 18 } |
17 | 19 |
18 void PageFlipRequest::Signal() { | 20 void PageFlipRequest::Signal(gfx::SwapResult result) { |
19 callback_.Run(); | 21 if (result != gfx::SwapAck) |
alexst (slow to review)
2015/04/29 17:53:37
If one of these fails, we should fail. If we get f
achaulk
2015/05/06 18:29:48
Done.
| |
22 result_ = result; | |
23 if (!base::AtomicRefCountDec(&count_)) { | |
24 callback_.Run(result_); | |
25 callback_.Reset(); | |
26 } | |
20 } | 27 } |
21 | 28 |
22 } // namespace ui | 29 } // namespace ui |
OLD | NEW |