| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" | 5 #include "chrome/browser/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 BrowserChildProcessHost::OnProcessCrashed(exit_code); | 567 BrowserChildProcessHost::OnProcessCrashed(exit_code); |
| 568 } | 568 } |
| 569 | 569 |
| 570 bool GpuProcessHost::CanLaunchGpuProcess() const { | 570 bool GpuProcessHost::CanLaunchGpuProcess() const { |
| 571 return RenderViewHostDelegateHelper::gpu_enabled(); | 571 return RenderViewHostDelegateHelper::gpu_enabled(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 bool GpuProcessHost::LaunchGpuProcess() { | 574 bool GpuProcessHost::LaunchGpuProcess() { |
| 575 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 575 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 576 | 576 |
| 577 // TODO(apatrick): This cannot be a UI message pump on Linux because glib is | |
| 578 // not thread safe. Changing this to an IO message pump does not completely | |
| 579 // resolve the problem, most likely because we're sharing a connection to the | |
| 580 // X server with the browser. | |
| 581 #if !defined(OS_LINUX) | |
| 582 | |
| 583 // If the single-process switch is present, just launch the GPU service in a | 577 // If the single-process switch is present, just launch the GPU service in a |
| 584 // new thread in the browser process. | 578 // new thread in the browser process. |
| 585 if (browser_command_line.HasSwitch(switches::kSingleProcess)) { | 579 if (browser_command_line.HasSwitch(switches::kSingleProcess)) { |
| 586 GpuMainThread* thread = new GpuMainThread(channel_id()); | 580 GpuMainThread* thread = new GpuMainThread(channel_id()); |
| 587 | 581 |
| 588 base::Thread::Options options; | 582 base::Thread::Options options; |
| 583 #if defined(OS_LINUX) |
| 584 options.message_loop_type = MessageLoop::TYPE_IO; |
| 585 #else |
| 589 options.message_loop_type = MessageLoop::TYPE_UI; | 586 options.message_loop_type = MessageLoop::TYPE_UI; |
| 587 #endif |
| 590 | 588 |
| 591 if (!thread->StartWithOptions(options)) | 589 if (!thread->StartWithOptions(options)) |
| 592 return false; | 590 return false; |
| 593 | 591 |
| 594 return true; | 592 return true; |
| 595 } | 593 } |
| 596 #endif | |
| 597 | 594 |
| 598 CommandLine::StringType gpu_launcher = | 595 CommandLine::StringType gpu_launcher = |
| 599 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); | 596 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
| 600 | 597 |
| 601 FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty()); | 598 FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty()); |
| 602 if (exe_path.empty()) | 599 if (exe_path.empty()) |
| 603 return false; | 600 return false; |
| 604 | 601 |
| 605 CommandLine* cmd_line = new CommandLine(exe_path); | 602 CommandLine* cmd_line = new CommandLine(exe_path); |
| 606 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); | 603 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 650 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 654 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 651 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
| 655 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { | 652 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { |
| 656 gpu_blacklist_.reset(blacklist); | 653 gpu_blacklist_.reset(blacklist); |
| 657 return true; | 654 return true; |
| 658 } | 655 } |
| 659 delete blacklist; | 656 delete blacklist; |
| 660 return false; | 657 return false; |
| 661 } | 658 } |
| 662 | 659 |
| OLD | NEW |