| 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 10 matching lines...) Expand all Loading... |
| 21 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} | 21 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} |
| 22 | 22 |
| 23 ~SatisfySwapPromise() override {} | 23 ~SatisfySwapPromise() override {} |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 void DidActivate() override {} | 26 void DidActivate() override {} |
| 27 void DidSwap(CompositorFrameMetadata* metadata) override { | 27 void DidSwap(CompositorFrameMetadata* metadata) override { |
| 28 metadata->satisfies_sequences.push_back(sequence_.sequence); | 28 metadata->satisfies_sequences.push_back(sequence_.sequence); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void DidNotSwap(DidNotSwapReason reason) override { | 31 bool DidNotSwap(DidNotSwapReason reason) override { |
| 32 satisfy_callback_.Run(sequence_); | 32 satisfy_callback_.Run(sequence_); |
| 33 return false; |
| 33 } | 34 } |
| 34 int64_t TraceId() const override { return 0; } | 35 int64_t TraceId() const override { return 0; } |
| 35 | 36 |
| 36 SurfaceSequence sequence_; | 37 SurfaceSequence sequence_; |
| 37 SurfaceLayer::SatisfyCallback satisfy_callback_; | 38 SurfaceLayer::SatisfyCallback satisfy_callback_; |
| 38 | 39 |
| 39 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); | 40 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( | 43 scoped_refptr<SurfaceLayer> SurfaceLayer::Create( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (!layer_tree_host()) | 113 if (!layer_tree_host()) |
| 113 return; | 114 return; |
| 114 DCHECK(!destroy_sequence_.is_null()); | 115 DCHECK(!destroy_sequence_.is_null()); |
| 115 std::unique_ptr<SatisfySwapPromise> satisfy( | 116 std::unique_ptr<SatisfySwapPromise> satisfy( |
| 116 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 117 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
| 117 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); | 118 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); |
| 118 destroy_sequence_ = SurfaceSequence(); | 119 destroy_sequence_ = SurfaceSequence(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace cc | 122 } // namespace cc |
| OLD | NEW |