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

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

Issue 1184523003: attachment broker wip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comments. Created 5 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 #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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return supported_types[0]; 86 return supported_types[0];
87 } 87 }
88 88
89 } // namespace 89 } // namespace
90 90
91 GpuChannelManager::GpuChannelManager( 91 GpuChannelManager::GpuChannelManager(
92 MessageRouter* router, 92 MessageRouter* router,
93 GpuWatchdog* watchdog, 93 GpuWatchdog* watchdog,
94 base::SingleThreadTaskRunner* io_task_runner, 94 base::SingleThreadTaskRunner* io_task_runner,
95 base::WaitableEvent* shutdown_event, 95 base::WaitableEvent* shutdown_event,
96 IPC::SyncChannel* channel) 96 IPC::SyncChannel* channel,
97 IPC::AttachmentBroker* broker)
97 : io_task_runner_(io_task_runner), 98 : io_task_runner_(io_task_runner),
98 shutdown_event_(shutdown_event), 99 shutdown_event_(shutdown_event),
99 router_(router), 100 router_(router),
100 gpu_memory_manager_( 101 gpu_memory_manager_(
101 this, 102 this,
102 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit), 103 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit),
103 watchdog_(watchdog), 104 watchdog_(watchdog),
104 sync_point_manager_(gpu::SyncPointManager::Create(false)), 105 sync_point_manager_(gpu::SyncPointManager::Create(false)),
105 gpu_memory_buffer_factory_( 106 gpu_memory_buffer_factory_(
106 GpuMemoryBufferFactory::Create(GetGpuMemoryBufferFactoryType())), 107 GpuMemoryBufferFactory::Create(GetGpuMemoryBufferFactoryType())),
107 channel_(channel), 108 channel_(channel),
108 filter_( 109 filter_(
109 new GpuChannelManagerMessageFilter(gpu_memory_buffer_factory_.get())), 110 new GpuChannelManagerMessageFilter(gpu_memory_buffer_factory_.get())),
110 relinquish_resources_pending_(false), 111 relinquish_resources_pending_(false),
112 attachment_broker_(broker),
111 weak_factory_(this) { 113 weak_factory_(this) {
112 DCHECK(router_); 114 DCHECK(router_);
113 DCHECK(io_task_runner); 115 DCHECK(io_task_runner);
114 DCHECK(shutdown_event); 116 DCHECK(shutdown_event);
115 channel_->AddFilter(filter_.get()); 117 channel_->AddFilter(filter_.get());
116 } 118 }
117 119
118 GpuChannelManager::~GpuChannelManager() { 120 GpuChannelManager::~GpuChannelManager() {
119 gpu_channels_.clear(); 121 gpu_channels_.clear();
120 if (default_offscreen_surface_.get()) { 122 if (default_offscreen_surface_.get()) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 mailbox_manager = mailbox_manager_.get(); 205 mailbox_manager = mailbox_manager_.get();
204 } 206 }
205 207
206 scoped_ptr<GpuChannel> channel(new GpuChannel(this, 208 scoped_ptr<GpuChannel> channel(new GpuChannel(this,
207 watchdog_, 209 watchdog_,
208 share_group, 210 share_group,
209 mailbox_manager, 211 mailbox_manager,
210 client_id, 212 client_id,
211 false, 213 false,
212 allow_future_sync_points)); 214 allow_future_sync_points));
213 channel->Init(io_task_runner_.get(), shutdown_event_); 215 channel->Init(io_task_runner_.get(), shutdown_event_, attachment_broker_);
214 channel_handle.name = channel->GetChannelName(); 216 channel_handle.name = channel->GetChannelName();
215 217
216 #if defined(OS_POSIX) 218 #if defined(OS_POSIX)
217 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so 219 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so
218 // that it gets closed after it has been sent. 220 // that it gets closed after it has been sent.
219 base::ScopedFD renderer_fd = channel->TakeRendererFileDescriptor(); 221 base::ScopedFD renderer_fd = channel->TakeRendererFileDescriptor();
220 DCHECK(renderer_fd.is_valid()); 222 DCHECK(renderer_fd.is_valid());
221 channel_handle.socket = base::FileDescriptor(renderer_fd.Pass()); 223 channel_handle.socket = base::FileDescriptor(renderer_fd.Pass());
222 #endif 224 #endif
223 225
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 OnResourcesRelinquished(); 367 OnResourcesRelinquished();
366 #endif 368 #endif
367 } 369 }
368 } 370 }
369 371
370 void GpuChannelManager::OnResourcesRelinquished() { 372 void GpuChannelManager::OnResourcesRelinquished() {
371 Send(new GpuHostMsg_ResourcesRelinquished()); 373 Send(new GpuHostMsg_ResourcesRelinquished());
372 } 374 }
373 375
374 } // namespace content 376 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_channel_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698