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

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

Issue 2009443002: Revert of Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 ContextProvider; 32 class GLFrameData;
33 } 33 }
34 34
35 namespace content { 35 namespace content {
36 class ContextProviderCommandBuffer;
36 class FrameSwapMessageQueue; 37 class FrameSwapMessageQueue;
37 38
38 // This class can be created only on the main thread, but then becomes pinned 39 // This class can be created only on the main thread, but then becomes pinned
39 // to a fixed thread when BindToClient is called. 40 // to a fixed thread when bindToClient is called.
40 class CompositorOutputSurface 41 class CompositorOutputSurface
41 : NON_EXPORTED_BASE(public cc::OutputSurface), 42 : NON_EXPORTED_BASE(public cc::OutputSurface),
42 NON_EXPORTED_BASE(public base::NonThreadSafe) { 43 NON_EXPORTED_BASE(public base::NonThreadSafe) {
43 public: 44 public:
44 CompositorOutputSurface( 45 CompositorOutputSurface(
45 int32_t routing_id, 46 int32_t routing_id,
46 uint32_t output_surface_id, 47 uint32_t output_surface_id,
47 scoped_refptr<cc::ContextProvider> context_provider, 48 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
48 scoped_refptr<cc::ContextProvider> worker_context_provider, 49 const scoped_refptr<ContextProviderCommandBuffer>&
49 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); 50 worker_context_provider,
50 CompositorOutputSurface( 51 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider,
51 int32_t routing_id, 52 std::unique_ptr<cc::SoftwareOutputDevice> software,
52 uint32_t output_surface_id, 53 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue,
53 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, 54 bool use_swap_compositor_frame_message);
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);
63 uint32_t output_surface_id_; 69 uint32_t output_surface_id_;
64 70
65 private: 71 private:
66 class CompositorOutputSurfaceProxy : 72 class CompositorOutputSurfaceProxy :
67 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { 73 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> {
68 public: 74 public:
69 explicit CompositorOutputSurfaceProxy( 75 explicit CompositorOutputSurfaceProxy(
70 CompositorOutputSurface* output_surface) 76 CompositorOutputSurface* output_surface)
71 : output_surface_(output_surface) {} 77 : output_surface_(output_surface) {}
72 void ClearOutputSurface() { output_surface_ = NULL; } 78 void ClearOutputSurface() { output_surface_ = NULL; }
73 void OnMessageReceived(const IPC::Message& message) { 79 void OnMessageReceived(const IPC::Message& message) {
74 if (output_surface_) 80 if (output_surface_)
75 output_surface_->OnMessageReceived(message); 81 output_surface_->OnMessageReceived(message);
76 } 82 }
77 83
78 private: 84 private:
79 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; 85 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>;
80 ~CompositorOutputSurfaceProxy() {} 86 ~CompositorOutputSurfaceProxy() {}
81 CompositorOutputSurface* output_surface_; 87 CompositorOutputSurface* output_surface_;
82 88
83 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); 89 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy);
84 }; 90 };
85 91
86 void OnMessageReceived(const IPC::Message& message); 92 void OnMessageReceived(const IPC::Message& message);
87 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase, 93 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase,
88 base::TimeDelta interval); 94 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);
92 bool Send(IPC::Message* message); 95 bool Send(IPC::Message* message);
93 96
97 bool use_swap_compositor_frame_message_;
98
94 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; 99 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_;
95 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; 100 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_;
96 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; 101 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_;
97 scoped_refptr<IPC::SyncMessageFilter> message_sender_; 102 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
98 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 103 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
99 int routing_id_; 104 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_;
100 }; 110 };
101 111
102 } // namespace content 112 } // namespace content
103 113
104 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ 114 #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