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

Side by Side Diff: chrome/browser/printing/print_job.cc

Issue 329683002: Improvements in --debug-print switch implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wed 06/11/2014 14:29:57.35 Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/printing/print_job_worker.cc » ('j') | printing/printed_document.h » ('J')
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/browser/printing/print_job.h" 5 #include "chrome/browser/printing/print_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/printing/print_job_worker.h" 14 #include "chrome/browser/printing/print_job_worker.h"
15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
16 #include "printing/printed_document.h" 17 #include "printing/printed_document.h"
17 #include "printing/printed_page.h" 18 #include "printing/printed_page.h"
18 19
19 using base::TimeDelta; 20 using base::TimeDelta;
20 21
21 namespace { 22 namespace {
22 23
23 // Helper function to ensure |owner| is valid until at least |callback| returns. 24 // Helper function to ensure |owner| is valid until at least |callback| returns.
24 void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner, 25 void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int page_count) { 62 int page_count) {
62 DCHECK(!source_); 63 DCHECK(!source_);
63 DCHECK(!worker_.get()); 64 DCHECK(!worker_.get());
64 DCHECK(!is_job_pending_); 65 DCHECK(!is_job_pending_);
65 DCHECK(!is_canceling_); 66 DCHECK(!is_canceling_);
66 DCHECK(!document_.get()); 67 DCHECK(!document_.get());
67 source_ = source; 68 source_ = source;
68 worker_.reset(job->DetachWorker(this)); 69 worker_.reset(job->DetachWorker(this));
69 settings_ = job->settings(); 70 settings_ = job->settings();
70 71
71 PrintedDocument* new_doc = 72 using content::BrowserThread;
72 new PrintedDocument(settings_, source_, job->cookie()); 73 PrintedDocument* new_doc = new PrintedDocument(
74 settings_,
75 source_,
76 job->cookie(),
77 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
Lei Zhang 2014/06/11 21:43:42 Can you use BrowserThread::GetBlockingPool() inste
Vitaly Buka (NO REVIEWS) 2014/06/11 22:22:58 Done.
73 new_doc->set_page_count(page_count); 78 new_doc->set_page_count(page_count);
74 UpdatePrintedDocument(new_doc); 79 UpdatePrintedDocument(new_doc);
75 80
76 // Don't forget to register to our own messages. 81 // Don't forget to register to our own messages.
77 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, 82 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
78 content::Source<PrintJob>(this)); 83 content::Source<PrintJob>(this));
79 } 84 }
80 85
81 void PrintJob::Observe(int type, 86 void PrintJob::Observe(int type,
82 const content::NotificationSource& source, 87 const content::NotificationSource& source,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 359 }
355 360
356 JobEventDetails::~JobEventDetails() { 361 JobEventDetails::~JobEventDetails() {
357 } 362 }
358 363
359 PrintedDocument* JobEventDetails::document() const { return document_.get(); } 364 PrintedDocument* JobEventDetails::document() const { return document_.get(); }
360 365
361 PrintedPage* JobEventDetails::page() const { return page_.get(); } 366 PrintedPage* JobEventDetails::page() const { return page_.get(); }
362 367
363 } // namespace printing 368 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_job_worker.cc » ('j') | printing/printed_document.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698