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 | 8 |
9 #include "base/i18n/icu_encoding_detection.h" | 9 #include "base/i18n/icu_encoding_detection.h" |
10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 &value, size, false); | 448 &value, size, false); |
449 string_adapter.Close( | 449 string_adapter.Close( |
450 FPDF_GetMetaText(doc, key.c_str(), string_adapter.GetData(), size)); | 450 FPDF_GetMetaText(doc, key.c_str(), string_adapter.GetData(), size)); |
451 return base::UTF16ToUTF8(value); | 451 return base::UTF16ToUTF8(value); |
452 } | 452 } |
453 | 453 |
454 gin::IsolateHolder* g_isolate_holder = nullptr; | 454 gin::IsolateHolder* g_isolate_holder = nullptr; |
455 | 455 |
456 void SetUpV8() { | 456 void SetUpV8() { |
457 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, | 457 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, |
| 458 gin::IsolateHolder::kStableV8Extras, |
458 gin::ArrayBufferAllocator::SharedInstance()); | 459 gin::ArrayBufferAllocator::SharedInstance()); |
459 g_isolate_holder = | 460 g_isolate_holder = |
460 new gin::IsolateHolder(gin::IsolateHolder::kSingleThread); | 461 new gin::IsolateHolder(gin::IsolateHolder::kSingleThread); |
461 g_isolate_holder->isolate()->Enter(); | 462 g_isolate_holder->isolate()->Enter(); |
462 } | 463 } |
463 | 464 |
464 void TearDownV8() { | 465 void TearDownV8() { |
465 g_isolate_holder->isolate()->Exit(); | 466 g_isolate_holder->isolate()->Exit(); |
466 delete g_isolate_holder; | 467 delete g_isolate_holder; |
467 g_isolate_holder = nullptr; | 468 g_isolate_holder = nullptr; |
(...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 double* height) { | 3995 double* height) { |
3995 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3996 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
3996 if (!doc) | 3997 if (!doc) |
3997 return false; | 3998 return false; |
3998 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3999 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
3999 FPDF_CloseDocument(doc); | 4000 FPDF_CloseDocument(doc); |
4000 return success; | 4001 return success; |
4001 } | 4002 } |
4002 | 4003 |
4003 } // namespace chrome_pdf | 4004 } // namespace chrome_pdf |
OLD | NEW |