Chromium Code Reviews| Index: cc/surfaces/surface_ref.h |
| diff --git a/cc/surfaces/surface_ref.h b/cc/surfaces/surface_ref.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7ff120292ca78e9fd2d1ff21b8bbe574e691f1ba |
| --- /dev/null |
| +++ b/cc/surfaces/surface_ref.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_SURFACES_SURFACE_REF_H_ |
| +#define CC_SURFACES_SURFACE_REF_H_ |
| + |
| +#include "cc/output/compositor_frame_metadata.h" |
| +#include "cc/surfaces/surface_ref_base.h" |
| +#include "cc/surfaces/surface_sequence.h" |
| +#include "cc/surfaces/surface_sequence_generator.h" |
| +#include "cc/trees/layer_tree_host.h" |
| + |
| +namespace cc { |
| + |
| +template <class T> |
| +class SurfaceRefWithSequence : public SurfaceRefBase<T> { |
| + protected: |
| + void BlockImpl() override { |
|
Fady Samuel
2016/11/30 19:51:29
Why is this called block?
|
| + DCHECK(this->host()); |
| + seq_ = this->host()->GetSurfaceSequenceGenerator()->CreateSurfaceSequence(); |
| + DCHECK(seq_.is_valid()); |
| + RequireSequence(seq_); |
| + } |
| + |
| + void AllowImpl() override { |
|
Fady Samuel
2016/11/30 19:51:29
Why is this called allow?
|
| + DCHECK(seq_.is_valid()); |
| + SatisfySequence(seq_); |
| + } |
| + |
| + virtual void RequireSequence(const SurfaceSequence&) = 0; |
| + virtual void SatisfySequence(const SurfaceSequence&) = 0; |
| + |
| + void DelegateLockImpl(CompositorFrameMetadata* metadata) override { |
|
Fady Samuel
2016/11/30 19:51:29
Why is this called DelegateLockImpl? I don't under
|
| + DCHECK(seq_.is_valid()); |
| + metadata->satisfies_sequences.push_back(seq_.sequence); |
| + } |
| + |
| + private: |
| + SurfaceSequence seq_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_SURFACES_SURFACE_REF_H_ |