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

Side by Side Diff: content/common/gpu/gpu_channel_manager.h

Issue 540443002: Enable sync allocation of GpuMemoryBuffers from the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 23 matching lines...) Expand all
34 namespace gpu { 34 namespace gpu {
35 namespace gles2 { 35 namespace gles2 {
36 class MailboxManager; 36 class MailboxManager;
37 class ProgramCache; 37 class ProgramCache;
38 class ShaderTranslatorCache; 38 class ShaderTranslatorCache;
39 } 39 }
40 } 40 }
41 41
42 namespace IPC { 42 namespace IPC {
43 struct ChannelHandle; 43 struct ChannelHandle;
44 class SyncChannel;
45 class MessageFilter;
44 } 46 }
45 47
46 struct GPUCreateCommandBufferConfig; 48 struct GPUCreateCommandBufferConfig;
47 49
48 namespace content { 50 namespace content {
49 class GpuChannel; 51 class GpuChannel;
50 class GpuMemoryBufferFactory; 52 class GpuMemoryBufferFactory;
51 class GpuWatchdog; 53 class GpuWatchdog;
52 class MessageRouter; 54 class MessageRouter;
53 class SyncPointManager; 55 class SyncPointManager;
54 56
55 // A GpuChannelManager is a thread responsible for issuing rendering commands 57 // A GpuChannelManager is a thread responsible for issuing rendering commands
56 // managing the lifetimes of GPU channels and forwarding IPC requests from the 58 // managing the lifetimes of GPU channels and forwarding IPC requests from the
57 // browser process to them based on the corresponding renderer ID. 59 // browser process to them based on the corresponding renderer ID.
58 class GpuChannelManager : public IPC::Listener, 60 class GpuChannelManager : public IPC::Listener,
59 public IPC::Sender { 61 public IPC::Sender {
60 public: 62 public:
61 GpuChannelManager(MessageRouter* router, 63 GpuChannelManager(MessageRouter* router,
62 GpuWatchdog* watchdog, 64 GpuWatchdog* watchdog,
63 base::MessageLoopProxy* io_message_loop, 65 base::MessageLoopProxy* io_message_loop,
64 base::WaitableEvent* shutdown_event); 66 base::WaitableEvent* shutdown_event,
67 IPC::SyncChannel* channel);
65 virtual ~GpuChannelManager(); 68 virtual ~GpuChannelManager();
66 69
67 // Remove the channel for a particular renderer. 70 // Remove the channel for a particular renderer.
68 void RemoveChannel(int client_id); 71 void RemoveChannel(int client_id);
69 72
70 // Listener overrides. 73 // Listener overrides.
71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
72 75
73 // Sender overrides. 76 // Sender overrides.
74 virtual bool Send(IPC::Message* msg) OVERRIDE; 77 virtual bool Send(IPC::Message* msg) OVERRIDE;
(...skipping 22 matching lines...) Expand all
97 100
98 SyncPointManager* sync_point_manager() { return sync_point_manager_.get(); } 101 SyncPointManager* sync_point_manager() { return sync_point_manager_.get(); }
99 102
100 gfx::GLSurface* GetDefaultOffscreenSurface(); 103 gfx::GLSurface* GetDefaultOffscreenSurface();
101 104
102 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { 105 GpuMemoryBufferFactory* gpu_memory_buffer_factory() {
103 return gpu_memory_buffer_factory_.get(); 106 return gpu_memory_buffer_factory_.get();
104 } 107 }
105 108
106 private: 109 private:
107 struct GpuMemoryBufferOperation {
108 GpuMemoryBufferOperation(int32 sync_point, base::Closure callback);
109 ~GpuMemoryBufferOperation();
110
111 int32 sync_point;
112 base::Closure callback;
113 };
114 typedef base::ScopedPtrHashMap<int, GpuChannel> GpuChannelMap; 110 typedef base::ScopedPtrHashMap<int, GpuChannel> GpuChannelMap;
115 typedef std::deque<GpuMemoryBufferOperation*> GpuMemoryBufferOperationQueue;
116 111
117 // Message handlers. 112 // Message handlers.
118 void OnEstablishChannel(int client_id, 113 void OnEstablishChannel(int client_id,
119 bool share_context, 114 bool share_context,
120 bool allow_future_sync_points); 115 bool allow_future_sync_points);
121 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); 116 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
122 void OnVisibilityChanged( 117 void OnVisibilityChanged(
123 int32 render_view_id, int32 client_id, bool visible); 118 int32 render_view_id, int32 client_id, bool visible);
124 void OnCreateViewCommandBuffer( 119 void OnCreateViewCommandBuffer(
125 const gfx::GLSurfaceHandle& window, 120 const gfx::GLSurfaceHandle& window,
126 int32 render_view_id, 121 int32 render_view_id,
127 int32 client_id, 122 int32 client_id,
128 const GPUCreateCommandBufferConfig& init_params, 123 const GPUCreateCommandBufferConfig& init_params,
129 int32 route_id); 124 int32 route_id);
130 void OnLoadedShader(std::string shader); 125 void OnLoadedShader(std::string shader);
131 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
132 const gfx::Size& size,
133 unsigned internalformat,
134 unsigned usage);
135 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
136 const gfx::Size& size,
137 unsigned internalformat,
138 unsigned usage);
139 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle); 126 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle);
127 void DestroyGpuMemoryBufferOnIO(const gfx::GpuMemoryBufferHandle& handle);
140 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 128 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
141 int32 sync_point); 129 int32 sync_point);
142 void OnDestroyGpuMemoryBufferSyncPointRetired(
143 GpuMemoryBufferOperation* gpu_memory_buffer_operation);
144 130
145 void OnLoseAllContexts(); 131 void OnLoseAllContexts();
146 132
147 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 133 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
148 base::WaitableEvent* shutdown_event_; 134 base::WaitableEvent* shutdown_event_;
149 135
150 // Used to send and receive IPC messages from the browser process. 136 // Used to send and receive IPC messages from the browser process.
151 MessageRouter* const router_; 137 MessageRouter* const router_;
152 138
153 // These objects manage channels to individual renderer processes there is 139 // These objects manage channels to individual renderer processes there is
154 // one channel for each renderer process that has connected to this GPU 140 // one channel for each renderer process that has connected to this GPU
155 // process. 141 // process.
156 GpuChannelMap gpu_channels_; 142 GpuChannelMap gpu_channels_;
157 scoped_refptr<gfx::GLShareGroup> share_group_; 143 scoped_refptr<gfx::GLShareGroup> share_group_;
158 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 144 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
159 GpuMemoryManager gpu_memory_manager_; 145 GpuMemoryManager gpu_memory_manager_;
160 GpuEventsDispatcher gpu_devtools_events_dispatcher_; 146 GpuEventsDispatcher gpu_devtools_events_dispatcher_;
161 GpuWatchdog* watchdog_; 147 GpuWatchdog* watchdog_;
162 scoped_refptr<SyncPointManager> sync_point_manager_; 148 scoped_refptr<SyncPointManager> sync_point_manager_;
163 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 149 scoped_ptr<gpu::gles2::ProgramCache> program_cache_;
164 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 150 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
165 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; 151 scoped_refptr<gfx::GLSurface> default_offscreen_surface_;
166 GpuMemoryBufferOperationQueue gpu_memory_buffer_operations_;
167 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; 152 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
153 IPC::SyncChannel* channel_;
154 scoped_refptr<IPC::MessageFilter> filter_;
168 155
169 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); 156 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
170 }; 157 };
171 158
172 } // namespace content 159 } // namespace content
173 160
174 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 161 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698