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

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 721783003: Remove implicit conversions from scoped_refptr to T* in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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/cloud_print/print_system.h" 5 #include "chrome/service/cloud_print/print_system.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 virtual void OnChildDied() override { PrintJobDone(false); } 354 virtual void OnChildDied() override { PrintJobDone(false); }
355 355
356 // base::win::ObjectWatcher::Delegate implementation. 356 // base::win::ObjectWatcher::Delegate implementation.
357 virtual void OnObjectSignaled(HANDLE object) override { 357 virtual void OnObjectSignaled(HANDLE object) override {
358 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is 358 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is
359 // fixed. 359 // fixed.
360 tracked_objects::ScopedTracker tracking_profile( 360 tracked_objects::ScopedTracker tracking_profile(
361 FROM_HERE_WITH_EXPLICIT_FUNCTION("Core_OnObjectSignaled")); 361 FROM_HERE_WITH_EXPLICIT_FUNCTION("Core_OnObjectSignaled"));
362 362
363 DCHECK(xps_print_job_); 363 DCHECK(xps_print_job_.get());
364 DCHECK(object == job_progress_event_.Get()); 364 DCHECK(object == job_progress_event_.Get());
365 ResetEvent(job_progress_event_.Get()); 365 ResetEvent(job_progress_event_.Get());
366 if (!delegate_) 366 if (!delegate_)
367 return; 367 return;
368 XPS_JOB_STATUS job_status = {0}; 368 XPS_JOB_STATUS job_status = {0};
369 xps_print_job_->GetJobStatus(&job_status); 369 xps_print_job_->GetJobStatus(&job_status);
370 if ((job_status.completion == XPS_JOB_CANCELLED) || 370 if ((job_status.completion == XPS_JOB_CANCELLED) ||
371 (job_status.completion == XPS_JOB_FAILED)) { 371 (job_status.completion == XPS_JOB_FAILED)) {
372 delegate_->OnJobSpoolFailed(); 372 delegate_->OnJobSpoolFailed();
373 } else if (job_status.jobId || 373 } else if (job_status.jobId ||
(...skipping 10 matching lines...) Expand all
384 384
385 private: 385 private:
386 // Helper class to allow PrintXPSDocument() to have multiple exits. 386 // Helper class to allow PrintXPSDocument() to have multiple exits.
387 class PrintJobCanceler { 387 class PrintJobCanceler {
388 public: 388 public:
389 explicit PrintJobCanceler( 389 explicit PrintJobCanceler(
390 base::win::ScopedComPtr<IXpsPrintJob>* job_ptr) 390 base::win::ScopedComPtr<IXpsPrintJob>* job_ptr)
391 : job_ptr_(job_ptr) { 391 : job_ptr_(job_ptr) {
392 } 392 }
393 ~PrintJobCanceler() { 393 ~PrintJobCanceler() {
394 if (job_ptr_ && *job_ptr_) { 394 if (job_ptr_ && job_ptr_->get()) {
dcheng 2014/11/12 23:01:32 This seems pretty sketchy. I have a TODO to come b
395 (*job_ptr_)->Cancel(); 395 (*job_ptr_)->Cancel();
396 job_ptr_->Release(); 396 job_ptr_->Release();
397 } 397 }
398 } 398 }
399 399
400 void reset() { job_ptr_ = NULL; } 400 void reset() { job_ptr_ = NULL; }
401 401
402 private: 402 private:
403 base::win::ScopedComPtr<IXpsPrintJob>* job_ptr_; 403 base::win::ScopedComPtr<IXpsPrintJob>* job_ptr_;
404 404
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 // Called on the service process IO thread. 437 // Called on the service process IO thread.
438 void RenderPDFPagesInSandbox(const base::FilePath& pdf_path, 438 void RenderPDFPagesInSandbox(const base::FilePath& pdf_path,
439 const gfx::Rect& render_area, 439 const gfx::Rect& render_area,
440 int render_dpi, 440 int render_dpi,
441 const scoped_refptr<base::MessageLoopProxy>& 441 const scoped_refptr<base::MessageLoopProxy>&
442 client_message_loop_proxy) { 442 client_message_loop_proxy) {
443 DCHECK(g_service_process->io_thread()->message_loop_proxy()-> 443 DCHECK(g_service_process->io_thread()->message_loop_proxy()->
444 BelongsToCurrentThread()); 444 BelongsToCurrentThread());
445 scoped_ptr<ServiceUtilityProcessHost> utility_host( 445 scoped_ptr<ServiceUtilityProcessHost> utility_host(
446 new ServiceUtilityProcessHost(this, client_message_loop_proxy)); 446 new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
447 // TODO(gene): For now we disabling autorotation for CloudPrinting. 447 // TODO(gene): For now we disabling autorotation for CloudPrinting.
448 // Landscape/Portrait setting is passed in the print ticket and 448 // Landscape/Portrait setting is passed in the print ticket and
449 // server is generating portrait PDF always. 449 // server is generating portrait PDF always.
450 // We should enable autorotation once server will be able to generate 450 // We should enable autorotation once server will be able to generate
451 // PDF that matches paper size and orientation. 451 // PDF that matches paper size and orientation.
452 if (utility_host->StartRenderPDFPagesToMetafile( 452 if (utility_host->StartRenderPDFPagesToMetafile(
453 pdf_path, 453 pdf_path,
454 printing::PdfRenderSettings(render_area, render_dpi, false))) { 454 printing::PdfRenderSettings(render_area, render_dpi, false))) {
455 // The object will self-destruct when the child process dies. 455 // The object will self-destruct when the child process dies.
456 utility_host.release(); 456 utility_host.release();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 this, base::MessageLoopProxy::current())); 582 this, base::MessageLoopProxy::current()));
583 } 583 }
584 584
585 private: 585 private:
586 void GetPrinterCapsAndDefaultsImpl( 586 void GetPrinterCapsAndDefaultsImpl(
587 const scoped_refptr<base::MessageLoopProxy>& 587 const scoped_refptr<base::MessageLoopProxy>&
588 client_message_loop_proxy) { 588 client_message_loop_proxy) {
589 DCHECK(g_service_process->io_thread()->message_loop_proxy()-> 589 DCHECK(g_service_process->io_thread()->message_loop_proxy()->
590 BelongsToCurrentThread()); 590 BelongsToCurrentThread());
591 scoped_ptr<ServiceUtilityProcessHost> utility_host( 591 scoped_ptr<ServiceUtilityProcessHost> utility_host(
592 new ServiceUtilityProcessHost(this, client_message_loop_proxy)); 592 new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
593 if (utility_host->StartGetPrinterCapsAndDefaults(printer_name_)) { 593 if (utility_host->StartGetPrinterCapsAndDefaults(printer_name_)) {
594 // The object will self-destruct when the child process dies. 594 // The object will self-destruct when the child process dies.
595 utility_host.release(); 595 utility_host.release();
596 } else { 596 } else {
597 client_message_loop_proxy->PostTask( 597 client_message_loop_proxy->PostTask(
598 FROM_HERE, 598 FROM_HERE,
599 base::Bind(&PrinterCapsHandler::OnChildDied, this)); 599 base::Bind(&PrinterCapsHandler::OnChildDied, this));
600 } 600 }
601 } 601 }
602 602
603 void GetPrinterSemanticCapsAndDefaultsImpl( 603 void GetPrinterSemanticCapsAndDefaultsImpl(
604 const scoped_refptr<base::MessageLoopProxy>& 604 const scoped_refptr<base::MessageLoopProxy>&
605 client_message_loop_proxy) { 605 client_message_loop_proxy) {
606 DCHECK(g_service_process->io_thread()->message_loop_proxy()-> 606 DCHECK(g_service_process->io_thread()->message_loop_proxy()->
607 BelongsToCurrentThread()); 607 BelongsToCurrentThread());
608 scoped_ptr<ServiceUtilityProcessHost> utility_host( 608 scoped_ptr<ServiceUtilityProcessHost> utility_host(
609 new ServiceUtilityProcessHost(this, client_message_loop_proxy)); 609 new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
610 if (utility_host->StartGetPrinterSemanticCapsAndDefaults(printer_name_)) { 610 if (utility_host->StartGetPrinterSemanticCapsAndDefaults(printer_name_)) {
611 // The object will self-destruct when the child process dies. 611 // The object will self-destruct when the child process dies.
612 utility_host.release(); 612 utility_host.release();
613 } else { 613 } else {
614 client_message_loop_proxy->PostTask( 614 client_message_loop_proxy->PostTask(
615 FROM_HERE, 615 FROM_HERE,
616 base::Bind(&PrinterCapsHandler::OnChildDied, this)); 616 base::Bind(&PrinterCapsHandler::OnChildDied, this));
617 } 617 }
618 } 618 }
619 619
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 830 }
831 831
832 } // namespace 832 } // namespace
833 833
834 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 834 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
835 const base::DictionaryValue* print_system_settings) { 835 const base::DictionaryValue* print_system_settings) {
836 return new PrintSystemWin; 836 return new PrintSystemWin;
837 } 837 }
838 838
839 } // namespace cloud_print 839 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698