| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app/mash/mash_runner.h" | 5 #include "chrome/app/mash/mash_runner.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 using service_manager::mojom::ServiceFactory; | 50 using service_manager::mojom::ServiceFactory; |
| 51 | 51 |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 // kProcessType used to identify child processes. | 54 // kProcessType used to identify child processes. |
| 55 const char* kMashChild = "mash-child"; | 55 const char* kMashChild = "mash-child"; |
| 56 | 56 |
| 57 const char kChromeMashServiceName[] = "chrome_mash"; | 57 const char kChromeMashServiceName[] = "chrome_mash"; |
| 58 | 58 |
| 59 const char kChromeMashContentBrowserPackageName[] = | 59 const char kChromeContentBrowserPackageName[] = "chrome_content_browser"; |
| 60 "chrome_mash_content_browser"; | |
| 61 const char kChromeContentGpuPackageName[] = "chrome_content_gpu"; | 60 const char kChromeContentGpuPackageName[] = "chrome_content_gpu"; |
| 62 const char kChromeContentRendererPackageName[] = "chrome_content_renderer"; | 61 const char kChromeContentRendererPackageName[] = "chrome_content_renderer"; |
| 63 const char kChromeContentUtilityPackageName[] = "chrome_content_utility"; | 62 const char kChromeContentUtilityPackageName[] = "chrome_content_utility"; |
| 64 | 63 |
| 65 const char kPackagesPath[] = "Packages"; | 64 const char kPackagesPath[] = "Packages"; |
| 66 const char kManifestFilename[] = "manifest.json"; | 65 const char kManifestFilename[] = "manifest.json"; |
| 67 | 66 |
| 68 base::FilePath GetPackageManifestPath(const std::string& package_name) { | 67 base::FilePath GetPackageManifestPath(const std::string& package_name) { |
| 69 base::FilePath exe = base::CommandLine::ForCurrentProcess()->GetProgram(); | 68 base::FilePath exe = base::CommandLine::ForCurrentProcess()->GetProgram(); |
| 70 return exe.DirName().AppendASCII(kPackagesPath).AppendASCII(package_name) | 69 return exe.DirName().AppendASCII(kPackagesPath).AppendASCII(package_name) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 base::RunLoop run_loop; | 166 base::RunLoop run_loop; |
| 168 catalog_connection->AddConnectionCompletedClosure(run_loop.QuitClosure()); | 167 catalog_connection->AddConnectionCompletedClosure(run_loop.QuitClosure()); |
| 169 run_loop.Run(); | 168 run_loop.Run(); |
| 170 } | 169 } |
| 171 | 170 |
| 172 // Synchronously override manifests needed for content process services. | 171 // Synchronously override manifests needed for content process services. |
| 173 catalog::mojom::CatalogControlPtr catalog_control; | 172 catalog::mojom::CatalogControlPtr catalog_control; |
| 174 catalog_connection->GetInterface(&catalog_control); | 173 catalog_connection->GetInterface(&catalog_control); |
| 175 CHECK(catalog_control->OverrideManifestPath( | 174 CHECK(catalog_control->OverrideManifestPath( |
| 176 content::mojom::kBrowserServiceName, | 175 content::mojom::kBrowserServiceName, |
| 177 GetPackageManifestPath(kChromeMashContentBrowserPackageName))); | 176 GetPackageManifestPath(kChromeContentBrowserPackageName))); |
| 178 CHECK(catalog_control->OverrideManifestPath( | 177 CHECK(catalog_control->OverrideManifestPath( |
| 179 content::mojom::kGpuServiceName, | 178 content::mojom::kGpuServiceName, |
| 180 GetPackageManifestPath(kChromeContentGpuPackageName))); | 179 GetPackageManifestPath(kChromeContentGpuPackageName))); |
| 181 CHECK(catalog_control->OverrideManifestPath( | 180 CHECK(catalog_control->OverrideManifestPath( |
| 182 content::mojom::kRendererServiceName, | 181 content::mojom::kRendererServiceName, |
| 183 GetPackageManifestPath(kChromeContentRendererPackageName))); | 182 GetPackageManifestPath(kChromeContentRendererPackageName))); |
| 184 CHECK(catalog_control->OverrideManifestPath( | 183 CHECK(catalog_control->OverrideManifestPath( |
| 185 content::mojom::kUtilityServiceName, | 184 content::mojom::kUtilityServiceName, |
| 186 GetPackageManifestPath(kChromeContentUtilityPackageName))); | 185 GetPackageManifestPath(kChromeContentUtilityPackageName))); |
| 187 | 186 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { | 258 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { |
| 260 return; | 259 return; |
| 261 } | 260 } |
| 262 | 261 |
| 263 // Include the pid as logging may not have been initialized yet (the pid | 262 // Include the pid as logging may not have been initialized yet (the pid |
| 264 // printed out by logging is wrong). | 263 // printed out by logging is wrong). |
| 265 LOG(WARNING) << "waiting for debugger to attach for service " << service_name | 264 LOG(WARNING) << "waiting for debugger to attach for service " << service_name |
| 266 << " pid=" << base::Process::Current().Pid(); | 265 << " pid=" << base::Process::Current().Pid(); |
| 267 base::debug::WaitForDebugger(120, true); | 266 base::debug::WaitForDebugger(120, true); |
| 268 } | 267 } |
| OLD | NEW |