Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_LAYERS_SURFACE_HOLDER_H_ | |
| 6 #define CC_LAYERS_SURFACE_HOLDER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "cc/base/cc_export.h" | |
| 13 #include "cc/surfaces/surface_id.h" | |
| 14 #include "cc/surfaces/surface_sequence.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 | |
| 18 class CC_EXPORT SurfaceHolder : public base::RefCounted<SurfaceHolder> { | |
| 19 public: | |
| 20 // The callback is called to satisfy a particular SurfaceSequence if the | |
| 21 // compositor is unable to. | |
| 22 typedef base::Callback<void(SurfaceSequence)> SatisfyCallback; | |
| 23 SurfaceHolder(SurfaceId id, SatisfyCallback satisfy_callback); | |
| 24 | |
| 25 // Retrieves and clears the list of sequences that must be satisfied before | |
| 26 // surface destruction. | |
| 27 void GetSequenceSet(std::set<SurfaceSequence>* sequences); | |
| 28 | |
| 29 // Adds a new sequence that must be satisfied before surface destruction. | |
| 30 void AddSurfaceSequence(SurfaceSequence sequence); | |
| 31 | |
| 32 SatisfyCallback satisfy_callback() { return satisfy_callback_; } | |
| 33 SurfaceId surface_id() const { return id_; } | |
| 34 | |
| 35 private: | |
| 36 friend class base::RefCounted<SurfaceHolder>; | |
| 37 ~SurfaceHolder(); | |
| 38 | |
| 39 SurfaceId id_; | |
| 40 SatisfyCallback satisfy_callback_; | |
| 41 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
| |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(SurfaceHolder); | |
| 44 }; | |
| 45 | |
| 46 } // namespace cc | |
| 47 | |
| 48 #endif // CC_LAYERS_SURFACE_HOLDER_H_ | |
| OLD | NEW |