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

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

Issue 641923002: Change PDF scaling factor from double to float. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 2 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 | « chrome/service/service_utility_process_host.h ('k') | chrome/utility/printing_handler.h » ('j') | 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 <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 if (!pdf_to_emf_state_ || page_count <= 0 || 310 if (!pdf_to_emf_state_ || page_count <= 0 ||
311 pdf_to_emf_state_->has_page_count()) { 311 pdf_to_emf_state_->has_page_count()) {
312 return OnPDFToEmfFinished(false); 312 return OnPDFToEmfFinished(false);
313 } 313 }
314 pdf_to_emf_state_->set_page_count(page_count); 314 pdf_to_emf_state_->set_page_count(page_count);
315 pdf_to_emf_state_->GetMorePages(); 315 pdf_to_emf_state_->GetMorePages();
316 } 316 }
317 317
318 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone( 318 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone(
319 bool success, 319 bool success,
320 double scale_factor) { 320 float scale_factor) {
321 DCHECK(waiting_for_reply_); 321 DCHECK(waiting_for_reply_);
322 if (!pdf_to_emf_state_ || !success) 322 if (!pdf_to_emf_state_ || !success)
323 return OnPDFToEmfFinished(false); 323 return OnPDFToEmfFinished(false);
324 base::File emf_file = pdf_to_emf_state_->TakeNextFile(); 324 base::File emf_file = pdf_to_emf_state_->TakeNextFile();
325 base::PostTaskAndReplyWithResult( 325 base::PostTaskAndReplyWithResult(
326 client_message_loop_proxy_, 326 client_message_loop_proxy_,
327 FROM_HERE, 327 FROM_HERE,
328 base::Bind(&Client::MetafileAvailable, 328 base::Bind(&Client::MetafileAvailable,
329 client_.get(), 329 client_.get(),
330 scale_factor, 330 scale_factor,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsFailTime", 401 UMA_HISTOGRAM_TIMES("CloudPrint.ServiceUtilitySemanticCapsFailTime",
402 base::Time::Now() - start_time_); 402 base::Time::Now() - start_time_);
403 waiting_for_reply_ = false; 403 waiting_for_reply_ = false;
404 client_message_loop_proxy_->PostTask( 404 client_message_loop_proxy_->PostTask(
405 FROM_HERE, 405 FROM_HERE,
406 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, 406 base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults,
407 client_.get(), false, printer_name, 407 client_.get(), false, printer_name,
408 printing::PrinterSemanticCapsAndDefaults())); 408 printing::PrinterSemanticCapsAndDefaults()));
409 } 409 }
410 410
411 bool ServiceUtilityProcessHost::Client::MetafileAvailable(double scale_factor, 411 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor,
412 base::File file) { 412 base::File file) {
413 file.Seek(base::File::FROM_BEGIN, 0); 413 file.Seek(base::File::FROM_BEGIN, 0);
414 int64 size = file.GetLength(); 414 int64 size = file.GetLength();
415 if (size <= 0) { 415 if (size <= 0) {
416 OnRenderPDFPagesToMetafileDone(false); 416 OnRenderPDFPagesToMetafileDone(false);
417 return false; 417 return false;
418 } 418 }
419 std::vector<char> data(size); 419 std::vector<char> data(size);
420 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { 420 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) {
421 OnRenderPDFPagesToMetafileDone(false); 421 OnRenderPDFPagesToMetafileDone(false);
422 return false; 422 return false;
423 } 423 }
424 printing::Emf emf; 424 printing::Emf emf;
425 if (!emf.InitFromData(data.data(), data.size())) { 425 if (!emf.InitFromData(data.data(), data.size())) {
426 OnRenderPDFPagesToMetafileDone(false); 426 OnRenderPDFPagesToMetafileDone(false);
427 return false; 427 return false;
428 } 428 }
429 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); 429 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
430 return true; 430 return true;
431 } 431 }
OLDNEW
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | chrome/utility/printing_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698