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

Side by Side Diff: cc/test/fake_surface_observer.h

Issue 2938833002: Add SurfaceWillDraw notification (Closed)
Patch Set: add unit test to verify that OnSurfaceWillDraw is called only for surfaces added to the CompositorF… Created 3 years, 6 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
« no previous file with comments | « cc/surfaces/surface_observer.h ('k') | cc/test/fake_surface_observer.cc » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CC_TEST_FAKE_SURFACE_OBSERVER_H_ 5 #ifndef CC_TEST_FAKE_SURFACE_OBSERVER_H_
6 #define CC_TEST_FAKE_SURFACE_OBSERVER_H_ 6 #define CC_TEST_FAKE_SURFACE_OBSERVER_H_
7 7
8 #include "base/containers/flat_set.h" 8 #include "base/containers/flat_set.h"
9 #include "cc/output/begin_frame_args.h" 9 #include "cc/output/begin_frame_args.h"
10 #include "cc/surfaces/surface_id.h" 10 #include "cc/surfaces/surface_id.h"
11 #include "cc/surfaces/surface_info.h" 11 #include "cc/surfaces/surface_info.h"
12 #include "cc/surfaces/surface_observer.h" 12 #include "cc/surfaces/surface_observer.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class FakeSurfaceObserver : public SurfaceObserver { 16 class FakeSurfaceObserver : public SurfaceObserver {
17 public: 17 public:
18 // If |damage_display| is true, the observer will indicate display damage when 18 // If |damage_display| is true, the observer will indicate display damage when
19 // a surface is damaged. 19 // a surface is damaged.
20 explicit FakeSurfaceObserver(bool damage_display = true); 20 explicit FakeSurfaceObserver(bool damage_display = true);
21 virtual ~FakeSurfaceObserver(); 21 virtual ~FakeSurfaceObserver();
22 22
23 const BeginFrameAck& last_ack() const { return last_ack_; } 23 const BeginFrameAck& last_ack() const { return last_ack_; }
24 24
25 bool IsSurfaceDamaged(const SurfaceId& surface_id) const; 25 bool IsSurfaceDamaged(const SurfaceId& surface_id) const;
26 26
27 bool SurfaceWillDrawCalled(const SurfaceId& surface_id) const;
28
27 const SurfaceId& last_created_surface_id() const { 29 const SurfaceId& last_created_surface_id() const {
28 return last_created_surface_id_; 30 return last_created_surface_id_;
29 } 31 }
30 32
31 const SurfaceInfo& last_surface_info() const { return last_surface_info_; } 33 const SurfaceInfo& last_surface_info() const { return last_surface_info_; }
32 34
33 void Reset(); 35 void Reset();
34 36
35 private: 37 private:
36 // SurfaceObserver implementation: 38 // SurfaceObserver implementation:
37 bool OnSurfaceDamaged(const SurfaceId& surface_id, 39 bool OnSurfaceDamaged(const SurfaceId& surface_id,
38 const BeginFrameAck& ack) override; 40 const BeginFrameAck& ack) override;
39 void OnSurfaceCreated(const SurfaceInfo& surface_info) override; 41 void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
40 void OnSurfaceDiscarded(const SurfaceId& surface_id) override {} 42 void OnSurfaceDiscarded(const SurfaceId& surface_id) override {}
41 void OnSurfaceDestroyed(const SurfaceId& surface_id) override {} 43 void OnSurfaceDestroyed(const SurfaceId& surface_id) override {}
42 void OnSurfaceDamageExpected(const SurfaceId& surface_id, 44 void OnSurfaceDamageExpected(const SurfaceId& surface_id,
43 const BeginFrameArgs& args) override {} 45 const BeginFrameArgs& args) override {}
46 void OnSurfaceWillDraw(const SurfaceId& surface_id) override;
44 47
45 bool damage_display_; 48 bool damage_display_;
46 BeginFrameAck last_ack_; 49 BeginFrameAck last_ack_;
47 base::flat_set<SurfaceId> damaged_surfaces_; 50 base::flat_set<SurfaceId> damaged_surfaces_;
51 base::flat_set<SurfaceId> will_draw_surfaces_;
48 SurfaceId last_created_surface_id_; 52 SurfaceId last_created_surface_id_;
49 SurfaceInfo last_surface_info_; 53 SurfaceInfo last_surface_info_;
50 }; 54 };
51 55
52 } // namespace cc 56 } // namespace cc
53 57
54 #endif // CC_TEST_FAKE_SURFACE_OBSERVER_H_ 58 #endif // CC_TEST_FAKE_SURFACE_OBSERVER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_observer.h ('k') | cc/test/fake_surface_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698