OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_OUTPUT_SURFACE_CLIENT_H_ | 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ |
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ | 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ |
7 | 7 |
8 #include "cc/output/managed_memory_policy.h" | 8 #include "cc/output/managed_memory_policy.h" |
9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 class OutputSurface; | 13 class OutputSurface; |
14 | 14 |
15 class FakeOutputSurfaceClient : public OutputSurfaceClient { | 15 class FakeOutputSurfaceClient : public OutputSurfaceClient { |
16 public: | 16 public: |
17 FakeOutputSurfaceClient() | 17 FakeOutputSurfaceClient() |
18 : output_surface_(NULL), | 18 : output_surface_(NULL), |
19 begin_frame_count_(0), | |
20 swap_count_(0), | 19 swap_count_(0), |
21 deferred_initialize_called_(false), | 20 deferred_initialize_called_(false), |
22 did_lose_output_surface_called_(false), | 21 did_lose_output_surface_called_(false), |
23 memory_policy_(0) {} | 22 memory_policy_(0) {} |
24 | 23 |
25 explicit FakeOutputSurfaceClient(OutputSurface* output_surface) | 24 explicit FakeOutputSurfaceClient(OutputSurface* output_surface) |
26 : output_surface_(output_surface), | 25 : output_surface_(output_surface), |
27 begin_frame_count_(0), | |
28 swap_count_(0), | 26 swap_count_(0), |
29 deferred_initialize_called_(false), | 27 deferred_initialize_called_(false), |
30 did_lose_output_surface_called_(false), | 28 did_lose_output_surface_called_(false), |
31 memory_policy_(0) {} | 29 memory_policy_(0) {} |
32 | 30 |
33 void DeferredInitialize() override; | 31 void DeferredInitialize() override; |
34 void ReleaseGL() override; | 32 void ReleaseGL() override; |
35 void CommitVSyncParameters(base::TimeTicks timebase, | 33 void CommitVSyncParameters(base::TimeTicks timebase, |
36 base::TimeDelta interval) override {} | 34 base::TimeDelta interval) override {} |
37 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override {} | 35 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override {} |
38 void BeginFrame(const BeginFrameArgs& args) override; | |
39 void DidSwapBuffers() override; | 36 void DidSwapBuffers() override; |
40 void DidSwapBuffersComplete() override {} | 37 void DidSwapBuffersComplete() override {} |
41 void ReclaimResources(const CompositorFrameAck* ack) override {} | 38 void ReclaimResources(const CompositorFrameAck* ack) override {} |
42 void DidLoseOutputSurface() override; | 39 void DidLoseOutputSurface() override; |
43 void SetExternalDrawConstraints( | 40 void SetExternalDrawConstraints( |
44 const gfx::Transform& transform, | 41 const gfx::Transform& transform, |
45 const gfx::Rect& viewport, | 42 const gfx::Rect& viewport, |
46 const gfx::Rect& clip, | 43 const gfx::Rect& clip, |
47 const gfx::Rect& viewport_rect_for_tile_priority, | 44 const gfx::Rect& viewport_rect_for_tile_priority, |
48 const gfx::Transform& transform_for_tile_priority, | 45 const gfx::Transform& transform_for_tile_priority, |
49 bool resourceless_software_draw) override {} | 46 bool resourceless_software_draw) override {} |
50 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; | 47 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
51 void SetTreeActivationCallback(const base::Closure&) override {} | 48 void SetTreeActivationCallback(const base::Closure&) override {} |
52 | 49 |
53 int begin_frame_count() { return begin_frame_count_; } | |
54 int swap_count() { return swap_count_; } | 50 int swap_count() { return swap_count_; } |
55 | 51 |
56 bool deferred_initialize_called() { | 52 bool deferred_initialize_called() { |
57 return deferred_initialize_called_; | 53 return deferred_initialize_called_; |
58 } | 54 } |
59 | 55 |
60 bool did_lose_output_surface_called() { | 56 bool did_lose_output_surface_called() { |
61 return did_lose_output_surface_called_; | 57 return did_lose_output_surface_called_; |
62 } | 58 } |
63 | 59 |
64 const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } | 60 const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } |
65 | 61 |
66 private: | 62 private: |
67 OutputSurface* output_surface_; | 63 OutputSurface* output_surface_; |
68 int begin_frame_count_; | |
69 int swap_count_; | 64 int swap_count_; |
70 bool deferred_initialize_called_; | 65 bool deferred_initialize_called_; |
71 bool did_lose_output_surface_called_; | 66 bool did_lose_output_surface_called_; |
72 ManagedMemoryPolicy memory_policy_; | 67 ManagedMemoryPolicy memory_policy_; |
73 }; | 68 }; |
74 | 69 |
75 } // namespace cc | 70 } // namespace cc |
76 | 71 |
77 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ | 72 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ |
OLD | NEW |