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

Side by Side Diff: content/public/browser/android/synchronous_compositor.cc

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review Created 4 years, 3 months 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/public/browser/android/synchronous_compositor.h" 5 #include "content/public/browser/android/synchronous_compositor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 SynchronousCompositor::Frame::Frame() : compositor_frame_sink_id(0u) {} 13 SynchronousCompositor::Frame::Frame() : compositor_frame_sink_id(0u) {}
14 14
15 SynchronousCompositor::Frame::~Frame() {} 15 SynchronousCompositor::Frame::~Frame() {}
16 16
17 SynchronousCompositor::Frame::Frame(Frame&& rhs) 17 SynchronousCompositor::Frame::Frame(Frame&& rhs)
18 : compositor_frame_sink_id(rhs.compositor_frame_sink_id), 18 : compositor_frame_sink_id(rhs.compositor_frame_sink_id),
19 frame(std::move(rhs.frame)) {} 19 frame(std::move(rhs.frame)) {}
20 20
21 SynchronousCompositor::FrameFuture::FrameFuture()
22 : waitable_event_(base::WaitableEvent::ResetPolicy::MANUAL,
23 base::WaitableEvent::InitialState::NOT_SIGNALED) {}
24
25 SynchronousCompositor::FrameFuture::~FrameFuture() {}
26
27 void SynchronousCompositor::FrameFuture::setFrame(
28 std::unique_ptr<content::SynchronousCompositor::Frame> frame) {
29 frame_ = std::move(frame);
30 waitable_event_.Signal();
31 }
32
33 content::SynchronousCompositor::Frame*
34 SynchronousCompositor::FrameFuture::getFrame() {
35 return frame_.get();
36 }
37
38 void SynchronousCompositor::FrameFuture::Wait() {
39 waitable_event_.Wait();
40 }
41
42 bool SynchronousCompositor::FrameFuture::hasFrame() {
43 return waitable_event_.IsSignaled();
44 }
45
21 SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=( 46 SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=(
22 Frame&& rhs) { 47 Frame&& rhs) {
23 compositor_frame_sink_id = rhs.compositor_frame_sink_id; 48 compositor_frame_sink_id = rhs.compositor_frame_sink_id;
24 frame = std::move(rhs.frame); 49 frame = std::move(rhs.frame);
25 return *this; 50 return *this;
26 } 51 }
27 52
28 } // namespace content 53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698