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

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

Issue 780133002: Add optimization for CHROMIUM_subscribe_uniform extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez@ review Created 6 years 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 #include "content/common/gpu/gpu_channel_manager.h" 5 #include "content/common/gpu/gpu_channel_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 #include "content/common/gpu/gpu_memory_buffer_factory.h" 10 #include "content/common/gpu/gpu_memory_buffer_factory.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 gpu_memory_buffer_factory_( 107 gpu_memory_buffer_factory_(
108 GpuMemoryBufferFactory::Create(GetGpuMemoryBufferFactoryType())), 108 GpuMemoryBufferFactory::Create(GetGpuMemoryBufferFactoryType())),
109 channel_(channel), 109 channel_(channel),
110 filter_( 110 filter_(
111 new GpuChannelManagerMessageFilter(gpu_memory_buffer_factory_.get())), 111 new GpuChannelManagerMessageFilter(gpu_memory_buffer_factory_.get())),
112 weak_factory_(this) { 112 weak_factory_(this) {
113 DCHECK(router_); 113 DCHECK(router_);
114 DCHECK(io_message_loop); 114 DCHECK(io_message_loop);
115 DCHECK(shutdown_event); 115 DCHECK(shutdown_event);
116 channel_->AddFilter(filter_.get()); 116 channel_->AddFilter(filter_.get());
117 subscription_ref_set_ = new gpu::gles2::SubscriptionRefSet();
118 subscription_ref_set_->AddObserver(this);
117 } 119 }
118 120
119 GpuChannelManager::~GpuChannelManager() { 121 GpuChannelManager::~GpuChannelManager() {
120 gpu_channels_.clear(); 122 gpu_channels_.clear();
123 subscription_ref_set_->RemoveObserver(this);
121 if (default_offscreen_surface_.get()) { 124 if (default_offscreen_surface_.get()) {
122 default_offscreen_surface_->Destroy(); 125 default_offscreen_surface_->Destroy();
123 default_offscreen_surface_ = NULL; 126 default_offscreen_surface_ = NULL;
124 } 127 }
125 } 128 }
126 129
127 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { 130 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() {
128 if (!program_cache_.get() && 131 if (!program_cache_.get() &&
129 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary || 132 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary ||
130 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) && 133 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) &&
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) 182 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader)
180 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) 183 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources)
181 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) 184 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState)
182 IPC_MESSAGE_UNHANDLED(handled = false) 185 IPC_MESSAGE_UNHANDLED(handled = false)
183 IPC_END_MESSAGE_MAP() 186 IPC_END_MESSAGE_MAP()
184 return handled; 187 return handled;
185 } 188 }
186 189
187 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } 190 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); }
188 191
192 void GpuChannelManager::OnAddSubscription(unsigned int target) {
193 Send(new GpuHostMsg_AddSubscription(target));
194 }
195
196 void GpuChannelManager::OnRemoveSubscription(unsigned int target) {
197 Send(new GpuHostMsg_RemoveSubscription(target));
198 }
199
189 void GpuChannelManager::OnEstablishChannel(int client_id, 200 void GpuChannelManager::OnEstablishChannel(int client_id,
190 bool share_context, 201 bool share_context,
191 bool allow_future_sync_points) { 202 bool allow_future_sync_points) {
192 IPC::ChannelHandle channel_handle; 203 IPC::ChannelHandle channel_handle;
193 204
194 gfx::GLShareGroup* share_group = NULL; 205 gfx::GLShareGroup* share_group = NULL;
195 gpu::gles2::MailboxManager* mailbox_manager = NULL; 206 gpu::gles2::MailboxManager* mailbox_manager = NULL;
196 if (share_context) { 207 if (share_context) {
197 if (!share_group_.get()) { 208 if (!share_group_.get()) {
198 share_group_ = new gfx::GLShareGroup; 209 share_group_ = new gfx::GLShareGroup;
199 DCHECK(!mailbox_manager_.get()); 210 DCHECK(!mailbox_manager_.get());
200 mailbox_manager_ = new gpu::gles2::MailboxManagerImpl; 211 mailbox_manager_ = new gpu::gles2::MailboxManagerImpl;
201 } 212 }
202 share_group = share_group_.get(); 213 share_group = share_group_.get();
203 mailbox_manager = mailbox_manager_.get(); 214 mailbox_manager = mailbox_manager_.get();
204 } 215 }
205 216
206 scoped_ptr<GpuChannel> channel(new GpuChannel(this, 217 scoped_ptr<GpuChannel> channel(new GpuChannel(this,
207 watchdog_, 218 watchdog_,
208 share_group, 219 share_group,
209 mailbox_manager, 220 mailbox_manager,
221 subscription_ref_set_.get(),
210 client_id, 222 client_id,
211 false, 223 false,
212 allow_future_sync_points)); 224 allow_future_sync_points));
213 channel->Init(io_message_loop_.get(), shutdown_event_); 225 channel->Init(io_message_loop_.get(), shutdown_event_);
214 channel_handle.name = channel->GetChannelName(); 226 channel_handle.name = channel->GetChannelName();
215 227
216 #if defined(OS_POSIX) 228 #if defined(OS_POSIX)
217 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so 229 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so
218 // that it gets closed after it has been sent. 230 // that it gets closed after it has been sent.
219 base::ScopedFD renderer_fd = channel->TakeRendererFileDescriptor(); 231 base::ScopedFD renderer_fd = channel->TakeRendererFileDescriptor();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 #else 371 #else
360 OnResourcesRelinquished(); 372 OnResourcesRelinquished();
361 #endif 373 #endif
362 } 374 }
363 375
364 void GpuChannelManager::OnResourcesRelinquished() { 376 void GpuChannelManager::OnResourcesRelinquished() {
365 Send(new GpuHostMsg_ResourcesRelinquished()); 377 Send(new GpuHostMsg_ResourcesRelinquished());
366 } 378 }
367 379
368 } // namespace content 380 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698