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

Side by Side Diff: cc/surfaces/sequence_surface_reference_factory.cc

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: up 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
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 #include "cc/surfaces/sequence_surface_reference_factory.h"
6
7 #include "cc/surfaces/sequence_surface_reference.h"
8
9 namespace cc {
10
11 std::unique_ptr<SurfaceReferenceBase>
12 SequenceSurfaceReferenceFactory::CreateReference(
13 SurfaceReferenceOwner* owner,
14 const SurfaceId& surface_id) const {
15 auto seq = owner->GetSurfaceSequenceGenerator()->CreateSurfaceSequence();
16 RequireSequence(surface_id, seq);
17 return base::MakeUnique<SequenceSurfaceReference>(make_scoped_refptr(this),
18 seq);
19 }
20
21 void SequenceSurfaceReferenceFactory::DestroyReference(
22 SurfaceReferenceBase* surface_ref,
23 CompositorFrameMetadata* metadata) const {
24 // The surface reference was generated by this factory, so we can cast it
25 // to the type we returned in CreateReference.
Fady Samuel 2016/12/13 22:55:05 nit; You should mention that SurfaceReference is a
Saman Sami 2016/12/14 17:50:01 Done.
26 auto ref = static_cast<SequenceSurfaceReference*>(surface_ref);
27 metadata->satisfies_sequences.push_back(ref->sequence().sequence);
28 }
29
30 void SequenceSurfaceReferenceFactory::DestroyReference(
31 SurfaceReferenceBase* surface_ref) const {
32 // The surface reference was generated by this factory, so we can cast it
33 // to the type we returned in CreateReference.
Fady Samuel 2016/12/13 22:55:05 nit; You should mention that SurfaceReference is a
Saman Sami 2016/12/14 17:50:01 Done.
34 auto ref = static_cast<SequenceSurfaceReference*>(surface_ref);
35 SatisfySequence(ref->sequence());
36 }
37
38 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698