Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: cc/layers/surface_layer.cc

Issue 2580493002: Splitting DidSwap in cc::SwapPromise into WillSwap and DidSwap (Closed)
Patch Set: x Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/client/core/compositor/blimp_compositor.cc ('k') | cc/output/latency_info_swap_promise.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WillSwap(CompositorFrameMetadata* metadata) override {
30 metadata->satisfies_sequences.push_back(sequence_.sequence); 30 metadata->satisfies_sequences.push_back(sequence_.sequence);
31 } 31 }
32 void DidSwap() override {}
32 33
33 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override { 34 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override {
34 satisfy_callback_.Run(sequence_); 35 satisfy_callback_.Run(sequence_);
35 return DidNotSwapAction::BREAK_PROMISE; 36 return DidNotSwapAction::BREAK_PROMISE;
36 } 37 }
37 int64_t TraceId() const override { return 0; } 38 int64_t TraceId() const override { return 0; }
38 39
39 SurfaceSequence sequence_; 40 SurfaceSequence sequence_;
40 SurfaceLayer::SatisfyCallback satisfy_callback_; 41 SurfaceLayer::SatisfyCallback satisfy_callback_;
41 42
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return; 119 return;
119 DCHECK(destroy_sequence_.is_valid()); 120 DCHECK(destroy_sequence_.is_valid());
120 std::unique_ptr<SatisfySwapPromise> satisfy( 121 std::unique_ptr<SatisfySwapPromise> satisfy(
121 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); 122 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_));
122 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( 123 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise(
123 std::move(satisfy)); 124 std::move(satisfy));
124 destroy_sequence_ = SurfaceSequence(); 125 destroy_sequence_ = SurfaceSequence();
125 } 126 }
126 127
127 } // namespace cc 128 } // namespace cc
OLDNEW
« no previous file with comments | « blimp/client/core/compositor/blimp_compositor.cc ('k') | cc/output/latency_info_swap_promise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698