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

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

Issue 2144393003: cc: Allow TestDelegatingOutputSurface to be used for non-pixel tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/layer_tree_pixel_test.cc ('k') | cc/test/pixel_test_delegating_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_
6 #define CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "cc/output/output_surface.h"
10 #include "cc/output/renderer_settings.h"
11 #include "cc/scheduler/begin_frame_source.h"
12 #include "cc/surfaces/display.h"
13 #include "cc/surfaces/display_client.h"
14 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surface_id_allocator.h"
17 #include "cc/surfaces/surface_manager.h"
18
19 namespace cc {
20
21 class PixelTestDelegatingOutputSurface : public OutputSurface,
22 public SurfaceFactoryClient {
23 public:
24 PixelTestDelegatingOutputSurface(
25 scoped_refptr<ContextProvider> compositor_context_provider,
26 scoped_refptr<ContextProvider> worker_context_provider,
27 scoped_refptr<ContextProvider> display_context_provider,
28 const RendererSettings& renderer_settings,
29 SharedBitmapManager* shared_bitmap_manager,
30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
31 const gfx::Size& surface_expansion_size,
32 bool allow_force_reclaim_resources,
33 bool synchronous_composite);
34 ~PixelTestDelegatingOutputSurface() override;
35
36 // OutputSurface implementation.
37 bool BindToClient(OutputSurfaceClient* client) override;
38 void DetachFromClient() override;
39 void SwapBuffers(CompositorFrame frame) override;
40 void ForceReclaimResources() override;
41 void BindFramebuffer() override;
42 uint32_t GetFramebufferCopyTextureFormat() override;
43
44 // SurfaceFactoryClient implementation.
45 void ReturnResources(const ReturnedResourceArray& resources) override;
46 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
47
48 // Allow tests to enlarge the backing texture for a non-root render pass, to
49 // simulate reusing a larger texture from a previous frame for a new
50 // render pass. This should be called before the output surface is bound.
51 void SetEnlargePassTextureAmount(const gfx::Size& amount);
52
53 private:
54 void DrawCallback(SurfaceDrawStatus);
55
56 class PixelTestDisplayClient : public DisplayClient {
57 void DisplayOutputSurfaceLost() override {}
58 void DisplaySetMemoryPolicy(const ManagedMemoryPolicy& policy) override {}
59 };
60
61 SharedBitmapManager* const shared_bitmap_manager_;
62 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_;
63 const gfx::Size surface_expansion_size_;
64 const bool allow_force_reclaim_resources_;
65 const bool synchronous_composite_;
66 const RendererSettings renderer_settings_;
67
68 // Passed to the Display.
69 scoped_refptr<ContextProvider> display_context_provider_;
70
71 gfx::Size enlarge_pass_texture_amount_;
72
73 // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface
74 // is owned/destroyed on the compositor thread.
75 std::unique_ptr<SurfaceManager> surface_manager_;
76 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_;
77 SurfaceId delegated_surface_id_;
78
79 // Uses surface_manager_.
80 std::unique_ptr<SurfaceFactory> surface_factory_;
81
82 PixelTestDisplayClient display_client_;
83 // Uses surface_manager_.
84 std::unique_ptr<Display> display_;
85
86 base::WeakPtrFactory<PixelTestDelegatingOutputSurface> weak_ptrs_;
87 };
88
89 } // namespace cc
90
91 #endif // CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/pixel_test_delegating_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698