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

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

Issue 2002303002: Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: outputsurface-constructors: rebase-and-fixcrash Created 4 years, 7 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_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" 22 #include "content/renderer/gpu/compositor_forwarding_message_filter.h"
23 #include "ipc/ipc_sync_message_filter.h" 23 #include "ipc/ipc_sync_message_filter.h"
24 24
25 namespace IPC { 25 namespace IPC {
26 class Message; 26 class Message;
27 } 27 }
28 28
29 namespace cc { 29 namespace cc {
30 class CompositorFrame; 30 class CompositorFrame;
31 class CompositorFrameAck; 31 class CompositorFrameAck;
32 class GLFrameData; 32 class ContextProvider;
33 } 33 }
34 34
35 namespace content { 35 namespace content {
36 class ContextProviderCommandBuffer;
37 class FrameSwapMessageQueue; 36 class FrameSwapMessageQueue;
38 37
39 // This class can be created only on the main thread, but then becomes pinned 38 // This class can be created only on the main thread, but then becomes pinned
40 // to a fixed thread when bindToClient is called. 39 // to a fixed thread when BindToClient is called.
41 class CompositorOutputSurface 40 class CompositorOutputSurface
42 : NON_EXPORTED_BASE(public cc::OutputSurface), 41 : NON_EXPORTED_BASE(public cc::OutputSurface),
43 NON_EXPORTED_BASE(public base::NonThreadSafe) { 42 NON_EXPORTED_BASE(public base::NonThreadSafe) {
44 public: 43 public:
45 CompositorOutputSurface( 44 CompositorOutputSurface(
46 int32_t routing_id, 45 int32_t routing_id,
47 uint32_t output_surface_id, 46 uint32_t output_surface_id,
48 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 47 scoped_refptr<cc::ContextProvider> context_provider,
49 const scoped_refptr<ContextProviderCommandBuffer>& 48 scoped_refptr<cc::ContextProvider> worker_context_provider,
50 worker_context_provider, 49 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue);
51 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, 50 CompositorOutputSurface(
52 std::unique_ptr<cc::SoftwareOutputDevice> software, 51 int32_t routing_id,
53 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, 52 uint32_t output_surface_id,
54 bool use_swap_compositor_frame_message); 53 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
54 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue);
55 ~CompositorOutputSurface() override; 55 ~CompositorOutputSurface() override;
56 56
57 // cc::OutputSurface implementation. 57 // cc::OutputSurface implementation.
58 bool BindToClient(cc::OutputSurfaceClient* client) override; 58 bool BindToClient(cc::OutputSurfaceClient* client) override;
59 void DetachFromClient() override; 59 void DetachFromClient() override;
60 void SwapBuffers(cc::CompositorFrame* frame) override; 60 void SwapBuffers(cc::CompositorFrame* frame) override;
61 61
62 protected: 62 protected:
63 void ShortcutSwapAck(uint32_t output_surface_id,
64 std::unique_ptr<cc::GLFrameData> gl_frame_data);
65 virtual void OnSwapAck(uint32_t output_surface_id,
66 const cc::CompositorFrameAck& ack);
67 virtual void OnReclaimResources(uint32_t output_surface_id,
68 const cc::CompositorFrameAck& ack);
69 uint32_t output_surface_id_; 63 uint32_t output_surface_id_;
70 64
71 private: 65 private:
72 class CompositorOutputSurfaceProxy : 66 class CompositorOutputSurfaceProxy :
73 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { 67 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> {
74 public: 68 public:
75 explicit CompositorOutputSurfaceProxy( 69 explicit CompositorOutputSurfaceProxy(
76 CompositorOutputSurface* output_surface) 70 CompositorOutputSurface* output_surface)
77 : output_surface_(output_surface) {} 71 : output_surface_(output_surface) {}
78 void ClearOutputSurface() { output_surface_ = NULL; } 72 void ClearOutputSurface() { output_surface_ = NULL; }
79 void OnMessageReceived(const IPC::Message& message) { 73 void OnMessageReceived(const IPC::Message& message) {
80 if (output_surface_) 74 if (output_surface_)
81 output_surface_->OnMessageReceived(message); 75 output_surface_->OnMessageReceived(message);
82 } 76 }
83 77
84 private: 78 private:
85 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; 79 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>;
86 ~CompositorOutputSurfaceProxy() {} 80 ~CompositorOutputSurfaceProxy() {}
87 CompositorOutputSurface* output_surface_; 81 CompositorOutputSurface* output_surface_;
88 82
89 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); 83 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy);
90 }; 84 };
91 85
92 void OnMessageReceived(const IPC::Message& message); 86 void OnMessageReceived(const IPC::Message& message);
93 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase, 87 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase,
94 base::TimeDelta interval); 88 base::TimeDelta interval);
89 void OnSwapAck(uint32_t output_surface_id, const cc::CompositorFrameAck& ack);
90 void OnReclaimResources(uint32_t output_surface_id,
91 const cc::CompositorFrameAck& ack);
95 bool Send(IPC::Message* message); 92 bool Send(IPC::Message* message);
96 93
97 bool use_swap_compositor_frame_message_;
98
99 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; 94 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_;
100 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; 95 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_;
101 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; 96 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_;
102 scoped_refptr<IPC::SyncMessageFilter> message_sender_; 97 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
103 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 98 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
104 int routing_id_; 99 int routing_id_;
105
106 // TODO(danakj): Remove this when crbug.com/311404
107 bool layout_test_mode_;
108 std::unique_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_;
109 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_;
110 }; 100 };
111 101
112 } // namespace content 102 } // namespace content
113 103
114 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 104 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_output_surface.cc ('k') | content/renderer/gpu/compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698