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

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

Issue 1126963006: Move VISUAL_STATE promise to activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Current state (presubmit warnings, cc_unittests tests failing) Created 5 years, 7 months 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
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 "cc/layers/surface_layer_impl.h" 7 #include "cc/layers/surface_layer_impl.h"
8 #include "cc/output/swap_promise.h" 8 #include "cc/output/swap_promise.h"
9 #include "cc/trees/layer_tree_host.h" 9 #include "cc/trees/layer_tree_host.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 class SatisfySwapPromise : public SwapPromise { 13 class SatisfySwapPromise : public SwapPromise {
14 public: 14 public:
15 SatisfySwapPromise(SurfaceSequence sequence, 15 SatisfySwapPromise(SurfaceSequence sequence,
16 const SurfaceLayer::SatisfyCallback& satisfy_callback) 16 const SurfaceLayer::SatisfyCallback& satisfy_callback)
17 : sequence_(sequence), satisfy_callback_(satisfy_callback) {} 17 : sequence_(sequence), satisfy_callback_(satisfy_callback) {}
18 18
19 ~SatisfySwapPromise() override {} 19 ~SatisfySwapPromise() override {}
20 20
21 private: 21 private:
22 void DidSwap(CompositorFrameMetadata* metadata) override { 22 void DidSwap(CompositorFrameMetadata* metadata) override {
23 metadata->satisfies_sequences.push_back(sequence_.sequence); 23 metadata->satisfies_sequences.push_back(sequence_.sequence);
24 } 24 }
25 25
26 void DidNotSwap(DidNotSwapReason reason) override { 26 void DidNotSwap(DidNotSwap::Reason reason) override {
27 satisfy_callback_.Run(sequence_); 27 satisfy_callback_.Run(sequence_);
28 } 28 }
29 int64 TraceId() const override { return 0; } 29 int64 TraceId() const override { return 0; }
30 30
31 SurfaceSequence sequence_; 31 SurfaceSequence sequence_;
32 SurfaceLayer::SatisfyCallback satisfy_callback_; 32 SurfaceLayer::SatisfyCallback satisfy_callback_;
33 33
34 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise); 34 DISALLOW_COPY_AND_ASSIGN(SatisfySwapPromise);
35 }; 35 };
36 36
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 require_callback_.Run(surface_id_, destroy_sequence_); 109 require_callback_.Run(surface_id_, destroy_sequence_);
110 } 110 }
111 } 111 }
112 112
113 void SurfaceLayer::SatisfyDestroySequence() { 113 void SurfaceLayer::SatisfyDestroySequence() {
114 if (!layer_tree_host()) 114 if (!layer_tree_host())
115 return; 115 return;
116 DCHECK(!destroy_sequence_.is_null()); 116 DCHECK(!destroy_sequence_.is_null());
117 scoped_ptr<SatisfySwapPromise> satisfy( 117 scoped_ptr<SatisfySwapPromise> satisfy(
118 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); 118 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_));
119 layer_tree_host()->QueueSwapPromise(satisfy.Pass()); 119 layer_tree_host()->QueuePromise(satisfy.Pass());
120 destroy_sequence_ = SurfaceSequence(); 120 destroy_sequence_ = SurfaceSequence();
121 } 121 }
122 122
123 } // namespace cc 123 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/output/activation_promise.h » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698