| OLD | NEW |
| 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 "chrome/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "components/cloud_devices/common/cloud_devices_switches.h" | 27 #include "components/cloud_devices/common/cloud_devices_switches.h" |
| 28 #include "components/version_info/version_info.h" | 28 #include "components/version_info/version_info.h" |
| 29 #include "content/public/common/content_paths.h" | 29 #include "content/public/common/content_paths.h" |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "google_apis/gaia/gaia_switches.h" | 31 #include "google_apis/gaia/gaia_switches.h" |
| 32 #include "ui/base/ui_base_switches.h" | 32 #include "ui/base/ui_base_switches.h" |
| 33 | 33 |
| 34 #if defined(OS_WIN) |
| 35 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
| 36 #endif // defined(OS_WIN) |
| 37 |
| 34 #if !defined(OS_MACOSX) | 38 #if !defined(OS_MACOSX) |
| 35 | 39 |
| 36 namespace { | 40 namespace { |
| 37 | 41 |
| 38 // This should be more than enough to hold a version string assuming each part | 42 // This should be more than enough to hold a version string assuming each part |
| 39 // of the version string is an int64_t. | 43 // of the version string is an int64_t. |
| 40 const uint32_t kMaxVersionStringLength = 256; | 44 const uint32_t kMaxVersionStringLength = 256; |
| 41 | 45 |
| 42 // The structure that gets written to shared memory. | 46 // The structure that gets written to shared memory. |
| 43 struct ServiceProcessSharedData { | 47 struct ServiceProcessSharedData { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return hex_hash + "." + append_str; | 157 return hex_hash + "." + append_str; |
| 154 } | 158 } |
| 155 | 159 |
| 156 scoped_ptr<base::CommandLine> CreateServiceProcessCommandLine() { | 160 scoped_ptr<base::CommandLine> CreateServiceProcessCommandLine() { |
| 157 base::FilePath exe_path; | 161 base::FilePath exe_path; |
| 158 PathService::Get(content::CHILD_PROCESS_EXE, &exe_path); | 162 PathService::Get(content::CHILD_PROCESS_EXE, &exe_path); |
| 159 DCHECK(!exe_path.empty()) << "Unable to get service process binary name."; | 163 DCHECK(!exe_path.empty()) << "Unable to get service process binary name."; |
| 160 scoped_ptr<base::CommandLine> command_line(new base::CommandLine(exe_path)); | 164 scoped_ptr<base::CommandLine> command_line(new base::CommandLine(exe_path)); |
| 161 command_line->AppendSwitchASCII(switches::kProcessType, | 165 command_line->AppendSwitchASCII(switches::kProcessType, |
| 162 switches::kServiceProcess); | 166 switches::kServiceProcess); |
| 167 |
| 168 #if defined(OS_WIN) |
| 169 if (startup_metric_utils::GetPreReadOptions().prefetch_argument) |
| 170 command_line->AppendArg(switches::kPrefetchArgumentOther); |
| 171 #endif // defined(OS_WIN) |
| 172 |
| 163 static const char* const kSwitchesToCopy[] = { | 173 static const char* const kSwitchesToCopy[] = { |
| 164 switches::kCloudPrintSetupProxy, | 174 switches::kCloudPrintSetupProxy, |
| 165 switches::kCloudPrintURL, | 175 switches::kCloudPrintURL, |
| 166 switches::kCloudPrintXmppEndpoint, | 176 switches::kCloudPrintXmppEndpoint, |
| 167 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
| 168 switches::kEnableCloudPrintXps, | 178 switches::kEnableCloudPrintXps, |
| 169 #endif | 179 #endif |
| 170 switches::kEnableLogging, | 180 switches::kEnableLogging, |
| 171 switches::kIgnoreUrlFetcherCertRequests, | 181 switches::kIgnoreUrlFetcherCertRequests, |
| 172 switches::kLang, | 182 switches::kLang, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 shared_data->service_process_pid = base::GetCurrentProcId(); | 280 shared_data->service_process_pid = base::GetCurrentProcId(); |
| 271 shared_mem_service_data_.reset(shared_mem_service_data.release()); | 281 shared_mem_service_data_.reset(shared_mem_service_data.release()); |
| 272 return true; | 282 return true; |
| 273 } | 283 } |
| 274 | 284 |
| 275 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { | 285 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { |
| 276 return ::GetServiceProcessChannel(); | 286 return ::GetServiceProcessChannel(); |
| 277 } | 287 } |
| 278 | 288 |
| 279 #endif // !OS_MACOSX | 289 #endif // !OS_MACOSX |
| OLD | NEW |