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

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

Issue 1292263003: ipc: Use a global for the process's attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_message2
Patch Set: Created 5 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 #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 "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 15 matching lines...) Expand all
26 #include "ui/gl/gl_share_group.h" 26 #include "ui/gl/gl_share_group.h"
27 27
28 namespace content { 28 namespace content {
29 29
30 GpuChannelManager::GpuChannelManager( 30 GpuChannelManager::GpuChannelManager(
31 IPC::SyncChannel* channel, 31 IPC::SyncChannel* channel,
32 GpuWatchdog* watchdog, 32 GpuWatchdog* watchdog,
33 base::SingleThreadTaskRunner* task_runner, 33 base::SingleThreadTaskRunner* task_runner,
34 base::SingleThreadTaskRunner* io_task_runner, 34 base::SingleThreadTaskRunner* io_task_runner,
35 base::WaitableEvent* shutdown_event, 35 base::WaitableEvent* shutdown_event,
36 IPC::AttachmentBroker* broker,
37 gpu::SyncPointManager* sync_point_manager, 36 gpu::SyncPointManager* sync_point_manager,
38 GpuMemoryBufferFactory* gpu_memory_buffer_factory) 37 GpuMemoryBufferFactory* gpu_memory_buffer_factory)
39 : task_runner_(task_runner), 38 : task_runner_(task_runner),
40 io_task_runner_(io_task_runner), 39 io_task_runner_(io_task_runner),
41 channel_(channel), 40 channel_(channel),
42 watchdog_(watchdog), 41 watchdog_(watchdog),
43 shutdown_event_(shutdown_event), 42 shutdown_event_(shutdown_event),
44 gpu_memory_manager_( 43 gpu_memory_manager_(
45 this, 44 this,
46 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit), 45 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit),
47 sync_point_manager_(sync_point_manager), 46 sync_point_manager_(sync_point_manager),
48 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), 47 gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
49 attachment_broker_(broker),
50 weak_factory_(this) { 48 weak_factory_(this) {
51 DCHECK(task_runner); 49 DCHECK(task_runner);
52 DCHECK(io_task_runner); 50 DCHECK(io_task_runner);
53 } 51 }
54 52
55 GpuChannelManager::~GpuChannelManager() { 53 GpuChannelManager::~GpuChannelManager() {
56 // Destroy channels before anything else because of dependencies. 54 // Destroy channels before anything else because of dependencies.
57 gpu_channels_.clear(); 55 gpu_channels_.clear();
58 if (default_offscreen_surface_.get()) { 56 if (default_offscreen_surface_.get()) {
59 default_offscreen_surface_->Destroy(); 57 default_offscreen_surface_->Destroy();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 DCHECK(!mailbox_manager_.get()); 158 DCHECK(!mailbox_manager_.get());
161 mailbox_manager_ = gpu::gles2::MailboxManager::Create(); 159 mailbox_manager_ = gpu::gles2::MailboxManager::Create();
162 } 160 }
163 share_group = share_group_.get(); 161 share_group = share_group_.get();
164 mailbox_manager = mailbox_manager_.get(); 162 mailbox_manager = mailbox_manager_.get();
165 } 163 }
166 164
167 scoped_ptr<GpuChannel> channel = 165 scoped_ptr<GpuChannel> channel =
168 CreateGpuChannel(share_group, mailbox_manager, client_id, 166 CreateGpuChannel(share_group, mailbox_manager, client_id,
169 client_tracing_id, allow_future_sync_points); 167 client_tracing_id, allow_future_sync_points);
170 IPC::ChannelHandle channel_handle = 168 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_);
171 channel->Init(shutdown_event_, attachment_broker_);
172 169
173 gpu_channels_.set(client_id, channel.Pass()); 170 gpu_channels_.set(client_id, channel.Pass());
174 171
175 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); 172 Send(new GpuHostMsg_ChannelEstablished(channel_handle));
176 } 173 }
177 174
178 void GpuChannelManager::OnCloseChannel( 175 void GpuChannelManager::OnCloseChannel(
179 const IPC::ChannelHandle& channel_handle) { 176 const IPC::ChannelHandle& channel_handle) {
180 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) { 177 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) {
181 if (it->second->channel_id() == channel_handle.name) { 178 if (it->second->channel_id() == channel_handle.name) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 273
277 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { 274 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
278 if (!default_offscreen_surface_.get()) { 275 if (!default_offscreen_surface_.get()) {
279 default_offscreen_surface_ = 276 default_offscreen_surface_ =
280 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); 277 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size());
281 } 278 }
282 return default_offscreen_surface_.get(); 279 return default_offscreen_surface_.get();
283 } 280 }
284 281
285 } // namespace content 282 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698