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

Side by Side Diff: cc/surfaces/surface_reference_base.h

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: rename leaves Created 4 years 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 unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_reference_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_SURFACES_SURFACE_REFERENCE_BASE_H_
6 #define CC_SURFACES_SURFACE_REFERENCE_BASE_H_
7
8 #include <memory>
9
10 #include "base/memory/ptr_util.h"
11 #include "cc/surfaces/surface_reference_factory.h"
12 #include "cc/surfaces/surface_sequence.h"
13
14 namespace cc {
15
16 class CompositorFrameMetadata;
17 class SurfaceReferenceFactory;
18
19 /* The base class for the references returned by SurfaceReferenceFactory and
20 * its subclasses.
21 * The objects of this class hold on to their corresponding surface reference
22 * until destroy is called or until the object goes out of scope.
23 * To keep things as lightweight as possible, the base class only keeps a
24 * pointer to the factory and it's left up to the subclasses to decide what
25 * other information they need to keep. */
26 class SurfaceReferenceBase {
27 public:
28 explicit SurfaceReferenceBase(const SurfaceReferenceFactory* factory);
Fady Samuel 2016/12/12 22:35:26 If you're holding onto SurfaceReferenceFactory as
29 virtual ~SurfaceReferenceBase();
30
31 void Destroy();
32 void Destroy(CompositorFrameMetadata* metadata);
33 bool IsDestroyed() const;
Fady Samuel 2016/12/12 22:35:26 bool destroyed() const { return !!factory_; }
34
35 const SurfaceReferenceFactory* factory() const { return factory_.get(); }
36
37 private:
38 scoped_refptr<const SurfaceReferenceFactory> factory_;
39 };
40
41 } // namespace cc
42
43 #endif // CC_SURFACES_SURFACE_REFERENCE_BASE_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_reference_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698