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

Side by Side Diff: content/renderer/gpu/renderer_compositor_frame_sink.h

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "cc/output/begin_frame_args.h" 20 #include "cc/output/begin_frame_args.h"
21 #include "cc/output/output_surface.h" 21 #include "cc/output/compositor_frame_sink.h"
22 #include "cc/scheduler/begin_frame_source.h" 22 #include "cc/scheduler/begin_frame_source.h"
23 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" 23 #include "content/renderer/gpu/compositor_forwarding_message_filter.h"
24 #include "ipc/ipc_sync_message_filter.h" 24 #include "ipc/ipc_sync_message_filter.h"
25 25
26 namespace IPC { 26 namespace IPC {
27 class Message; 27 class Message;
28 } 28 }
29 29
30 namespace cc { 30 namespace cc {
31 class BeginFrameSource;
31 class CompositorFrame; 32 class CompositorFrame;
32 class CompositorFrameAck; 33 class CompositorFrameAck;
33 class ContextProvider; 34 class ContextProvider;
34 } 35 }
35 36
36 namespace content { 37 namespace content {
37 class FrameSwapMessageQueue; 38 class FrameSwapMessageQueue;
38 39
39 // This class can be created only on the main thread, but then becomes pinned 40 // This class can be created only on the main thread, but then becomes pinned
40 // to a fixed thread when BindToClient is called. 41 // to a fixed thread when BindToClient is called.
41 class CompositorOutputSurface 42 class RendererCompositorFrameSink
42 : NON_EXPORTED_BASE(public cc::OutputSurface), 43 : NON_EXPORTED_BASE(public cc::CompositorFrameSink),
43 NON_EXPORTED_BASE(public base::NonThreadSafe) { 44 NON_EXPORTED_BASE(public base::NonThreadSafe) {
44 public: 45 public:
45 CompositorOutputSurface( 46 RendererCompositorFrameSink(
46 int32_t routing_id, 47 int32_t routing_id,
47 uint32_t output_surface_id, 48 uint32_t compositor_frame_sink_id,
48 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 49 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
49 scoped_refptr<cc::ContextProvider> context_provider, 50 scoped_refptr<cc::ContextProvider> context_provider,
50 scoped_refptr<cc::ContextProvider> worker_context_provider, 51 scoped_refptr<cc::ContextProvider> worker_context_provider,
51 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); 52 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue);
52 CompositorOutputSurface( 53 RendererCompositorFrameSink(
53 int32_t routing_id, 54 int32_t routing_id,
54 uint32_t output_surface_id, 55 uint32_t compositor_frame_sink_id,
55 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 56 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
56 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, 57 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
57 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); 58 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue);
58 ~CompositorOutputSurface() override; 59 ~RendererCompositorFrameSink() override;
59 60
60 // cc::OutputSurface implementation. 61 // cc::CompositorFrameSink implementation.
61 bool BindToClient(cc::OutputSurfaceClient* client) override; 62 bool BindToClient(cc::CompositorFrameSinkClient* client) override;
62 void DetachFromClient() override; 63 void DetachFromClient() override;
63 void SwapBuffers(cc::CompositorFrame frame) override; 64 void SwapBuffers(cc::CompositorFrame frame) override;
64 void BindFramebuffer() override; 65 void BindFramebuffer() override;
65 uint32_t GetFramebufferCopyTextureFormat() override; 66 uint32_t GetFramebufferCopyTextureFormat() override;
66 67
67 protected: 68 protected:
68 uint32_t output_surface_id_; 69 uint32_t compositor_frame_sink_id_;
69 70
70 private: 71 private:
71 class CompositorOutputSurfaceProxy : 72 class RendererCompositorFrameSinkProxy
72 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { 73 : public base::RefCountedThreadSafe<RendererCompositorFrameSinkProxy> {
73 public: 74 public:
74 explicit CompositorOutputSurfaceProxy( 75 explicit RendererCompositorFrameSinkProxy(
75 CompositorOutputSurface* output_surface) 76 RendererCompositorFrameSink* compositor_frame_sink)
76 : output_surface_(output_surface) {} 77 : compositor_frame_sink_(compositor_frame_sink) {}
77 void ClearOutputSurface() { output_surface_ = NULL; } 78 void ClearCompositorFrameSink() { compositor_frame_sink_ = NULL; }
78 void OnMessageReceived(const IPC::Message& message) { 79 void OnMessageReceived(const IPC::Message& message) {
79 if (output_surface_) 80 if (compositor_frame_sink_)
80 output_surface_->OnMessageReceived(message); 81 compositor_frame_sink_->OnMessageReceived(message);
81 } 82 }
82 83
83 private: 84 private:
84 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; 85 friend class base::RefCountedThreadSafe<RendererCompositorFrameSinkProxy>;
85 ~CompositorOutputSurfaceProxy() {} 86 ~RendererCompositorFrameSinkProxy() {}
86 CompositorOutputSurface* output_surface_; 87 RendererCompositorFrameSink* compositor_frame_sink_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); 89 DISALLOW_COPY_AND_ASSIGN(RendererCompositorFrameSinkProxy);
89 }; 90 };
90 91
91 void OnMessageReceived(const IPC::Message& message); 92 void OnMessageReceived(const IPC::Message& message);
92 void OnReclaimCompositorResources(uint32_t output_surface_id, 93 void OnReclaimCompositorResources(uint32_t compositor_frame_sink_id,
93 bool is_swap_ack, 94 bool is_swap_ack,
94 const cc::ReturnedResourceArray& resources); 95 const cc::ReturnedResourceArray& resources);
95 bool Send(IPC::Message* message); 96 bool Send(IPC::Message* message);
96 97
97 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; 98 scoped_refptr<CompositorForwardingMessageFilter>
98 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; 99 compositor_frame_sink_filter_;
99 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; 100 CompositorForwardingMessageFilter::Handler
101 compositor_frame_sink_filter_handler_;
102 scoped_refptr<RendererCompositorFrameSinkProxy> compositor_frame_sink_proxy_;
100 scoped_refptr<IPC::SyncMessageFilter> message_sender_; 103 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
101 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 104 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
102 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; 105 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_;
103 int routing_id_; 106 int routing_id_;
104 }; 107 };
105 108
106 } // namespace content 109 } // namespace content
107 110
108 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 111 #endif // CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor_unittest.cc ('k') | content/renderer/gpu/renderer_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698