Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / test / test_context_support.h
blobadacf06b5f53a7f37cf785e1e7504c6e1679d89b
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
3 // found in the LICENSE file.
5 #ifndef CC_TEST_TEST_CONTEXT_SUPPORT_H_
6 #define CC_TEST_TEST_CONTEXT_SUPPORT_H_
8 #include <vector>
10 #include "base/memory/weak_ptr.h"
11 #include "gpu/command_buffer/client/context_support.h"
13 namespace cc {
15 class TestContextSupport : public gpu::ContextSupport {
16 public:
17 TestContextSupport();
18 virtual ~TestContextSupport();
20 // gpu::ContextSupport implementation.
21 virtual void SignalSyncPoint(uint32 sync_point,
22 const base::Closure& callback) OVERRIDE;
23 virtual void SignalQuery(uint32 query,
24 const base::Closure& callback) OVERRIDE;
25 virtual void SetSurfaceVisible(bool visible) OVERRIDE;
26 virtual void Swap() OVERRIDE;
27 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) OVERRIDE;
28 virtual void SetSwapBuffersCompleteCallback(
29 const base::Closure& callback) OVERRIDE;
30 virtual void ScheduleOverlayPlane(int plane_z_order,
31 gfx::OverlayTransform plane_transform,
32 unsigned overlay_texture_id,
33 const gfx::Rect& display_bounds,
34 const gfx::RectF& uv_rect) OVERRIDE;
36 void CallAllSyncPointCallbacks();
38 typedef base::Callback<void(bool visible)> SurfaceVisibleCallback;
39 void SetSurfaceVisibleCallback(
40 const SurfaceVisibleCallback& set_visible_callback);
42 typedef base::Callback<void(int plane_z_order,
43 gfx::OverlayTransform plane_transform,
44 unsigned overlay_texture_id,
45 const gfx::Rect& display_bounds,
46 const gfx::RectF& crop_rect)>
47 ScheduleOverlayPlaneCallback;
48 void SetScheduleOverlayPlaneCallback(
49 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback);
51 enum SwapType {
52 NO_SWAP,
53 SWAP,
54 PARTIAL_SWAP
57 SwapType last_swap_type() const { return last_swap_type_; }
58 gfx::Rect last_partial_swap_rect() const {
59 return last_partial_swap_rect_;
62 private:
63 void OnSwapBuffersComplete();
65 std::vector<base::Closure> sync_point_callbacks_;
66 SurfaceVisibleCallback set_visible_callback_;
67 ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_;
69 base::Closure swap_buffers_complete_callback_;
71 SwapType last_swap_type_;
72 gfx::Rect last_partial_swap_rect_;
74 base::WeakPtrFactory<TestContextSupport> weak_ptr_factory_;
76 DISALLOW_COPY_AND_ASSIGN(TestContextSupport);
79 } // namespace cc
81 #endif // CC_TEST_TEST_CONTEXT_SUPPORT_H_