OLD | NEW |
---|---|
(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 #include "cc/surfaces/surface_reference_base.h" | |
6 | |
7 #include "cc/surfaces/surface_reference_factory.h" | |
8 | |
9 namespace cc { | |
10 | |
11 void SurfaceReferenceBase::Destroy() { | |
12 if (!factory_) | |
13 return; | |
Fady Samuel
2016/12/13 22:55:05
Move this to the destructor:
if (factory_)
fact
Saman Sami
2016/12/14 17:50:01
Done.
| |
14 factory_->DestroyReference(this); | |
15 factory_ = nullptr; | |
16 } | |
17 | |
18 void SurfaceReferenceBase::Destroy(CompositorFrameMetadata* metadata) { | |
19 if (!factory_) | |
20 return; | |
21 factory_->DestroyReference(this, metadata); | |
22 factory_ = nullptr; | |
23 } | |
24 | |
25 bool SurfaceReferenceBase::IsDestroyed() const { | |
26 return factory_ == nullptr; | |
27 } | |
28 | |
29 SurfaceReferenceBase::~SurfaceReferenceBase() { | |
30 Destroy(); | |
31 } | |
32 | |
33 SurfaceReferenceBase::SurfaceReferenceBase( | |
34 scoped_refptr<const SurfaceReferenceFactory> factory) | |
35 : factory_(factory) {} | |
Fady Samuel
2016/12/13 22:55:05
factory_(std::move(factory))
Saman Sami
2016/12/14 17:50:01
Done.
| |
36 | |
37 } // namespace cc | |
OLD | NEW |