OLD | NEW |
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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } | 652 } |
653 | 653 |
654 void ShutdownSDK() { | 654 void ShutdownSDK() { |
655 FPDF_DestroyLibrary(); | 655 FPDF_DestroyLibrary(); |
656 #if !defined(OS_LINUX) | 656 #if !defined(OS_LINUX) |
657 delete g_font_info; | 657 delete g_font_info; |
658 #endif | 658 #endif |
659 TearDownV8(); | 659 TearDownV8(); |
660 } | 660 } |
661 | 661 |
662 PDFEngine* PDFEngine::Create(PDFEngine::Client* client) { | 662 std::unique_ptr<PDFEngine> PDFEngine::Create(PDFEngine::Client* client) { |
663 return new PDFiumEngine(client); | 663 return base::MakeUnique<PDFiumEngine>(client); |
664 } | 664 } |
665 | 665 |
666 PDFiumEngine::PDFiumEngine(PDFEngine::Client* client) | 666 PDFiumEngine::PDFiumEngine(PDFEngine::Client* client) |
667 : client_(client), | 667 : client_(client), |
668 current_zoom_(1.0), | 668 current_zoom_(1.0), |
669 current_rotation_(0), | 669 current_rotation_(0), |
670 doc_loader_(this), | 670 doc_loader_(this), |
671 password_tries_remaining_(0), | 671 password_tries_remaining_(0), |
672 doc_(nullptr), | 672 doc_(nullptr), |
673 form_(nullptr), | 673 form_(nullptr), |
(...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 FPDF_DOCUMENT doc = | 4119 FPDF_DOCUMENT doc = |
4120 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4120 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
4121 if (!doc) | 4121 if (!doc) |
4122 return false; | 4122 return false; |
4123 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4123 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4124 FPDF_CloseDocument(doc); | 4124 FPDF_CloseDocument(doc); |
4125 return success; | 4125 return success; |
4126 } | 4126 } |
4127 | 4127 |
4128 } // namespace chrome_pdf | 4128 } // namespace chrome_pdf |
OLD | NEW |