| OLD | NEW |
| 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_BASE_H_ | 5 #ifndef CC_SURFACES_SCOPED_SURFACE_REFERENCE_BASE_H_ |
| 6 #define CC_SURFACES_SURFACE_REFERENCE_BASE_H_ | 6 #define CC_SURFACES_SCOPED_SURFACE_REFERENCE_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "cc/surfaces/surface_sequence.h" | 12 #include "cc/surfaces/surface_sequence.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class SurfaceReferenceFactory; | 16 class SurfaceReferenceFactory; |
| 17 | 17 |
| 18 // The base class for the references returned by SurfaceReferenceFactory and | 18 // The base class for the references returned by SurfaceReferenceFactory and |
| 19 // its subclasses. | 19 // its subclasses. |
| 20 // The objects of this class hold on their surface reference until they go | 20 // The objects of this class hold on their surface reference until they go |
| 21 // out of scope. | 21 // out of scope. |
| 22 // To keep things as lightweight as possible, the base class only keeps a | 22 // To keep things as lightweight as possible, the base class only keeps a |
| 23 // pointer to the factory and it's up to the subclasses to decide what other | 23 // pointer to the factory and it's up to the subclasses to decide what other |
| 24 // information they need to keep. | 24 // information they need to keep. |
| 25 class SurfaceReferenceBase { | 25 class ScopedSurfaceReferenceBase { |
| 26 public: | 26 public: |
| 27 explicit SurfaceReferenceBase( | 27 explicit ScopedSurfaceReferenceBase( |
| 28 scoped_refptr<const SurfaceReferenceFactory> factory); | 28 scoped_refptr<const SurfaceReferenceFactory> factory); |
| 29 | 29 |
| 30 virtual ~SurfaceReferenceBase(); | 30 virtual ~ScopedSurfaceReferenceBase(); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 void Destroy(); | 33 void Destroy(); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 scoped_refptr<const SurfaceReferenceFactory> factory_; | 36 scoped_refptr<const SurfaceReferenceFactory> factory_; |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(SurfaceReferenceBase); | 38 DISALLOW_COPY_AND_ASSIGN(ScopedSurfaceReferenceBase); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace cc | 41 } // namespace cc |
| 42 | 42 |
| 43 #endif // CC_SURFACES_SURFACE_REFERENCE_BASE_H_ | 43 #endif // CC_SURFACES_SCOPED_SURFACE_REFERENCE_BASE_H_ |
| OLD | NEW |