Chromium Code Reviews| 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" |
| 11 #include "cc/layers/surface_layer_impl.h" | 11 #include "cc/layers/surface_layer_impl.h" |
| 12 #include "cc/output/swap_promise.h" | 12 #include "cc/output/swap_promise.h" |
| 13 #include "cc/surfaces/surface_sequence_generator.h" | 13 #include "cc/surfaces/surface_sequence_generator.h" |
| 14 #include "cc/trees/layer_tree_host.h" | 14 #include "cc/trees/layer_tree_host.h" |
| 15 #include "cc/trees/swap_promise_manager.h" | 15 #include "cc/trees/swap_promise_manager.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 class SatisfySwapPromise : public SwapPromise { | 19 class SatisfySwapPromise : public SwapPromise { |
| 20 public: | 20 public: |
| 21 SatisfySwapPromise(SurfaceSequence sequence, | 21 SatisfySwapPromise(SurfaceSequence sequence, |
| 22 const SurfaceLayer::SatisfyCallback& satisfy_callback) | 22 const SurfaceLayer::SatisfyCallback& satisfy_callback) |
| 23 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} | 23 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} |
| 24 | 24 |
| 25 ~SatisfySwapPromise() override {} | 25 ~SatisfySwapPromise() override {} |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 void DidActivate() override {} | 28 void DidActivate() override {} |
| 29 void DidSwap(CompositorFrameMetadata* metadata) override { | 29 void DidSwap(CompositorFrameMetadata* metadata) override { |
| 30 metadata->satisfies_sequences.push_back(sequence_.sequence); | 30 satisfy_callback_.Run(sequence_); |
|
Fady Samuel
2016/11/30 15:35:28
I think this runs on the compositor thread whereas
| |
| 31 } | 31 } |
| 32 | 32 |
| 33 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override { | 33 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override { |
| 34 satisfy_callback_.Run(sequence_); | 34 satisfy_callback_.Run(sequence_); |
| 35 return DidNotSwapAction::BREAK_PROMISE; | 35 return DidNotSwapAction::BREAK_PROMISE; |
| 36 } | 36 } |
| 37 int64_t TraceId() const override { return 0; } | 37 int64_t TraceId() const override { return 0; } |
| 38 | 38 |
| 39 SurfaceSequence sequence_; | 39 SurfaceSequence sequence_; |
| 40 SurfaceLayer::SatisfyCallback satisfy_callback_; | 40 SurfaceLayer::SatisfyCallback satisfy_callback_; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 return; | 118 return; |
| 119 DCHECK(destroy_sequence_.is_valid()); | 119 DCHECK(destroy_sequence_.is_valid()); |
| 120 std::unique_ptr<SatisfySwapPromise> satisfy( | 120 std::unique_ptr<SatisfySwapPromise> satisfy( |
| 121 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 121 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
| 122 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( | 122 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( |
| 123 std::move(satisfy)); | 123 std::move(satisfy)); |
| 124 destroy_sequence_ = SurfaceSequence(); | 124 destroy_sequence_ = SurfaceSequence(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace cc | 127 } // namespace cc |
| OLD | NEW |