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

Side by Side Diff: content/browser/compositor/mus_browser_compositor_output_surface.h

Issue 2464123003: Enabling Aura-Mus clients to submit frames to Mus. (Closed)
Patch Set: Rebase, addressing feedback, removing some unneded imports/deps. Created 4 years, 1 month 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
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 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 {
18 class Window;
19 class WindowCompositorFrameSink;
20 }
21
17 namespace gpu { 22 namespace gpu {
18 class GpuMemoryBufferManager; 23 class GpuMemoryBufferManager;
19 } 24 }
20 25
26 // TODO(mfomitchev): Remove once we complete the switch to Aura-Mus.
21 namespace ui { 27 namespace ui {
22 class Window; 28 class Window;
23 class WindowCompositorFrameSink; 29 class WindowCompositorFrameSink;
24 } 30 }
25 31
26 namespace content { 32 namespace content {
27 33
28 // Adapts a WebGraphicsContext3DCommandBufferImpl into a 34 // Adapts a WebGraphicsContext3DCommandBufferImpl into a
29 // cc::OutputSurface that also handles vsync parameter updates 35 // cc::OutputSurface that also handles vsync parameter updates
30 // arriving from the GPU process. 36 // arriving from the GPU process.
31 class MusBrowserCompositorOutputSurface 37 class MusBrowserCompositorOutputSurface
32 : public GpuBrowserCompositorOutputSurface, 38 : public GpuBrowserCompositorOutputSurface,
33 public cc::CompositorFrameSinkClient { 39 public cc::CompositorFrameSinkClient {
34 public: 40 public:
41 // TODO(mfomitchev): Remove this constructor once we complete the switch to
42 // Aura-Mus.
35 MusBrowserCompositorOutputSurface( 43 MusBrowserCompositorOutputSurface(
36 ui::Window* window, 44 ui::Window* window,
37 scoped_refptr<ContextProviderCommandBuffer> context, 45 scoped_refptr<ContextProviderCommandBuffer> context,
38 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
39 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, 47 scoped_refptr<ui::CompositorVSyncManager> vsync_manager,
40 cc::SyntheticBeginFrameSource* begin_frame_source, 48 cc::SyntheticBeginFrameSource* begin_frame_source,
41 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 49 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
42 overlay_candidate_validator); 50 overlay_candidate_validator);
43 51
52 MusBrowserCompositorOutputSurface(
53 aura::Window* window,
54 scoped_refptr<ContextProviderCommandBuffer> context,
55 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
56 scoped_refptr<ui::CompositorVSyncManager> vsync_manager,
57 cc::SyntheticBeginFrameSource* begin_frame_source,
58 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
59 overlay_candidate_validator);
60
44 ~MusBrowserCompositorOutputSurface() override; 61 ~MusBrowserCompositorOutputSurface() override;
45 62
46 protected: 63 protected:
47 // cc::OutputSurface implementation. 64 // cc::OutputSurface implementation.
48 void SwapBuffers(cc::OutputSurfaceFrame frame) override; 65 void SwapBuffers(cc::OutputSurfaceFrame frame) override;
49 66
50 // cc::CompositorFrameSinkClient: 67 // cc::CompositorFrameSinkClient:
51 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 68 void SetBeginFrameSource(cc::BeginFrameSource* source) override;
52 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 69 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
53 void SetTreeActivationCallback(const base::Closure& callback) override; 70 void SetTreeActivationCallback(const base::Closure& callback) override;
54 void DidReceiveCompositorFrameAck() override; 71 void DidReceiveCompositorFrameAck() override;
55 void DidLoseCompositorFrameSink() override; 72 void DidLoseCompositorFrameSink() override;
56 void OnDraw(const gfx::Transform& transform, 73 void OnDraw(const gfx::Transform& transform,
57 const gfx::Rect& viewport, 74 const gfx::Rect& viewport,
58 bool resourceless_software_draw) override; 75 bool resourceless_software_draw) override;
59 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; 76 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
60 void SetExternalTilePriorityConstraints( 77 void SetExternalTilePriorityConstraints(
61 const gfx::Rect& viewport_rect, 78 const gfx::Rect& viewport_rect,
62 const gfx::Transform& transform) override; 79 const gfx::Transform& transform) override;
63 80
64 private: 81 private:
65 uint32_t AllocateResourceId(); 82 uint32_t AllocateResourceId();
66 void FreeResourceId(uint32_t id); 83 void FreeResourceId(uint32_t id);
67 const gpu::Mailbox& GetMailboxFromResourceId(uint32_t id); 84 const gpu::Mailbox& GetMailboxFromResourceId(uint32_t id);
68 85
86 // TODO(mfomitchev): Remove once we complete the switch to Aura-Mus.
69 ui::Window* ui_window_; 87 ui::Window* ui_window_;
70 std::unique_ptr<ui::WindowCompositorFrameSink> ui_compositor_frame_sink_; 88 std::unique_ptr<ui::WindowCompositorFrameSink> ui_compositor_frame_sink_;
89
90 aura::Window* window_;
91 std::unique_ptr<aura::WindowCompositorFrameSink> compositor_frame_sink_;
71 std::vector<uint32_t> free_resource_ids_; 92 std::vector<uint32_t> free_resource_ids_;
72 std::vector<gpu::Mailbox> mailboxes_; 93 std::vector<gpu::Mailbox> mailboxes_;
73 94
74 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface); 95 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface);
75 }; 96 };
76 97
77 } // namespace content 98 } // namespace content
78 99
79 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 100 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698