| Index: chrome/browser/ui/webui/print_preview_handler.cc
|
| ===================================================================
|
| --- chrome/browser/ui/webui/print_preview_handler.cc (revision 113100)
|
| +++ chrome/browser/ui/webui/print_preview_handler.cc (working copy)
|
| @@ -57,6 +57,7 @@
|
| #endif
|
|
|
| using content::BrowserThread;
|
| +using printing::Metafile;
|
|
|
| namespace {
|
|
|
| @@ -173,13 +174,16 @@
|
| }
|
| }
|
|
|
| -} // namespace
|
| -
|
| // Callback that stores a PDF file on disk.
|
| -void PrintToPdfCallback(printing::Metafile* metafile, const FilePath& path) {
|
| +void PrintToPdfCallback(Metafile* metafile, const FilePath& path) {
|
| metafile->SaveTo(path);
|
| + // |metafile| must be deleted on the UI thread.
|
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&DeletePointer<Metafile>, metafile));
|
| }
|
|
|
| +} // namespace
|
| +
|
| // static
|
| FilePath* PrintPreviewHandler::last_saved_path_ = NULL;
|
| std::string* PrintPreviewHandler::last_used_printer_cloud_print_data_ = NULL;
|
| @@ -814,8 +818,9 @@
|
| DCHECK(data.get());
|
| printing::PreviewMetafile* metafile = new printing::PreviewMetafile;
|
| metafile->InitFromData(static_cast<const void*>(data->front()), data->size());
|
| + // PrintToPdfCallback takes ownership of |metafile|.
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&PrintToPdfCallback, base::Owned(metafile),
|
| + base::Bind(&PrintToPdfCallback, metafile,
|
| *print_to_pdf_path_));
|
| print_to_pdf_path_.reset();
|
| ActivateInitiatorTabAndClosePreviewTab();
|
|
|