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

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 1645073004: PDF: Fix a crash from r372196 with the print preview PDFEngine client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | pdf/preview_mode_client.cc » ('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 "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 IPDF_JSPLATFORM::Doc_print = Form_Print; 601 IPDF_JSPLATFORM::Doc_print = Form_Print;
602 IPDF_JSPLATFORM::Doc_submitForm = Form_SubmitForm; 602 IPDF_JSPLATFORM::Doc_submitForm = Form_SubmitForm;
603 IPDF_JSPLATFORM::Doc_gotoPage = Form_GotoPage; 603 IPDF_JSPLATFORM::Doc_gotoPage = Form_GotoPage;
604 IPDF_JSPLATFORM::Field_browse = Form_Browse; 604 IPDF_JSPLATFORM::Field_browse = Form_Browse;
605 605
606 IFSDK_PAUSE::version = 1; 606 IFSDK_PAUSE::version = 1;
607 IFSDK_PAUSE::user = NULL; 607 IFSDK_PAUSE::user = NULL;
608 IFSDK_PAUSE::NeedToPauseNow = Pause_NeedToPauseNow; 608 IFSDK_PAUSE::NeedToPauseNow = Pause_NeedToPauseNow;
609 609
610 #if defined(OS_LINUX) 610 #if defined(OS_LINUX)
611 g_last_instance_id = client_->GetPluginInstance()->pp_instance(); 611 // PreviewModeClient does not know its pp::Instance.
612 pp::Instance* instance = client_->GetPluginInstance();
613 if (instance)
614 g_last_instance_id = instance->pp_instance();
612 #endif 615 #endif
613 } 616 }
614 617
615 PDFiumEngine::~PDFiumEngine() { 618 PDFiumEngine::~PDFiumEngine() {
616 for (auto& page : pages_) 619 for (auto& page : pages_)
617 page->Unload(); 620 page->Unload();
618 621
619 if (doc_) { 622 if (doc_) {
620 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC); 623 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC);
621 624
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3948 double* height) { 3951 double* height) {
3949 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); 3952 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL);
3950 if (!doc) 3953 if (!doc)
3951 return false; 3954 return false;
3952 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 3955 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
3953 FPDF_CloseDocument(doc); 3956 FPDF_CloseDocument(doc);
3954 return success; 3957 return success;
3955 } 3958 }
3956 3959
3957 } // namespace chrome_pdf 3960 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | pdf/preview_mode_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698