OLD | NEW |
| (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 BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
7 | |
8 #include "cc/output/output_surface.h" | |
9 #include "cc/output/renderer_settings.h" | |
10 #include "cc/scheduler/begin_frame_source.h" | |
11 #include "cc/surfaces/display.h" | |
12 #include "cc/surfaces/display_client.h" | |
13 #include "cc/surfaces/surface_factory.h" | |
14 #include "cc/surfaces/surface_factory_client.h" | |
15 #include "cc/surfaces/surface_id_allocator.h" | |
16 #include "cc/surfaces/surface_manager.h" | |
17 | |
18 namespace blimp { | |
19 namespace client { | |
20 | |
21 class BlimpDelegatingOutputSurface : public cc::OutputSurface, | |
22 public cc::SurfaceFactoryClient, | |
23 public cc::DisplayClient { | |
24 public: | |
25 BlimpDelegatingOutputSurface( | |
26 scoped_refptr<cc::ContextProvider> compositor_context_provider, | |
27 scoped_refptr<cc::ContextProvider> worker_context_provider, | |
28 std::unique_ptr<cc::OutputSurface> display_output_surface, | |
29 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
30 const cc::RendererSettings& renderer_settings, | |
31 base::SingleThreadTaskRunner* task_runner); | |
32 ~BlimpDelegatingOutputSurface() override; | |
33 | |
34 // OutputSurface implementation. | |
35 bool BindToClient(cc::OutputSurfaceClient* client) override; | |
36 void DetachFromClient() override; | |
37 void SwapBuffers(cc::CompositorFrame frame) override; | |
38 void ForceReclaimResources() override; | |
39 void BindFramebuffer() override; | |
40 uint32_t GetFramebufferCopyTextureFormat() override; | |
41 | |
42 // SurfaceFactoryClient implementation. | |
43 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
44 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
45 | |
46 // DisplayClient implementation. | |
47 void DisplayOutputSurfaceLost() override; | |
48 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
49 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | |
50 const cc::RenderPassList& render_passes) override; | |
51 void DisplayDidDrawAndSwap() override; | |
52 | |
53 private: | |
54 // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface | |
55 // is owned/destroyed on the compositor thread. | |
56 std::unique_ptr<cc::SurfaceManager> surface_manager_; | |
57 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | |
58 cc::SurfaceId delegated_surface_id_; | |
59 | |
60 // Uses surface_manager_. | |
61 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | |
62 | |
63 // Uses surface_manager_. | |
64 std::unique_ptr<cc::Display> display_; | |
65 }; | |
66 | |
67 } // namespace client | |
68 } // namespace blimp | |
69 | |
70 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
OLD | NEW |