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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 9429039: Cleanup: Remove base::environment_vector and base::file_handle_mapping_vector to StudlyCaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
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/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Don't grant further access to GPU if it is not allowed. 193 // Don't grant further access to GPU if it is not allowed.
194 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); 194 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
195 if (gpu_data_manager != NULL && !gpu_data_manager->GpuAccessAllowed()) 195 if (gpu_data_manager != NULL && !gpu_data_manager->GpuAccessAllowed())
196 return NULL; 196 return NULL;
197 197
198 // The current policy is to ignore the renderer ID and use a single GPU 198 // The current policy is to ignore the renderer ID and use a single GPU
199 // process (the first valid host in the host-id map) for all renderers. Later 199 // process (the first valid host in the host-id map) for all renderers. Later
200 // this will be extended to allow the use of multiple GPU processes. 200 // this will be extended to allow the use of multiple GPU processes.
201 for (IDMap<GpuProcessHost>::iterator it(g_hosts_by_id.Pointer()); 201 for (IDMap<GpuProcessHost>::iterator it(g_hosts_by_id.Pointer());
202 !it.IsAtEnd(); it.Advance()) { 202 !it.IsAtEnd(); it.Advance()) {
203 GpuProcessHost *host = it.GetCurrentValue(); 203 GpuProcessHost* host = it.GetCurrentValue();
204 204
205 if (host->sandboxed() != (client_id != 0)) 205 if (host->sandboxed() != (client_id != 0))
206 continue; 206 continue;
207 207
208 if (HostIsValid(host)) 208 if (HostIsValid(host))
209 return host; 209 return host;
210 } 210 }
211 211
212 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) 212 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH)
213 return NULL; 213 return NULL;
(...skipping 23 matching lines...) Expand all
237 &SendGpuProcessMessage, client_id, cause, message)); 237 &SendGpuProcessMessage, client_id, cause, message));
238 } 238 }
239 239
240 // static 240 // static
241 GpuProcessHost* GpuProcessHost::FromID(int host_id) { 241 GpuProcessHost* GpuProcessHost::FromID(int host_id) {
242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
243 243
244 if (host_id == 0) 244 if (host_id == 0)
245 return NULL; 245 return NULL;
246 246
247 GpuProcessHost *host = g_hosts_by_id.Pointer()->Lookup(host_id); 247 GpuProcessHost* host = g_hosts_by_id.Pointer()->Lookup(host_id);
248 if (HostIsValid(host)) 248 if (HostIsValid(host))
249 return host; 249 return host;
250 250
251 return NULL; 251 return NULL;
252 } 252 }
253 253
254 GpuProcessHost::GpuProcessHost(int host_id, bool sandboxed) 254 GpuProcessHost::GpuProcessHost(int host_id, bool sandboxed)
255 : host_id_(host_id), 255 : host_id_(host_id),
256 gpu_process_(base::kNullProcessHandle), 256 gpu_process_(base::kNullProcessHandle),
257 in_process_(false), 257 in_process_(false),
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // of this child window. Unfortunately it might always be necessary for 358 // of this child window. Unfortunately it might always be necessary for
359 // Windows XP because we cannot share the backing store textures between 359 // Windows XP because we cannot share the backing store textures between
360 // processes. 360 // processes.
361 options.message_loop_type = MessageLoop::TYPE_UI; 361 options.message_loop_type = MessageLoop::TYPE_UI;
362 #else 362 #else
363 options.message_loop_type = MessageLoop::TYPE_IO; 363 options.message_loop_type = MessageLoop::TYPE_IO;
364 #endif 364 #endif
365 in_process_gpu_thread_->StartWithOptions(options); 365 in_process_gpu_thread_->StartWithOptions(options);
366 366
367 OnProcessLaunched(); // Fake a callback that the process is ready. 367 OnProcessLaunched(); // Fake a callback that the process is ready.
368 } else if (!LaunchGpuProcess(channel_id)) 368 } else if (!LaunchGpuProcess(channel_id)) {
369 return false; 369 return false;
370 }
370 371
371 return Send(new GpuMsg_Initialize()); 372 return Send(new GpuMsg_Initialize());
372 } 373 }
373 374
374 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { 375 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) {
375 BrowserThread::PostTask( 376 BrowserThread::PostTask(
376 BrowserThread::UI, 377 BrowserThread::UI,
377 FROM_HERE, 378 FROM_HERE,
378 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); 379 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message));
379 } 380 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 621
621 // If specified, prepend a launcher program to the command line. 622 // If specified, prepend a launcher program to the command line.
622 if (!gpu_launcher.empty()) 623 if (!gpu_launcher.empty())
623 cmd_line->PrependWrapper(gpu_launcher); 624 cmd_line->PrependWrapper(gpu_launcher);
624 625
625 process_->Launch( 626 process_->Launch(
626 #if defined(OS_WIN) 627 #if defined(OS_WIN)
627 FilePath(), 628 FilePath(),
628 #elif defined(OS_POSIX) 629 #elif defined(OS_POSIX)
629 false, // Never use the zygote (GPU plugin can't be sandboxed). 630 false, // Never use the zygote (GPU plugin can't be sandboxed).
630 base::environment_vector(), 631 base::EnvironmentVector(),
631 #endif 632 #endif
632 cmd_line); 633 cmd_line);
633 process_launched_ = true; 634 process_launched_ = true;
634 635
635 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 636 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
636 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); 637 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX);
637 return true; 638 return true;
638 } 639 }
639 640
640 void GpuProcessHost::SendOutstandingReplies() { 641 void GpuProcessHost::SendOutstandingReplies() {
(...skipping 13 matching lines...) Expand all
654 const IPC::ChannelHandle& channel_handle, 655 const IPC::ChannelHandle& channel_handle,
655 base::ProcessHandle renderer_process_for_gpu, 656 base::ProcessHandle renderer_process_for_gpu,
656 const content::GPUInfo& gpu_info) { 657 const content::GPUInfo& gpu_info) {
657 callback.Run(channel_handle, renderer_process_for_gpu, gpu_info); 658 callback.Run(channel_handle, renderer_process_for_gpu, gpu_info);
658 } 659 }
659 660
660 void GpuProcessHost::CreateCommandBufferError( 661 void GpuProcessHost::CreateCommandBufferError(
661 const CreateCommandBufferCallback& callback, int32 route_id) { 662 const CreateCommandBufferCallback& callback, int32 route_id) {
662 callback.Run(route_id); 663 callback.Run(route_id);
663 } 664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698