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

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: Comments from avi. 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
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_channel_test_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/gl/gl_share_group.h" 28 #include "ui/gl/gl_share_group.h"
29 29
30 namespace content { 30 namespace content {
31 31
32 GpuChannelManager::GpuChannelManager( 32 GpuChannelManager::GpuChannelManager(
33 IPC::SyncChannel* channel, 33 IPC::SyncChannel* channel,
34 GpuWatchdog* watchdog, 34 GpuWatchdog* watchdog,
35 base::SingleThreadTaskRunner* task_runner, 35 base::SingleThreadTaskRunner* task_runner,
36 base::SingleThreadTaskRunner* io_task_runner, 36 base::SingleThreadTaskRunner* io_task_runner,
37 base::WaitableEvent* shutdown_event, 37 base::WaitableEvent* shutdown_event,
38 IPC::AttachmentBroker* broker,
39 gpu::SyncPointManager* sync_point_manager, 38 gpu::SyncPointManager* sync_point_manager,
40 GpuMemoryBufferFactory* gpu_memory_buffer_factory) 39 GpuMemoryBufferFactory* gpu_memory_buffer_factory)
41 : task_runner_(task_runner), 40 : task_runner_(task_runner),
42 io_task_runner_(io_task_runner), 41 io_task_runner_(io_task_runner),
43 channel_(channel), 42 channel_(channel),
44 watchdog_(watchdog), 43 watchdog_(watchdog),
45 shutdown_event_(shutdown_event), 44 shutdown_event_(shutdown_event),
46 gpu_memory_manager_( 45 gpu_memory_manager_(
47 this, 46 this,
48 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit), 47 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit),
49 sync_point_manager_(sync_point_manager), 48 sync_point_manager_(sync_point_manager),
50 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), 49 gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
51 attachment_broker_(broker),
52 weak_factory_(this) { 50 weak_factory_(this) {
53 DCHECK(task_runner); 51 DCHECK(task_runner);
54 DCHECK(io_task_runner); 52 DCHECK(io_task_runner);
55 } 53 }
56 54
57 GpuChannelManager::~GpuChannelManager() { 55 GpuChannelManager::~GpuChannelManager() {
58 // Destroy channels before anything else because of dependencies. 56 // Destroy channels before anything else because of dependencies.
59 gpu_channels_.clear(); 57 gpu_channels_.clear();
60 if (default_offscreen_surface_.get()) { 58 if (default_offscreen_surface_.get()) {
61 default_offscreen_surface_->Destroy(); 59 default_offscreen_surface_->Destroy();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 DCHECK(!mailbox_manager_.get()); 162 DCHECK(!mailbox_manager_.get());
165 mailbox_manager_ = gpu::gles2::MailboxManager::Create(); 163 mailbox_manager_ = gpu::gles2::MailboxManager::Create();
166 } 164 }
167 share_group = share_group_.get(); 165 share_group = share_group_.get();
168 mailbox_manager = mailbox_manager_.get(); 166 mailbox_manager = mailbox_manager_.get();
169 } 167 }
170 168
171 scoped_ptr<GpuChannel> channel = CreateGpuChannel( 169 scoped_ptr<GpuChannel> channel = CreateGpuChannel(
172 share_group, mailbox_manager, client_id, client_tracing_id, 170 share_group, mailbox_manager, client_id, client_tracing_id,
173 allow_future_sync_points, allow_real_time_streams); 171 allow_future_sync_points, allow_real_time_streams);
174 IPC::ChannelHandle channel_handle = 172 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_);
175 channel->Init(shutdown_event_, attachment_broker_);
176 173
177 gpu_channels_.set(client_id, channel.Pass()); 174 gpu_channels_.set(client_id, channel.Pass());
178 175
179 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); 176 Send(new GpuHostMsg_ChannelEstablished(channel_handle));
180 } 177 }
181 178
182 void GpuChannelManager::OnCloseChannel( 179 void GpuChannelManager::OnCloseChannel(
183 const IPC::ChannelHandle& channel_handle) { 180 const IPC::ChannelHandle& channel_handle) {
184 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) { 181 for (auto it = gpu_channels_.begin(); it != gpu_channels_.end(); ++it) {
185 if (it->second->channel_id() == channel_handle.name) { 182 if (it->second->channel_id() == channel_handle.name) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 281
285 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { 282 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
286 if (!default_offscreen_surface_.get()) { 283 if (!default_offscreen_surface_.get()) {
287 default_offscreen_surface_ = 284 default_offscreen_surface_ =
288 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); 285 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size());
289 } 286 }
290 return default_offscreen_surface_.get(); 287 return default_offscreen_surface_.get();
291 } 288 }
292 289
293 } // namespace content 290 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_channel_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698