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

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 576823002: Added helper function to log CloudPrint.ServiceUtilityProcessHostEvent histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tue Sep 16 10:58:45 PDT 2014 Created 6 years, 3 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
« 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) 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 base::FilePath exposed_dir_; 61 base::FilePath exposed_dir_;
62 }; 62 };
63 63
64 } // namespace 64 } // namespace
65 65
66 #endif // OS_WIN 66 #endif // OS_WIN
67 67
68 using content::ChildProcessHost; 68 using content::ChildProcessHost;
69 69
70 namespace { 70 namespace {
71
71 enum ServiceUtilityProcessHostEvent { 72 enum ServiceUtilityProcessHostEvent {
72 SERVICE_UTILITY_STARTED, 73 SERVICE_UTILITY_STARTED,
73 SERVICE_UTILITY_DISCONNECTED, 74 SERVICE_UTILITY_DISCONNECTED,
74 SERVICE_UTILITY_METAFILE_REQUEST, 75 SERVICE_UTILITY_METAFILE_REQUEST,
75 SERVICE_UTILITY_METAFILE_SUCCEEDED, 76 SERVICE_UTILITY_METAFILE_SUCCEEDED,
76 SERVICE_UTILITY_METAFILE_FAILED, 77 SERVICE_UTILITY_METAFILE_FAILED,
77 SERVICE_UTILITY_CAPS_REQUEST, 78 SERVICE_UTILITY_CAPS_REQUEST,
78 SERVICE_UTILITY_CAPS_SUCCEEDED, 79 SERVICE_UTILITY_CAPS_SUCCEEDED,
79 SERVICE_UTILITY_CAPS_FAILED, 80 SERVICE_UTILITY_CAPS_FAILED,
80 SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST, 81 SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST,
81 SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED, 82 SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED,
82 SERVICE_UTILITY_SEMANTIC_CAPS_FAILED, 83 SERVICE_UTILITY_SEMANTIC_CAPS_FAILED,
83 SERVICE_UTILITY_FAILED_TO_START, 84 SERVICE_UTILITY_FAILED_TO_START,
84 SERVICE_UTILITY_EVENT_MAX, 85 SERVICE_UTILITY_EVENT_MAX,
85 }; 86 };
87
88 void ReportUmaEvent(ServiceUtilityProcessHostEvent id) {
89 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent",
90 id,
91 SERVICE_UTILITY_EVENT_MAX);
92 }
93
86 } // namespace 94 } // namespace
87 95
88 ServiceUtilityProcessHost::ServiceUtilityProcessHost( 96 ServiceUtilityProcessHost::ServiceUtilityProcessHost(
89 Client* client, base::MessageLoopProxy* client_message_loop_proxy) 97 Client* client, base::MessageLoopProxy* client_message_loop_proxy)
90 : handle_(base::kNullProcessHandle), 98 : handle_(base::kNullProcessHandle),
91 client_(client), 99 client_(client),
92 client_message_loop_proxy_(client_message_loop_proxy), 100 client_message_loop_proxy_(client_message_loop_proxy),
93 waiting_for_reply_(false) { 101 waiting_for_reply_(false) {
94 child_process_host_.reset(ChildProcessHost::Create(this)); 102 child_process_host_.reset(ChildProcessHost::Create(this));
95 } 103 }
96 104
97 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() { 105 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() {
98 // We need to kill the child process when the host dies. 106 // We need to kill the child process when the host dies.
99 base::KillProcess(handle_, content::RESULT_CODE_NORMAL_EXIT, false); 107 base::KillProcess(handle_, content::RESULT_CODE_NORMAL_EXIT, false);
100 } 108 }
101 109
102 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( 110 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
103 const base::FilePath& pdf_path, 111 const base::FilePath& pdf_path,
104 const printing::PdfRenderSettings& render_settings, 112 const printing::PdfRenderSettings& render_settings,
105 const std::vector<printing::PageRange>& page_ranges) { 113 const std::vector<printing::PageRange>& page_ranges) {
106 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 114 ReportUmaEvent(SERVICE_UTILITY_METAFILE_REQUEST);
107 SERVICE_UTILITY_METAFILE_REQUEST,
108 SERVICE_UTILITY_EVENT_MAX);
109 start_time_ = base::Time::Now(); 115 start_time_ = base::Time::Now();
110 #if !defined(OS_WIN) 116 #if !defined(OS_WIN)
111 // This is only implemented on Windows (because currently it is only needed 117 // This is only implemented on Windows (because currently it is only needed
112 // on Windows). Will add implementations on other platforms when needed. 118 // on Windows). Will add implementations on other platforms when needed.
113 NOTIMPLEMENTED(); 119 NOTIMPLEMENTED();
114 return false; 120 return false;
115 #else // !defined(OS_WIN) 121 #else // !defined(OS_WIN)
116 scratch_metafile_dir_.reset(new base::ScopedTempDir); 122 scratch_metafile_dir_.reset(new base::ScopedTempDir);
117 if (!scratch_metafile_dir_->CreateUniqueTempDir()) 123 if (!scratch_metafile_dir_->CreateUniqueTempDir())
118 return false; 124 return false;
(...skipping 10 matching lines...) Expand all
129 new ChromeUtilityMsg_RenderPDFPagesToMetafiles( 135 new ChromeUtilityMsg_RenderPDFPagesToMetafiles(
130 IPC::TakeFileHandleForProcess(pdf_file.Pass(), handle()), 136 IPC::TakeFileHandleForProcess(pdf_file.Pass(), handle()),
131 metafile_path_, 137 metafile_path_,
132 render_settings, 138 render_settings,
133 page_ranges)); 139 page_ranges));
134 #endif // !defined(OS_WIN) 140 #endif // !defined(OS_WIN)
135 } 141 }
136 142
137 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults( 143 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults(
138 const std::string& printer_name) { 144 const std::string& printer_name) {
139 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 145 ReportUmaEvent(SERVICE_UTILITY_CAPS_REQUEST);
140 SERVICE_UTILITY_CAPS_REQUEST,
141 SERVICE_UTILITY_EVENT_MAX);
142 start_time_ = base::Time::Now(); 146 start_time_ = base::Time::Now();
143 base::FilePath exposed_path; 147 base::FilePath exposed_path;
144 if (!StartProcess(true, exposed_path)) 148 if (!StartProcess(true, exposed_path))
145 return false; 149 return false;
146 DCHECK(!waiting_for_reply_); 150 DCHECK(!waiting_for_reply_);
147 waiting_for_reply_ = true; 151 waiting_for_reply_ = true;
148 return child_process_host_->Send( 152 return child_process_host_->Send(
149 new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name)); 153 new ChromeUtilityMsg_GetPrinterCapsAndDefaults(printer_name));
150 } 154 }
151 155
152 bool ServiceUtilityProcessHost::StartGetPrinterSemanticCapsAndDefaults( 156 bool ServiceUtilityProcessHost::StartGetPrinterSemanticCapsAndDefaults(
153 const std::string& printer_name) { 157 const std::string& printer_name) {
154 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 158 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST);
155 SERVICE_UTILITY_SEMANTIC_CAPS_REQUEST,
156 SERVICE_UTILITY_EVENT_MAX);
157 start_time_ = base::Time::Now(); 159 start_time_ = base::Time::Now();
158 base::FilePath exposed_path; 160 base::FilePath exposed_path;
159 if (!StartProcess(true, exposed_path)) 161 if (!StartProcess(true, exposed_path))
160 return false; 162 return false;
161 DCHECK(!waiting_for_reply_); 163 DCHECK(!waiting_for_reply_);
162 waiting_for_reply_ = true; 164 waiting_for_reply_ = true;
163 return child_process_host_->Send( 165 return child_process_host_->Send(
164 new ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults(printer_name)); 166 new ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults(printer_name));
165 } 167 }
166 168
167 bool ServiceUtilityProcessHost::StartProcess( 169 bool ServiceUtilityProcessHost::StartProcess(
168 bool no_sandbox, 170 bool no_sandbox,
169 const base::FilePath& exposed_dir) { 171 const base::FilePath& exposed_dir) {
170 std::string channel_id = child_process_host_->CreateChannel(); 172 std::string channel_id = child_process_host_->CreateChannel();
171 if (channel_id.empty()) 173 if (channel_id.empty())
172 return false; 174 return false;
173 175
174 base::FilePath exe_path = GetUtilityProcessCmd(); 176 base::FilePath exe_path = GetUtilityProcessCmd();
175 if (exe_path.empty()) { 177 if (exe_path.empty()) {
176 NOTREACHED() << "Unable to get utility process binary name."; 178 NOTREACHED() << "Unable to get utility process binary name.";
177 return false; 179 return false;
178 } 180 }
179 181
180 CommandLine cmd_line(exe_path); 182 CommandLine cmd_line(exe_path);
181 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); 183 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess);
182 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id); 184 cmd_line.AppendSwitchASCII(switches::kProcessChannelID, channel_id);
183 cmd_line.AppendSwitch(switches::kLang); 185 cmd_line.AppendSwitch(switches::kLang);
184 186
185 if (Launch(&cmd_line, no_sandbox, exposed_dir)) { 187 if (Launch(&cmd_line, no_sandbox, exposed_dir)) {
186 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 188 ReportUmaEvent(SERVICE_UTILITY_STARTED);
187 SERVICE_UTILITY_STARTED,
188 SERVICE_UTILITY_EVENT_MAX);
189 return true; 189 return true;
190 } 190 }
191 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 191 ReportUmaEvent(SERVICE_UTILITY_FAILED_TO_START);
192 SERVICE_UTILITY_FAILED_TO_START,
193 SERVICE_UTILITY_EVENT_MAX);
194 return false; 192 return false;
195 } 193 }
196 194
197 bool ServiceUtilityProcessHost::Launch(CommandLine* cmd_line, 195 bool ServiceUtilityProcessHost::Launch(CommandLine* cmd_line,
198 bool no_sandbox, 196 bool no_sandbox,
199 const base::FilePath& exposed_dir) { 197 const base::FilePath& exposed_dir) {
200 #if !defined(OS_WIN) 198 #if !defined(OS_WIN)
201 // TODO(sanjeevr): Implement for non-Windows OSes. 199 // TODO(sanjeevr): Implement for non-Windows OSes.
202 NOTIMPLEMENTED(); 200 NOTIMPLEMENTED();
203 return false; 201 return false;
(...skipping 19 matching lines...) Expand all
223 #endif 221 #endif
224 return ChildProcessHost::GetChildPath(flags); 222 return ChildProcessHost::GetChildPath(flags);
225 } 223 }
226 224
227 void ServiceUtilityProcessHost::OnChildDisconnected() { 225 void ServiceUtilityProcessHost::OnChildDisconnected() {
228 if (waiting_for_reply_) { 226 if (waiting_for_reply_) {
229 // If we are yet to receive a reply then notify the client that the 227 // If we are yet to receive a reply then notify the client that the
230 // child died. 228 // child died.
231 client_message_loop_proxy_->PostTask( 229 client_message_loop_proxy_->PostTask(
232 FROM_HERE, base::Bind(&Client::OnChildDied, client_.get())); 230 FROM_HERE, base::Bind(&Client::OnChildDied, client_.get()));
233 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 231 ReportUmaEvent(SERVICE_UTILITY_DISCONNECTED);
234 SERVICE_UTILITY_DISCONNECTED,
235 SERVICE_UTILITY_EVENT_MAX);
236 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityDisconnectTime", 232 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityDisconnectTime",
237 base::Time::Now() - start_time_); 233 base::Time::Now() - start_time_);
238 } 234 }
239 delete this; 235 delete this;
240 } 236 }
241 237
242 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { 238 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
243 bool handled = true; 239 bool handled = true;
244 IPC_BEGIN_MESSAGE_MAP(ServiceUtilityProcessHost, message) 240 IPC_BEGIN_MESSAGE_MAP(ServiceUtilityProcessHost, message)
245 #if defined(OS_WIN) 241 #if defined(OS_WIN)
(...skipping 20 matching lines...) Expand all
266 } 262 }
267 263
268 base::ProcessHandle ServiceUtilityProcessHost::GetHandle() const { 264 base::ProcessHandle ServiceUtilityProcessHost::GetHandle() const {
269 return handle_; 265 return handle_;
270 } 266 }
271 267
272 #if defined(OS_WIN) 268 #if defined(OS_WIN)
273 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesSucceeded( 269 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesSucceeded(
274 const std::vector<printing::PageRange>& page_ranges, 270 const std::vector<printing::PageRange>& page_ranges,
275 double scale_factor) { 271 double scale_factor) {
276 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 272 ReportUmaEvent(SERVICE_UTILITY_METAFILE_SUCCEEDED);
277 SERVICE_UTILITY_METAFILE_SUCCEEDED,
278 SERVICE_UTILITY_EVENT_MAX);
279 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityMetafileTime", 273 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityMetafileTime",
280 base::Time::Now() - start_time_); 274 base::Time::Now() - start_time_);
281 DCHECK(waiting_for_reply_); 275 DCHECK(waiting_for_reply_);
282 waiting_for_reply_ = false; 276 waiting_for_reply_ = false;
283 // If the metafile was successfully created, we need to take our hands off the 277 // If the metafile was successfully created, we need to take our hands off the
284 // scratch metafile directory. The client will delete it when it is done with 278 // scratch metafile directory. The client will delete it when it is done with
285 // metafile. 279 // metafile.
286 scratch_metafile_dir_->Take(); 280 scratch_metafile_dir_->Take();
287 281
288 // TODO(vitalybuka|scottmg): http://crbug.com/170859: Currently, only one 282 // TODO(vitalybuka|scottmg): http://crbug.com/170859: Currently, only one
289 // page is printed at a time. This would need to be refactored to change 283 // page is printed at a time. This would need to be refactored to change
290 // this. 284 // this.
291 CHECK_EQ(1u, page_ranges.size()); 285 CHECK_EQ(1u, page_ranges.size());
292 CHECK_EQ(page_ranges[0].from, page_ranges[0].to); 286 CHECK_EQ(page_ranges[0].from, page_ranges[0].to);
293 int page_number = page_ranges[0].from; 287 int page_number = page_ranges[0].from;
294 client_message_loop_proxy_->PostTask( 288 client_message_loop_proxy_->PostTask(
295 FROM_HERE, 289 FROM_HERE,
296 base::Bind(&Client::MetafileAvailable, 290 base::Bind(&Client::MetafileAvailable,
297 client_.get(), 291 client_.get(),
298 metafile_path_.InsertBeforeExtensionASCII( 292 metafile_path_.InsertBeforeExtensionASCII(
299 base::StringPrintf(".%d", page_number)), 293 base::StringPrintf(".%d", page_number)),
300 page_number, 294 page_number,
301 scale_factor)); 295 scale_factor));
302 } 296 }
303 297
304 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileFailed() { 298 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileFailed() {
305 DCHECK(waiting_for_reply_); 299 DCHECK(waiting_for_reply_);
306 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 300 ReportUmaEvent(SERVICE_UTILITY_METAFILE_FAILED);
307 SERVICE_UTILITY_METAFILE_FAILED,
308 SERVICE_UTILITY_EVENT_MAX);
309 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityMetafileFailTime", 301 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityMetafileFailTime",
310 base::Time::Now() - start_time_); 302 base::Time::Now() - start_time_);
311 waiting_for_reply_ = false; 303 waiting_for_reply_ = false;
312 client_message_loop_proxy_->PostTask( 304 client_message_loop_proxy_->PostTask(
313 FROM_HERE, 305 FROM_HERE,
314 base::Bind(&Client::OnRenderPDFPagesToMetafileFailed, client_.get())); 306 base::Bind(&Client::OnRenderPDFPagesToMetafileFailed, client_.get()));
315 } 307 }
316 #endif // defined(OS_WIN) 308 #endif // defined(OS_WIN)
317 309
318 void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsSucceeded( 310 void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsSucceeded(
319 const std::string& printer_name, 311 const std::string& printer_name,
320 const printing::PrinterCapsAndDefaults& caps_and_defaults) { 312 const printing::PrinterCapsAndDefaults& caps_and_defaults) {
321 DCHECK(waiting_for_reply_); 313 DCHECK(waiting_for_reply_);
322 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 314 ReportUmaEvent(SERVICE_UTILITY_CAPS_SUCCEEDED);
323 SERVICE_UTILITY_CAPS_SUCCEEDED,
324 SERVICE_UTILITY_EVENT_MAX);
325 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityCapsTime", 315 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityCapsTime",
326 base::Time::Now() - start_time_); 316 base::Time::Now() - start_time_);
327 waiting_for_reply_ = false; 317 waiting_for_reply_ = false;
328 client_message_loop_proxy_->PostTask( 318 client_message_loop_proxy_->PostTask(
329 FROM_HERE, 319 FROM_HERE,
330 base::Bind(&Client::OnGetPrinterCapsAndDefaults, client_.get(), true, 320 base::Bind(&Client::OnGetPrinterCapsAndDefaults, client_.get(), true,
331 printer_name, caps_and_defaults)); 321 printer_name, caps_and_defaults));
332 } 322 }
333 323
334 void ServiceUtilityProcessHost::OnGetPrinterSemanticCapsAndDefaultsSucceeded( 324 void ServiceUtilityProcessHost::OnGetPrinterSemanticCapsAndDefaultsSucceeded(
335 const std::string& printer_name, 325 const std::string& printer_name,
336 const printing::PrinterSemanticCapsAndDefaults& caps_and_defaults) { 326 const printing::PrinterSemanticCapsAndDefaults& caps_and_defaults) {
337 DCHECK(waiting_for_reply_); 327 DCHECK(waiting_for_reply_);
338 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 328 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED);
339 SERVICE_UTILITY_SEMANTIC_CAPS_SUCCEEDED,
340 SERVICE_UTILITY_EVENT_MAX);
341 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsTime", 329 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsTime",
342 base::Time::Now() - start_time_); 330 base::Time::Now() - start_time_);
343 waiting_for_reply_ = false; 331 waiting_for_reply_ = false;
344 client_message_loop_proxy_->PostTask( 332 client_message_loop_proxy_->PostTask(
345 FROM_HERE, 333 FROM_HERE,
346 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, client_.get(), 334 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, client_.get(),
347 true, printer_name, caps_and_defaults)); 335 true, printer_name, caps_and_defaults));
348 } 336 }
349 337
350 void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsFailed( 338 void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsFailed(
351 const std::string& printer_name) { 339 const std::string& printer_name) {
352 DCHECK(waiting_for_reply_); 340 DCHECK(waiting_for_reply_);
353 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 341 ReportUmaEvent(SERVICE_UTILITY_CAPS_FAILED);
354 SERVICE_UTILITY_CAPS_FAILED,
355 SERVICE_UTILITY_EVENT_MAX);
356 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityCapsFailTime", 342 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilityCapsFailTime",
357 base::Time::Now() - start_time_); 343 base::Time::Now() - start_time_);
358 waiting_for_reply_ = false; 344 waiting_for_reply_ = false;
359 client_message_loop_proxy_->PostTask( 345 client_message_loop_proxy_->PostTask(
360 FROM_HERE, 346 FROM_HERE,
361 base::Bind(&Client::OnGetPrinterCapsAndDefaults, client_.get(), false, 347 base::Bind(&Client::OnGetPrinterCapsAndDefaults, client_.get(), false,
362 printer_name, printing::PrinterCapsAndDefaults())); 348 printer_name, printing::PrinterCapsAndDefaults()));
363 } 349 }
364 350
365 void ServiceUtilityProcessHost::OnGetPrinterSemanticCapsAndDefaultsFailed( 351 void ServiceUtilityProcessHost::OnGetPrinterSemanticCapsAndDefaultsFailed(
366 const std::string& printer_name) { 352 const std::string& printer_name) {
367 DCHECK(waiting_for_reply_); 353 DCHECK(waiting_for_reply_);
368 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceUtilityProcessHostEvent", 354 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_FAILED);
369 SERVICE_UTILITY_SEMANTIC_CAPS_FAILED,
370 SERVICE_UTILITY_EVENT_MAX);
371 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsFailTime", 355 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsFailTime",
372 base::Time::Now() - start_time_); 356 base::Time::Now() - start_time_);
373 waiting_for_reply_ = false; 357 waiting_for_reply_ = false;
374 client_message_loop_proxy_->PostTask( 358 client_message_loop_proxy_->PostTask(
375 FROM_HERE, 359 FROM_HERE,
376 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, 360 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults,
377 client_.get(), false, printer_name, 361 client_.get(), false, printer_name,
378 printing::PrinterSemanticCapsAndDefaults())); 362 printing::PrinterSemanticCapsAndDefaults()));
379 } 363 }
380 364
(...skipping 14 matching lines...) Expand all
395 if (!metafile.InitFromFile(metafile_path)) { 379 if (!metafile.InitFromFile(metafile_path)) {
396 OnRenderPDFPagesToMetafileFailed(); 380 OnRenderPDFPagesToMetafileFailed();
397 } else { 381 } else {
398 OnRenderPDFPagesToMetafileSucceeded(metafile, 382 OnRenderPDFPagesToMetafileSucceeded(metafile,
399 highest_rendered_page_number, 383 highest_rendered_page_number,
400 scale_factor); 384 scale_factor);
401 } 385 }
402 #endif // defined(OS_WIN) 386 #endif // defined(OS_WIN)
403 } 387 }
404 388
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