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

Unified Diff: content/public/browser/android/synchronous_compositor.cc

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698