Chromium Code Reviews| Index: cc/layers/surface_holder.h |
| diff --git a/cc/layers/surface_holder.h b/cc/layers/surface_holder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..81305079655f3a17155163614faf822613c79244 |
| --- /dev/null |
| +++ b/cc/layers/surface_holder.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2014 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_LAYERS_SURFACE_HOLDER_H_ |
| +#define CC_LAYERS_SURFACE_HOLDER_H_ |
| + |
| +#include <set> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "cc/base/cc_export.h" |
| +#include "cc/surfaces/surface_id.h" |
| +#include "cc/surfaces/surface_sequence.h" |
| + |
| +namespace cc { |
| + |
| +class CC_EXPORT SurfaceHolder : public base::RefCounted<SurfaceHolder> { |
| + public: |
| + // The callback is called to satisfy a particular SurfaceSequence if the |
| + // compositor is unable to. |
| + typedef base::Callback<void(SurfaceSequence)> SatisfyCallback; |
| + SurfaceHolder(SurfaceId id, SatisfyCallback satisfy_callback); |
| + |
| + // Retrieves and clears the list of sequences that must be satisfied before |
| + // surface destruction. |
| + void GetSequenceSet(std::set<SurfaceSequence>* sequences); |
| + |
| + // Adds a new sequence that must be satisfied before surface destruction. |
| + void AddSurfaceSequence(SurfaceSequence sequence); |
| + |
| + SatisfyCallback satisfy_callback() { return satisfy_callback_; } |
| + SurfaceId surface_id() const { return id_; } |
| + |
| + private: |
| + friend class base::RefCounted<SurfaceHolder>; |
| + ~SurfaceHolder(); |
| + |
| + SurfaceId id_; |
| + SatisfyCallback satisfy_callback_; |
| + std::set<SurfaceSequence> sequences_; |
|
piman
2014/11/03 23:49:26
nit: hash_set? Faster/less memory?
Or even, if you
danakj
2014/11/04 16:56:57
hash_set may be slower on android (due to modulo o
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(SurfaceHolder); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_LAYERS_SURFACE_HOLDER_H_ |