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

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

Issue 2616403003: Replacing SurfaceReferenceBase and SequenceSurfaceReference with Closures (Closed)
Patch Set: c Created 3 years, 11 months 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
OLDNEW
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 #ifndef CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_ 5 #ifndef CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_
6 #define CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_ 6 #define CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_
7 7
8 #include "base/callback_forward.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "cc/surfaces/surface_id.h" 10 #include "cc/surfaces/surface_id.h"
10 #include "cc/surfaces/surface_reference_owner.h" 11 #include "cc/surfaces/surface_reference_owner.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 class SurfaceReferenceBase; 15 // Creates surface references. The referenced surface will be kept alive as
15 16 // long as there is a reference to it.
16 // Creates surface references. Returns an object of type
17 // SurfaceReferenceBase which holds on to its corresponding
18 // surface reference until destruction. The referenced surface
19 // will be kept alive as long as there is a reference to it.
20 class SurfaceReferenceFactory 17 class SurfaceReferenceFactory
21 : public base::RefCountedThreadSafe<SurfaceReferenceFactory> { 18 : public base::RefCountedThreadSafe<SurfaceReferenceFactory> {
22 public: 19 public:
23 virtual std::unique_ptr<SurfaceReferenceBase> CreateReference( 20 // Creates a reference to the surface with the given surface id and returns
24 SurfaceReferenceOwner* owner, 21 // a closure that must be called exactly once to remove the reference.
25 const SurfaceId& surface_id) const = 0; 22 virtual base::Closure CreateReference(SurfaceReferenceOwner* owner,
23 const SurfaceId& surface_id) const = 0;
26 24
27 SurfaceReferenceFactory() = default; 25 SurfaceReferenceFactory() = default;
28 26
29 protected: 27 protected:
30 virtual ~SurfaceReferenceFactory() = default; 28 virtual ~SurfaceReferenceFactory() = default;
31 29
32 private: 30 private:
33 friend class SurfaceReferenceBase;
34 friend class base::RefCountedThreadSafe<SurfaceReferenceFactory>; 31 friend class base::RefCountedThreadSafe<SurfaceReferenceFactory>;
35 32
36 virtual void DestroyReference(SurfaceReferenceBase* surface_ref) const = 0;
37
38 DISALLOW_COPY_AND_ASSIGN(SurfaceReferenceFactory); 33 DISALLOW_COPY_AND_ASSIGN(SurfaceReferenceFactory);
39 }; 34 };
40 35
41 } // namespace cc 36 } // namespace cc
42 37
43 #endif // CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_ 38 #endif // CC_SURFACES_SURFACE_REFERENCE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698