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 : surface_scale_(1.f), |
54 surface_scale_(1.f), | |
55 satisfy_callback_(satisfy_callback), | 52 satisfy_callback_(satisfy_callback), |
56 require_callback_(require_callback) { | 53 require_callback_(require_callback) {} |
57 } | |
58 | 54 |
59 SurfaceLayer::~SurfaceLayer() { | 55 SurfaceLayer::~SurfaceLayer() { |
60 DCHECK(!layer_tree_host()); | 56 DCHECK(!layer_tree_host()); |
61 DCHECK(destroy_sequence_.is_null()); | 57 DCHECK(destroy_sequence_.is_null()); |
62 } | 58 } |
63 | 59 |
64 void SurfaceLayer::SetSurfaceId(SurfaceId surface_id, | 60 void SurfaceLayer::SetSurfaceId(SurfaceId surface_id, |
65 float scale, | 61 float scale, |
66 const gfx::Size& size) { | 62 const gfx::Size& size) { |
67 SatisfyDestroySequence(); | 63 SatisfyDestroySequence(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (!layer_tree_host()) | 111 if (!layer_tree_host()) |
116 return; | 112 return; |
117 DCHECK(!destroy_sequence_.is_null()); | 113 DCHECK(!destroy_sequence_.is_null()); |
118 scoped_ptr<SatisfySwapPromise> satisfy( | 114 scoped_ptr<SatisfySwapPromise> satisfy( |
119 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 115 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
120 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); | 116 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); |
121 destroy_sequence_ = SurfaceSequence(); | 117 destroy_sequence_ = SurfaceSequence(); |
122 } | 118 } |
123 | 119 |
124 } // namespace cc | 120 } // namespace cc |
OLD | NEW |