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

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

Issue 3475021: Printing: Push checking of |context| one level lower, as the different (Closed)
Patch Set: Created 10 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 | printing/printed_document_cairo.cc » ('j') | printing/printed_document_cairo.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_worker.h" 5 #include "chrome/browser/printing/print_job_worker.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/printing/print_job.h" 9 #include "chrome/browser/printing/print_job.h"
10 #include "chrome/common/notification_service.h" 10 #include "chrome/common/notification_service.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 NULL); 256 NULL);
257 owner_->message_loop()->PostTask(FROM_HERE, task); 257 owner_->message_loop()->PostTask(FROM_HERE, task);
258 258
259 // Makes sure the variables are reinitialized. 259 // Makes sure the variables are reinitialized.
260 document_ = NULL; 260 document_ = NULL;
261 } 261 }
262 262
263 void PrintJobWorker::SpoolPage(PrintedPage& page) { 263 void PrintJobWorker::SpoolPage(PrintedPage& page) {
264 DCHECK_EQ(message_loop(), MessageLoop::current()); 264 DCHECK_EQ(message_loop(), MessageLoop::current());
265 DCHECK_NE(page_number_, PageNumber::npos()); 265 DCHECK_NE(page_number_, PageNumber::npos());
266 #if !defined(OS_MACOSX) 266
267 DCHECK(printing_context_.context());
268 #endif
269 // Signal everyone that the page is about to be printed. 267 // Signal everyone that the page is about to be printed.
270 NotificationTask* task = new NotificationTask(); 268 NotificationTask* task = new NotificationTask();
271 task->Init(owner_, 269 task->Init(owner_,
272 JobEventDetails::NEW_PAGE, 270 JobEventDetails::NEW_PAGE,
273 document_.get(), 271 document_.get(),
274 &page); 272 &page);
275 owner_->message_loop()->PostTask(FROM_HERE, task); 273 owner_->message_loop()->PostTask(FROM_HERE, task);
276 274
277 // Preprocess. 275 // Preprocess.
278 if (printing_context_.NewPage() != PrintingContext::OK) { 276 if (printing_context_.NewPage() != PrintingContext::OK) {
279 OnFailure(); 277 OnFailure();
280 return; 278 return;
281 } 279 }
282 280
283 #if defined(OS_MACOSX)
284 // Context is only valid between NewPage and PageDone, so we only check here.
285 DCHECK(printing_context_.context());
286 #endif
287 // Actual printing. 281 // Actual printing.
288 document_->RenderPrintedPage(page, printing_context_.context()); 282 document_->RenderPrintedPage(page, printing_context_.context());
289 283
290 // Postprocess. 284 // Postprocess.
291 if (printing_context_.PageDone() != PrintingContext::OK) { 285 if (printing_context_.PageDone() != PrintingContext::OK) {
292 OnFailure(); 286 OnFailure();
293 return; 287 return;
294 } 288 }
295 289
296 // Signal everyone that the page is printed. 290 // Signal everyone that the page is printed.
(...skipping 30 matching lines...) Expand all
327 printing::PrintJobWorker* obj) { 321 printing::PrintJobWorker* obj) {
328 DCHECK(!owner_.get()); 322 DCHECK(!owner_.get());
329 owner_ = obj->owner_; 323 owner_ = obj->owner_;
330 } 324 }
331 325
332 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( 326 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee(
333 printing::PrintJobWorker* obj) { 327 printing::PrintJobWorker* obj) {
334 DCHECK_EQ(owner_, obj->owner_); 328 DCHECK_EQ(owner_, obj->owner_);
335 owner_ = NULL; 329 owner_ = NULL;
336 } 330 }
OLDNEW
« no previous file with comments | « no previous file | printing/printed_document_cairo.cc » ('j') | printing/printed_document_cairo.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698