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

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

Issue 2402173002: cc: Get rid of PostSwapBuffersComplete. (Closed)
Patch Set: postswap: fix-blimp-unittest-post-swap-acks Created 4 years, 2 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/test/pixel_test_output_surface.cc ('k') | cc/test/test_compositor_frame_sink.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_TEST_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_
6 #define CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ 6 #define CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include "base/memory/ref_counted.h"
8 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
9 #include "cc/output/compositor_frame_sink.h" 10 #include "cc/output/compositor_frame_sink.h"
10 #include "cc/output/renderer_settings.h" 11 #include "cc/output/renderer_settings.h"
11 #include "cc/scheduler/begin_frame_source.h" 12 #include "cc/scheduler/begin_frame_source.h"
12 #include "cc/surfaces/display.h" 13 #include "cc/surfaces/display.h"
13 #include "cc/surfaces/display_client.h" 14 #include "cc/surfaces/display_client.h"
14 #include "cc/surfaces/surface_factory.h" 15 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h" 16 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surface_id_allocator.h" 17 #include "cc/surfaces/surface_id_allocator.h"
17 #include "cc/surfaces/surface_manager.h" 18 #include "cc/surfaces/surface_manager.h"
18 19
20 namespace base {
21 class SingleThreadTaskRunner;
22 }
23
19 namespace cc { 24 namespace cc {
20 class CopyOutputRequest; 25 class CopyOutputRequest;
21 class OutputSurface; 26 class OutputSurface;
22 27
23 class TestCompositorFrameSinkClient { 28 class TestCompositorFrameSinkClient {
24 public: 29 public:
25 virtual ~TestCompositorFrameSinkClient() {} 30 virtual ~TestCompositorFrameSinkClient() {}
26 31
27 virtual void DisplayReceivedCompositorFrame(const CompositorFrame& frame) = 0; 32 virtual void DisplayReceivedCompositorFrame(const CompositorFrame& frame) = 0;
28 virtual void DisplayWillDrawAndSwap(bool will_draw_and_swap, 33 virtual void DisplayWillDrawAndSwap(bool will_draw_and_swap,
29 const RenderPassList& render_passes) = 0; 34 const RenderPassList& render_passes) = 0;
30 virtual void DisplayDidDrawAndSwap() = 0; 35 virtual void DisplayDidDrawAndSwap() = 0;
31 }; 36 };
32 37
33 // CompositorFrameSink that owns and forwards frames to a Display. 38 // CompositorFrameSink that owns and forwards frames to a Display.
34 class TestCompositorFrameSink : public CompositorFrameSink, 39 class TestCompositorFrameSink : public CompositorFrameSink,
35 public SurfaceFactoryClient, 40 public SurfaceFactoryClient,
36 public DisplayClient { 41 public DisplayClient {
37 public: 42 public:
38 // Pass true for |force_disable_reclaim_resources| to act like the Display 43 // Pass true for |force_disable_reclaim_resources| to act like the Display
39 // is out-of-process and can't return resources synchronously. 44 // is out-of-process and can't return resources synchronously.
40 TestCompositorFrameSink( 45 TestCompositorFrameSink(
41 scoped_refptr<ContextProvider> compositor_context_provider, 46 scoped_refptr<ContextProvider> compositor_context_provider,
42 scoped_refptr<ContextProvider> worker_context_provider, 47 scoped_refptr<ContextProvider> worker_context_provider,
43 std::unique_ptr<OutputSurface> display_output_surface, 48 std::unique_ptr<OutputSurface> display_output_surface,
44 SharedBitmapManager* shared_bitmap_manager, 49 SharedBitmapManager* shared_bitmap_manager,
45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 50 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
46 const RendererSettings& renderer_settings, 51 const RendererSettings& renderer_settings,
47 base::SingleThreadTaskRunner* task_runner, 52 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
48 bool synchronous_composite, 53 bool synchronous_composite,
49 bool force_disable_reclaim_resources); 54 bool force_disable_reclaim_resources);
50 ~TestCompositorFrameSink() override; 55 ~TestCompositorFrameSink() override;
51 56
52 void SetClient(TestCompositorFrameSinkClient* client) { 57 void SetClient(TestCompositorFrameSinkClient* client) {
53 test_client_ = client; 58 test_client_ = client;
54 } 59 }
55 void SetEnlargePassTextureAmount(const gfx::Size& s) { 60 void SetEnlargePassTextureAmount(const gfx::Size& s) {
56 enlarge_pass_texture_amount_ = s; 61 enlarge_pass_texture_amount_ = s;
57 } 62 }
(...skipping 15 matching lines...) Expand all
73 78
74 // DisplayClient implementation. 79 // DisplayClient implementation.
75 void DisplayOutputSurfaceLost() override; 80 void DisplayOutputSurfaceLost() override;
76 void DisplayWillDrawAndSwap(bool will_draw_and_swap, 81 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
77 const RenderPassList& render_passes) override; 82 const RenderPassList& render_passes) override;
78 void DisplayDidDrawAndSwap() override; 83 void DisplayDidDrawAndSwap() override;
79 84
80 private: 85 private:
81 void DidDrawCallback(); 86 void DidDrawCallback();
82 87
88 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
89
83 FrameSinkId frame_sink_id_; 90 FrameSinkId frame_sink_id_;
84 // TODO(danakj): These don't need to be stored in unique_ptrs when 91 // TODO(danakj): These don't need to be stored in unique_ptrs when
85 // CompositorFrameSink is owned/destroyed on the compositor thread. 92 // CompositorFrameSink is owned/destroyed on the compositor thread.
86 std::unique_ptr<SurfaceManager> surface_manager_; 93 std::unique_ptr<SurfaceManager> surface_manager_;
87 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_; 94 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_;
88 LocalFrameId delegated_local_frame_id_; 95 LocalFrameId delegated_local_frame_id_;
89 96
90 // Uses surface_manager_. 97 // Uses surface_manager_.
91 std::unique_ptr<SurfaceFactory> surface_factory_; 98 std::unique_ptr<SurfaceFactory> surface_factory_;
92 99
93 // Uses surface_manager_. 100 // Uses surface_manager_.
94 std::unique_ptr<Display> display_; 101 std::unique_ptr<Display> display_;
95 102
96 const bool display_context_shared_with_compositor_; 103 const bool display_context_shared_with_compositor_;
97 104
98 bool bound_ = false; 105 bool bound_ = false;
99 TestCompositorFrameSinkClient* test_client_ = nullptr; 106 TestCompositorFrameSinkClient* test_client_ = nullptr;
100 gfx::Size enlarge_pass_texture_amount_; 107 gfx::Size enlarge_pass_texture_amount_;
101 108
102 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; 109 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_;
110
111 base::WeakPtrFactory<TestCompositorFrameSink> weak_ptr_factory_;
103 }; 112 };
104 113
105 } // namespace cc 114 } // namespace cc
106 115
107 #endif // CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ 116 #endif // CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « cc/test/pixel_test_output_surface.cc ('k') | cc/test/test_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698