| OLD | NEW |
| 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 "base/threading/thread_restrictions.h" |
| 9 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 SynchronousCompositor::Frame::Frame() : compositor_frame_sink_id(0u) {} | 14 SynchronousCompositor::Frame::Frame() : compositor_frame_sink_id(0u) {} |
| 14 | 15 |
| 15 SynchronousCompositor::Frame::~Frame() {} | 16 SynchronousCompositor::Frame::~Frame() {} |
| 16 | 17 |
| 17 SynchronousCompositor::Frame::Frame(Frame&& rhs) | 18 SynchronousCompositor::Frame::Frame(Frame&& rhs) |
| 18 : compositor_frame_sink_id(rhs.compositor_frame_sink_id), | 19 : compositor_frame_sink_id(rhs.compositor_frame_sink_id), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 frame_ = std::move(frame); | 30 frame_ = std::move(frame); |
| 30 waitable_event_.Signal(); | 31 waitable_event_.Signal(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 std::unique_ptr<SynchronousCompositor::Frame> | 34 std::unique_ptr<SynchronousCompositor::Frame> |
| 34 SynchronousCompositor::FrameFuture::GetFrame() { | 35 SynchronousCompositor::FrameFuture::GetFrame() { |
| 35 #if DCHECK_IS_ON() | 36 #if DCHECK_IS_ON() |
| 36 DCHECK(!waited_); | 37 DCHECK(!waited_); |
| 37 waited_ = true; | 38 waited_ = true; |
| 38 #endif | 39 #endif |
| 40 base::ThreadRestrictions::ScopedAllowWait wait; |
| 39 waitable_event_.Wait(); | 41 waitable_event_.Wait(); |
| 40 return std::move(frame_); | 42 return std::move(frame_); |
| 41 } | 43 } |
| 42 | 44 |
| 43 SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=( | 45 SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=( |
| 44 Frame&& rhs) { | 46 Frame&& rhs) { |
| 45 compositor_frame_sink_id = rhs.compositor_frame_sink_id; | 47 compositor_frame_sink_id = rhs.compositor_frame_sink_id; |
| 46 frame = std::move(rhs.frame); | 48 frame = std::move(rhs.frame); |
| 47 return *this; | 49 return *this; |
| 48 } | 50 } |
| 49 | 51 |
| 50 } // namespace content | 52 } // namespace content |
| OLD | NEW |