OLD | NEW |
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 CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "cc/output/compositor_frame_sink_client.h" | 12 #include "cc/output/compositor_frame_sink_client.h" |
13 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 13 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
14 #include "gpu/command_buffer/common/mailbox.h" | 14 #include "gpu/command_buffer/common/mailbox.h" |
15 #include "gpu/ipc/common/surface_handle.h" | 15 #include "gpu/ipc/common/surface_handle.h" |
16 | 16 |
17 namespace aura { | 17 namespace aura { |
18 class Window; | 18 class Window; |
19 class WindowCompositorFrameSink; | 19 class WindowCompositorFrameSink; |
20 } | 20 } |
21 | 21 |
22 namespace gpu { | 22 namespace gpu { |
23 class GpuMemoryBufferManager; | 23 class GpuMemoryBufferManager; |
24 } | 24 } |
25 | 25 |
26 // TODO(mfomitchev): Remove once we complete the switch to Aura-Mus. | |
27 namespace ui { | |
28 class Window; | |
29 class WindowCompositorFrameSink; | |
30 } | |
31 | |
32 namespace content { | 26 namespace content { |
33 | 27 |
34 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | 28 // Adapts a WebGraphicsContext3DCommandBufferImpl into a |
35 // cc::OutputSurface that also handles vsync parameter updates | 29 // cc::OutputSurface that also handles vsync parameter updates |
36 // arriving from the GPU process. | 30 // arriving from the GPU process. |
37 class MusBrowserCompositorOutputSurface | 31 class MusBrowserCompositorOutputSurface |
38 : public GpuBrowserCompositorOutputSurface, | 32 : public GpuBrowserCompositorOutputSurface, |
39 public cc::CompositorFrameSinkClient { | 33 public cc::CompositorFrameSinkClient { |
40 public: | 34 public: |
41 // TODO(mfomitchev): Remove this constructor once we complete the switch to | |
42 // Aura-Mus. | |
43 MusBrowserCompositorOutputSurface( | |
44 ui::Window* window, | |
45 scoped_refptr<ui::ContextProviderCommandBuffer> context, | |
46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
47 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, | |
48 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | |
49 overlay_candidate_validator); | |
50 | |
51 MusBrowserCompositorOutputSurface( | 35 MusBrowserCompositorOutputSurface( |
52 aura::Window* window, | 36 aura::Window* window, |
53 scoped_refptr<ui::ContextProviderCommandBuffer> context, | 37 scoped_refptr<ui::ContextProviderCommandBuffer> context, |
54 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 38 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
55 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, | 39 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
56 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 40 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
57 overlay_candidate_validator); | 41 overlay_candidate_validator); |
58 | 42 |
59 ~MusBrowserCompositorOutputSurface() override; | 43 ~MusBrowserCompositorOutputSurface() override; |
60 | 44 |
(...skipping 15 matching lines...) Expand all Loading... |
76 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 60 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
77 void SetExternalTilePriorityConstraints( | 61 void SetExternalTilePriorityConstraints( |
78 const gfx::Rect& viewport_rect, | 62 const gfx::Rect& viewport_rect, |
79 const gfx::Transform& transform) override; | 63 const gfx::Transform& transform) override; |
80 | 64 |
81 private: | 65 private: |
82 uint32_t AllocateResourceId(); | 66 uint32_t AllocateResourceId(); |
83 void FreeResourceId(uint32_t id); | 67 void FreeResourceId(uint32_t id); |
84 const gpu::Mailbox& GetMailboxFromResourceId(uint32_t id); | 68 const gpu::Mailbox& GetMailboxFromResourceId(uint32_t id); |
85 | 69 |
86 // TODO(mfomitchev): Remove once we complete the switch to Aura-Mus. | |
87 ui::Window* ui_window_; | |
88 std::unique_ptr<ui::WindowCompositorFrameSink> ui_compositor_frame_sink_; | |
89 | |
90 aura::Window* window_; | 70 aura::Window* window_; |
91 std::unique_ptr<aura::WindowCompositorFrameSink> compositor_frame_sink_; | 71 std::unique_ptr<aura::WindowCompositorFrameSink> compositor_frame_sink_; |
92 std::vector<uint32_t> free_resource_ids_; | 72 std::vector<uint32_t> free_resource_ids_; |
93 std::vector<gpu::Mailbox> mailboxes_; | 73 std::vector<gpu::Mailbox> mailboxes_; |
94 cc::BeginFrameSource* begin_frame_source_; | 74 cc::BeginFrameSource* begin_frame_source_; |
95 | 75 |
96 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface); | 76 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface); |
97 }; | 77 }; |
98 | 78 |
99 } // namespace content | 79 } // namespace content |
100 | 80 |
101 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 81 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |