Skip to content

Commit

Permalink
[Mac] Create a new helper process variant for the GPU.
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Jul 23, 2019
1 parent 4c10210 commit 2212e48
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
6 changes: 6 additions & 0 deletions script/zip_manifests/dist_zip.mac.x64.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/PkgInfo
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/Info.plist
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/MacOS/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/MacOS/Electron Helper (GPU)
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/PkgInfo
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/Info.plist
Expand Down
6 changes: 6 additions & 0 deletions script/zip_manifests/dist_zip.mac_mas.x64.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS/Electron Helper
Electron.app/Contents/Frameworks/Electron Helper.app/Contents/PkgInfo
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/Info.plist
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/MacOS/
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/MacOS/Electron Helper (GPU)
Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/PkgInfo
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/
Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/Info.plist
Expand Down
3 changes: 3 additions & 0 deletions shell/app/atom_main_delegate_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
if (base::EndsWith(path.value(), content::kMacHelperSuffix_renderer,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_renderer;
} else if (base::EndsWith(path.value(), content::kMacHelperSuffix_gpu,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_gpu;
} else if (base::EndsWith(path.value(), content::kMacHelperSuffix_plugin,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_plugin;
Expand Down
26 changes: 17 additions & 9 deletions shell/browser/atom_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,20 +497,28 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
// Make sure we're about to launch a known executable
{
base::FilePath child_path;
base::FilePath program =
base::MakeAbsoluteFilePath(command_line->GetProgram());
#if defined(OS_MACOSX)
int flags = content::ChildProcessHost::CHILD_NORMAL;
if (base::EndsWith(command_line->GetProgram().value(),
content::kMacHelperSuffix_renderer,
base::CompareCase::SENSITIVE)) {
flags = content::ChildProcessHost::CHILD_RENDERER;
auto renderer_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_RENDERER);
auto gpu_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_GPU);
auto plugin_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_PLUGIN);
child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_NORMAL);
if (!child_path.empty()) {
CHECK(program == child_path);
} else if (program != renderer_child_path || program != gpu_child_path ||
program != plugin_child_path) {
CHECK(false) << "Aborted from launching unexpected helper executable";
}
child_path = content::ChildProcessHost::GetChildPath(flags);
#else
base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
#endif

base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(base::MakeAbsoluteFilePath(command_line->GetProgram()) == child_path);
CHECK(program == child_path);
#endif
}

std::string process_type =
Expand Down
2 changes: 2 additions & 0 deletions shell/common/mac/main_application_bundle.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ bool HasMainProcessKey() {
(base::EndsWith(path.value(), " Helper", base::CompareCase::SENSITIVE) ||
base::EndsWith(path.value(), content::kMacHelperSuffix_renderer,
base::CompareCase::SENSITIVE) ||
base::EndsWith(path.value(), content::kMacHelperSuffix_gpu,
base::CompareCase::SENSITIVE) ||
base::EndsWith(path.value(), content::kMacHelperSuffix_plugin,
base::CompareCase::SENSITIVE))) {
// The running executable is the helper. Go up five steps:
Expand Down

0 comments on commit 2212e48

Please sign in to comment.