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 FakeOutputSurfaceClient : public OutputSurfaceClient { | 13 class FakeOutputSurfaceClient : public OutputSurfaceClient { |
14 public: | 14 public: |
15 FakeOutputSurfaceClient() | 15 FakeOutputSurfaceClient() |
16 : begin_frame_count_(0), | 16 : begin_frame_count_(0), |
17 deferred_initialize_result_(true), | |
18 deferred_initialize_called_(false), | 17 deferred_initialize_called_(false), |
19 did_lose_output_surface_called_(false), | 18 did_lose_output_surface_called_(false), |
20 memory_policy_(0) {} | 19 memory_policy_(0) {} |
21 | 20 |
22 virtual bool DeferredInitialize( | 21 virtual void DeferredInitialize() OVERRIDE; |
23 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; | |
24 virtual void ReleaseGL() OVERRIDE {} | 22 virtual void ReleaseGL() OVERRIDE {} |
25 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} | 23 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} |
26 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; | 24 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; |
27 virtual void DidSwapBuffers() OVERRIDE {} | 25 virtual void DidSwapBuffers() OVERRIDE {} |
28 virtual void DidSwapBuffersComplete() OVERRIDE {} | 26 virtual void DidSwapBuffersComplete() OVERRIDE {} |
29 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} | 27 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} |
30 virtual void DidLoseOutputSurface() OVERRIDE; | 28 virtual void DidLoseOutputSurface() OVERRIDE; |
31 virtual void SetExternalDrawConstraints( | 29 virtual void SetExternalDrawConstraints( |
32 const gfx::Transform& transform, | 30 const gfx::Transform& transform, |
33 const gfx::Rect& viewport, | 31 const gfx::Rect& viewport, |
34 const gfx::Rect& clip, | 32 const gfx::Rect& clip, |
35 bool valid_for_tile_management) OVERRIDE {} | 33 bool valid_for_tile_management) OVERRIDE {} |
36 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; | 34 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; |
37 virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} | 35 virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} |
38 | 36 |
39 int begin_frame_count() { return begin_frame_count_; } | 37 int begin_frame_count() { return begin_frame_count_; } |
40 | 38 |
41 void set_deferred_initialize_result(bool result) { | |
42 deferred_initialize_result_ = result; | |
43 } | |
44 | |
45 bool deferred_initialize_called() { | 39 bool deferred_initialize_called() { |
46 return deferred_initialize_called_; | 40 return deferred_initialize_called_; |
47 } | 41 } |
48 | 42 |
49 bool did_lose_output_surface_called() { | 43 bool did_lose_output_surface_called() { |
50 return did_lose_output_surface_called_; | 44 return did_lose_output_surface_called_; |
51 } | 45 } |
52 | 46 |
53 const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } | 47 const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } |
54 | 48 |
55 private: | 49 private: |
56 int begin_frame_count_; | 50 int begin_frame_count_; |
57 bool deferred_initialize_result_; | |
58 bool deferred_initialize_called_; | 51 bool deferred_initialize_called_; |
59 bool did_lose_output_surface_called_; | 52 bool did_lose_output_surface_called_; |
60 ManagedMemoryPolicy memory_policy_; | 53 ManagedMemoryPolicy memory_policy_; |
61 }; | 54 }; |
62 | 55 |
63 } // namespace cc | 56 } // namespace cc |
64 | 57 |
65 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ | 58 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ |
OLD | NEW |