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/service/service_utility_process_host.h" | 5 #include "chrome/service/service_utility_process_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 SERVICE_UTILITY_DISCONNECTED, | 73 SERVICE_UTILITY_DISCONNECTED, |
74 SERVICE_UTILITY_METAFILE_REQUEST, | 74 SERVICE_UTILITY_METAFILE_REQUEST, |
75 SERVICE_UTILITY_METAFILE_SUCCEEDED, | 75 SERVICE_UTILITY_METAFILE_SUCCEEDED, |
76 SERVICE_UTILITY_METAFILE_FAILED, | 76 SERVICE_UTILITY_METAFILE_FAILED, |
77 SERVICE_UTILITY_CAPS_REQUEST, | 77 SERVICE_UTILITY_CAPS_REQUEST, |
78 SERVICE_UTILITY_CAPS_SUCCEEDED, | 78 SERVICE_UTILITY_CAPS_SUCCEEDED, |
79 SERVICE_UTILITY_CAPS_FAILED, | 79 SERVICE_UTILITY_CAPS_FAILED, |
80 SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST, | 80 SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST, |
81 SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED, | 81 SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED, |
82 SERVICE_UTILITY_SEMANTIC_CAPS_FAILED, | 82 SERVICE_UTILITY_SEMANTIC_CAPS_FAILED, |
83 SERVICE_UTILITY_FAILED_TO_START, | |
83 SERVICE_UTILITY_EVENT_MAX, | 84 SERVICE_UTILITY_EVENT_MAX, |
84 }; | 85 }; |
85 } // namespace | 86 } // namespace |
86 | 87 |
87 ServiceUtilityProcessHost::ServiceUtilityProcessHost( | 88 ServiceUtilityProcessHost::ServiceUtilityProcessHost( |
88 Client* client, base::MessageLoopProxy* client_message_loop_proxy) | 89 Client* client, base::MessageLoopProxy* client_message_loop_proxy) |
89 : handle_(base::kNullProcessHandle), | 90 : handle_(base::kNullProcessHandle), |
90 client_(client), | 91 client_(client), |
91 client_message_loop_proxy_(client_message_loop_proxy), | 92 client_message_loop_proxy_(client_message_loop_proxy), |
92 waiting_for_reply_(false) { | 93 waiting_for_reply_(false) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); | 181 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); |
181 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 182 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
182 cmd_line.AppendSwitch(switches::kLang); | 183 cmd_line.AppendSwitch(switches::kLang); |
183 | 184 |
184 if (Launch(&cmd_line, no_sandbox, exposed_dir)) { | 185 if (Launch(&cmd_line, no_sandbox, exposed_dir)) { |
185 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", | 186 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", |
186 SERVICE_UTILITY_STARTED, | 187 SERVICE_UTILITY_STARTED, |
187 SERVICE_UTILITY_EVENT_MAX); | 188 SERVICE_UTILITY_EVENT_MAX); |
188 return true; | 189 return true; |
189 } | 190 } |
191 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", | |
192 SERVICE_UTILITY_FAILED_TO_START, | |
Alexei Svitkine (slow)
2014/09/16 13:17:40
Can you make a helper function to log this histogr
| |
193 SERVICE_UTILITY_EVENT_MAX); | |
190 return false; | 194 return false; |
191 } | 195 } |
192 | 196 |
193 bool ServiceUtilityProcessHost::Launch(CommandLine* cmd_line, | 197 bool ServiceUtilityProcessHost::Launch(CommandLine* cmd_line, |
194 bool no_sandbox, | 198 bool no_sandbox, |
195 const base::FilePath& exposed_dir) { | 199 const base::FilePath& exposed_dir) { |
196 #if !defined(OS_WIN) | 200 #if !defined(OS_WIN) |
197 // TODO(sanjeevr): Implement for non-Windows OSes. | 201 // TODO(sanjeevr): Implement for non-Windows OSes. |
198 NOTIMPLEMENTED(); | 202 NOTIMPLEMENTED(); |
199 return false; | 203 return false; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 if (!metafile.InitFromFile(metafile_path)) { | 395 if (!metafile.InitFromFile(metafile_path)) { |
392 OnRenderPDFPagesToMetafileFailed(); | 396 OnRenderPDFPagesToMetafileFailed(); |
393 } else { | 397 } else { |
394 OnRenderPDFPagesToMetafileSucceeded(metafile, | 398 OnRenderPDFPagesToMetafileSucceeded(metafile, |
395 highest_rendered_page_number, | 399 highest_rendered_page_number, |
396 scale_factor); | 400 scale_factor); |
397 } | 401 } |
398 #endif // defined(OS_WIN) | 402 #endif // defined(OS_WIN) |
399 } | 403 } |
400 | 404 |
OLD | NEW |