OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/layers/surface_layer.h" | 5 #include "cc/layers/surface_layer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 int64_t TraceId() const override { return 0; } | 34 int64_t TraceId() const override { return 0; } |
35 | 35 |
36 SurfaceSequence sequence_; | 36 SurfaceSequence sequence_; |
37 SurfaceLayer::SatisfyCallback satisfy_callback_; | 37 SurfaceLayer::SatisfyCallback satisfy_callback_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); | 39 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); |
40 }; | 40 }; |
41 | 41 |
42 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( | 42 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( |
43 const LayerSettings& settings, | |
44 const SatisfyCallback& satisfy_callback, | 43 const SatisfyCallback& satisfy_callback, |
45 const RequireCallback& require_callback) { | 44 const RequireCallback& require_callback) { |
46 return make_scoped_refptr( | 45 return make_scoped_refptr( |
47 new SurfaceLayer(settings, satisfy_callback, require_callback)); | 46 new SurfaceLayer(satisfy_callback, require_callback)); |
48 } | 47 } |
49 | 48 |
50 SurfaceLayer::SurfaceLayer(const LayerSettings& settings, | 49 SurfaceLayer::SurfaceLayer(const SatisfyCallback& satisfy_callback, |
51 const SatisfyCallback& satisfy_callback, | |
52 const RequireCallback& require_callback) | 50 const RequireCallback& require_callback) |
53 : Layer(settings), | 51 : Layer(), |
54 surface_scale_(1.f), | 52 surface_scale_(1.f), |
55 satisfy_callback_(satisfy_callback), | 53 satisfy_callback_(satisfy_callback), |
56 require_callback_(require_callback) { | 54 require_callback_(require_callback) {} |
57 } | |
58 | 55 |
59 SurfaceLayer::~SurfaceLayer() { | 56 SurfaceLayer::~SurfaceLayer() { |
60 DCHECK(!layer_tree_host()); | 57 DCHECK(!layer_tree_host()); |
61 DCHECK(destroy_sequence_.is_null()); | 58 DCHECK(destroy_sequence_.is_null()); |
62 } | 59 } |
63 | 60 |
64 void SurfaceLayer::SetSurfaceId(SurfaceId surface_id, | 61 void SurfaceLayer::SetSurfaceId(SurfaceId surface_id, |
65 float scale, | 62 float scale, |
66 const gfx::Size& size) { | 63 const gfx::Size& size) { |
67 SatisfyDestroySequence(); | 64 SatisfyDestroySequence(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (!layer_tree_host()) | 112 if (!layer_tree_host()) |
116 return; | 113 return; |
117 DCHECK(!destroy_sequence_.is_null()); | 114 DCHECK(!destroy_sequence_.is_null()); |
118 scoped_ptr<SatisfySwapPromise> satisfy( | 115 scoped_ptr<SatisfySwapPromise> satisfy( |
119 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 116 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
120 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); | 117 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); |
121 destroy_sequence_ = SurfaceSequence(); | 118 destroy_sequence_ = SurfaceSequence(); |
122 } | 119 } |
123 | 120 |
124 } // namespace cc | 121 } // namespace cc |
OLD | NEW |