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

Side by Side Diff: chrome/browser/gpu_process_host.cc

Issue 6296006: Disabled support for running GPU thread in browser process with --single-proc... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 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
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
577 // If the single-process switch is present, just launch the GPU service in a 583 // If the single-process switch is present, just launch the GPU service in a
578 // new thread in the browser process. 584 // new thread in the browser process.
579 if (browser_command_line.HasSwitch(switches::kSingleProcess)) { 585 if (browser_command_line.HasSwitch(switches::kSingleProcess)) {
580 GpuMainThread* thread = new GpuMainThread(channel_id()); 586 GpuMainThread* thread = new GpuMainThread(channel_id());
581 587
582 base::Thread::Options options; 588 base::Thread::Options options;
583 options.message_loop_type = MessageLoop::TYPE_UI; 589 options.message_loop_type = MessageLoop::TYPE_UI;
584 590
585 if (!thread->StartWithOptions(options)) 591 if (!thread->StartWithOptions(options))
586 return false; 592 return false;
587 } else {
588 CommandLine::StringType gpu_launcher =
589 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher);
590 593
591 FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty()); 594 return true;
592 if (exe_path.empty()) 595 }
593 return false; 596 #endif
594 597
595 CommandLine* cmd_line = new CommandLine(exe_path); 598 CommandLine::StringType gpu_launcher =
596 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); 599 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher);
597 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
598 600
599 // Propagate relevant command line switches. 601 FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty());
600 static const char* const kSwitchNames[] = { 602 if (exe_path.empty())
601 switches::kUseGL, 603 return false;
602 switches::kDisableGpuVsync,
603 switches::kDisableGpuWatchdog,
604 switches::kDisableLogging,
605 switches::kEnableAcceleratedDecoding,
606 switches::kEnableLogging,
607 #if defined(OS_MACOSX)
608 switches::kEnableSandboxLogging,
609 #endif
610 switches::kGpuStartupDialog,
611 switches::kLoggingLevel,
612 switches::kNoGpuSandbox,
613 switches::kNoSandbox,
614 };
615 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
616 arraysize(kSwitchNames));
617 604
618 // If specified, prepend a launcher program to the command line. 605 CommandLine* cmd_line = new CommandLine(exe_path);
619 if (!gpu_launcher.empty()) 606 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess);
620 cmd_line->PrependWrapper(gpu_launcher); 607 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
621 608
622 Launch( 609 // Propagate relevant command line switches.
610 static const char* const kSwitchNames[] = {
611 switches::kUseGL,
612 switches::kDisableGpuVsync,
613 switches::kDisableGpuWatchdog,
614 switches::kDisableLogging,
615 switches::kEnableAcceleratedDecoding,
616 switches::kEnableLogging,
617 #if defined(OS_MACOSX)
618 switches::kEnableSandboxLogging,
619 #endif
620 switches::kGpuStartupDialog,
621 switches::kLoggingLevel,
622 switches::kNoGpuSandbox,
623 switches::kNoSandbox,
624 };
625 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
626 arraysize(kSwitchNames));
627
628 // If specified, prepend a launcher program to the command line.
629 if (!gpu_launcher.empty())
630 cmd_line->PrependWrapper(gpu_launcher);
631
632 Launch(
623 #if defined(OS_WIN) 633 #if defined(OS_WIN)
624 FilePath(), 634 FilePath(),
625 #elif defined(OS_POSIX) 635 #elif defined(OS_POSIX)
626 false, // Never use the zygote (GPU plugin can't be sandboxed). 636 false, // Never use the zygote (GPU plugin can't be sandboxed).
627 base::environment_vector(), 637 base::environment_vector(),
628 #endif 638 #endif
629 cmd_line); 639 cmd_line);
630 }
631 640
632 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 641 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
633 LAUNCED, GPU_PROCESS_LIFETIME_EVENT_MAX); 642 LAUNCED, GPU_PROCESS_LIFETIME_EVENT_MAX);
634 return true; 643 return true;
635 } 644 }
636 645
637 bool GpuProcessHost::LoadGpuBlacklist() { 646 bool GpuProcessHost::LoadGpuBlacklist() {
638 if (gpu_blacklist_.get() != NULL) 647 if (gpu_blacklist_.get() != NULL)
639 return true; 648 return true;
640 static const base::StringPiece gpu_blacklist_json( 649 static const base::StringPiece gpu_blacklist_json(
641 ResourceBundle::GetSharedInstance().GetRawDataResource( 650 ResourceBundle::GetSharedInstance().GetRawDataResource(
642 IDR_GPU_BLACKLIST)); 651 IDR_GPU_BLACKLIST));
643 GpuBlacklist* blacklist = new GpuBlacklist(); 652 GpuBlacklist* blacklist = new GpuBlacklist();
644 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 653 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
645 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || 654 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) ||
646 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { 655 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) {
647 gpu_blacklist_.reset(blacklist); 656 gpu_blacklist_.reset(blacklist);
648 return true; 657 return true;
649 } 658 }
650 delete blacklist; 659 delete blacklist;
651 return false; 660 return false;
652 } 661 }
653 662
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698