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> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "cc/layers/surface_layer_impl.h" | 10 #include "cc/layers/surface_layer_impl.h" |
8 #include "cc/output/swap_promise.h" | 11 #include "cc/output/swap_promise.h" |
9 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
10 | 13 |
11 namespace cc { | 14 namespace cc { |
12 | 15 |
13 class SatisfySwapPromise : public SwapPromise { | 16 class SatisfySwapPromise : public SwapPromise { |
14 public: | 17 public: |
15 SatisfySwapPromise(SurfaceSequence sequence, | 18 SatisfySwapPromise(SurfaceSequence sequence, |
16 const SurfaceLayer::SatisfyCallback& satisfy_callback) | 19 const SurfaceLayer::SatisfyCallback& satisfy_callback) |
17 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} | 20 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} |
18 | 21 |
19 ~SatisfySwapPromise() override {} | 22 ~SatisfySwapPromise() override {} |
20 | 23 |
21 private: | 24 private: |
22 void DidActivate() override {} | 25 void DidActivate() override {} |
23 void DidSwap(CompositorFrameMetadata* metadata) override { | 26 void DidSwap(CompositorFrameMetadata* metadata) override { |
24 metadata->satisfies_sequences.push_back(sequence_.sequence); | 27 metadata->satisfies_sequences.push_back(sequence_.sequence); |
25 } | 28 } |
26 | 29 |
27 void DidNotSwap(DidNotSwapReason reason) override { | 30 void DidNotSwap(DidNotSwapReason reason) override { |
28 satisfy_callback_.Run(sequence_); | 31 satisfy_callback_.Run(sequence_); |
29 } | 32 } |
30 int64 TraceId() const override { return 0; } | 33 int64_t TraceId() const override { return 0; } |
31 | 34 |
32 SurfaceSequence sequence_; | 35 SurfaceSequence sequence_; |
33 SurfaceLayer::SatisfyCallback satisfy_callback_; | 36 SurfaceLayer::SatisfyCallback satisfy_callback_; |
34 | 37 |
35 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); | 38 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); |
36 }; | 39 }; |
37 | 40 |
38 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( | 41 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( |
39 const LayerSettings& settings, | 42 const LayerSettings& settings, |
40 const SatisfyCallback& satisfy_callback, | 43 const SatisfyCallback& satisfy_callback, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (!layer_tree_host()) | 113 if (!layer_tree_host()) |
111 return; | 114 return; |
112 DCHECK(!destroy_sequence_.is_null()); | 115 DCHECK(!destroy_sequence_.is_null()); |
113 scoped_ptr<SatisfySwapPromise> satisfy( | 116 scoped_ptr<SatisfySwapPromise> satisfy( |
114 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 117 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
115 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); | 118 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); |
116 destroy_sequence_ = SurfaceSequence(); | 119 destroy_sequence_ = SurfaceSequence(); |
117 } | 120 } |
118 | 121 |
119 } // namespace cc | 122 } // namespace cc |
OLD | NEW |