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 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3685 return path.size() + 1; | 3685 return path.size() + 1; |
3686 } | 3686 } |
3687 | 3687 |
3688 FPDF_BOOL PDFiumEngine::Pause_NeedToPauseNow(IFSDK_PAUSE* param) { | 3688 FPDF_BOOL PDFiumEngine::Pause_NeedToPauseNow(IFSDK_PAUSE* param) { |
3689 PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); | 3689 PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); |
3690 return (base::Time::Now() - engine->last_progressive_start_time_). | 3690 return (base::Time::Now() - engine->last_progressive_start_time_). |
3691 InMilliseconds() > engine->progressive_paint_timeout_; | 3691 InMilliseconds() > engine->progressive_paint_timeout_; |
3692 } | 3692 } |
3693 | 3693 |
3694 ScopedUnsupportedFeature::ScopedUnsupportedFeature(PDFiumEngine* engine) | 3694 ScopedUnsupportedFeature::ScopedUnsupportedFeature(PDFiumEngine* engine) |
3695 : engine_(engine), old_engine_(g_engine_for_unsupported) { | 3695 : old_engine_(g_engine_for_unsupported) { |
3696 g_engine_for_unsupported = engine_; | 3696 g_engine_for_unsupported = engine; |
3697 } | 3697 } |
3698 | 3698 |
3699 ScopedUnsupportedFeature::~ScopedUnsupportedFeature() { | 3699 ScopedUnsupportedFeature::~ScopedUnsupportedFeature() { |
3700 g_engine_for_unsupported = old_engine_; | 3700 g_engine_for_unsupported = old_engine_; |
3701 } | 3701 } |
3702 | 3702 |
3703 namespace { | 3703 namespace { |
3704 | 3704 |
3705 base::LazyInstance<PDFiumEngineExports>::Leaky g_pdf_engine_exports = | 3705 base::LazyInstance<PDFiumEngineExports>::Leaky g_pdf_engine_exports = |
3706 LAZY_INSTANCE_INITIALIZER; | 3706 LAZY_INSTANCE_INITIALIZER; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3918 FPDF_DOCUMENT doc = | 3918 FPDF_DOCUMENT doc = |
3919 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3919 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
3920 if (!doc) | 3920 if (!doc) |
3921 return false; | 3921 return false; |
3922 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3922 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
3923 FPDF_CloseDocument(doc); | 3923 FPDF_CloseDocument(doc); |
3924 return success; | 3924 return success; |
3925 } | 3925 } |
3926 | 3926 |
3927 } // namespace chrome_pdf | 3927 } // namespace chrome_pdf |
OLD | NEW |