Chromium Code Reviews| Index: content/public/browser/android/synchronous_compositor.cc |
| diff --git a/content/public/browser/android/synchronous_compositor.cc b/content/public/browser/android/synchronous_compositor.cc |
| index 4e52b6130c4a37269f351cdced838b4b55b64d72..84869dc44c5e25f9376e6f956ee2708189b463a2 100644 |
| --- a/content/public/browser/android/synchronous_compositor.cc |
| +++ b/content/public/browser/android/synchronous_compositor.cc |
| @@ -17,6 +17,28 @@ SynchronousCompositor::Frame::~Frame() {} |
| SynchronousCompositor::Frame::Frame(Frame&& rhs) |
| : output_surface_id(rhs.output_surface_id), frame(std::move(rhs.frame)) {} |
| +SynchronousCompositor::FrameFuture::FrameFuture() |
| + : waitable_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
|
boliu
2016/09/16 16:26:12
should be manual
ojars
2016/09/19 22:02:37
Done.
|
| + base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| + |
| +SynchronousCompositor::FrameFuture::~FrameFuture() {} |
| + |
| +void SynchronousCompositor::FrameFuture::setFrame( |
| + std::unique_ptr<content::SynchronousCompositor::Frame> frame) { |
| + frame_ = std::move(frame); |
| + waitable_event_.Signal(); |
| +} |
| + |
| +content::SynchronousCompositor::Frame* |
| +SynchronousCompositor::FrameFuture::getFrame() { |
| + waitable_event_.Wait(); |
|
boliu
2016/09/16 16:26:12
All the waitable_event calls are super expensive.
|
| + return frame_.get(); |
| +} |
| + |
| +bool SynchronousCompositor::FrameFuture::hasFrame() { |
| + return waitable_event_.IsSignaled(); |
| +} |
| + |
| SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=( |
| Frame&& rhs) { |
| output_surface_id = rhs.output_surface_id; |