Chromium Code Reviews| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 return base::UTF16ToUTF8(value); | 590 return base::UTF16ToUTF8(value); |
| 591 } | 591 } |
| 592 | 592 |
| 593 gin::IsolateHolder* g_isolate_holder = nullptr; | 593 gin::IsolateHolder* g_isolate_holder = nullptr; |
| 594 | 594 |
| 595 void SetUpV8() { | 595 void SetUpV8() { |
| 596 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, | 596 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, |
| 597 gin::IsolateHolder::kStableV8Extras, | 597 gin::IsolateHolder::kStableV8Extras, |
| 598 gin::ArrayBufferAllocator::SharedInstance()); | 598 gin::ArrayBufferAllocator::SharedInstance()); |
| 599 DCHECK(!g_isolate_holder); | 599 DCHECK(!g_isolate_holder); |
| 600 g_isolate_holder = new gin::IsolateHolder(base::ThreadTaskRunnerHandle::Get(), | 600 g_isolate_holder = |
| 601 gin::IsolateHolder::kSingleThread); | 601 new gin::IsolateHolder(base::ThreadTaskRunnerHandle::Get()); |
|
Yuki
2017/06/20 14:20:10
Is this a good change? It seems better to explici
peria
2017/06/21 07:19:15
Done.
| |
| 602 g_isolate_holder->isolate()->Enter(); | 602 g_isolate_holder->isolate()->Enter(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void TearDownV8() { | 605 void TearDownV8() { |
| 606 g_isolate_holder->isolate()->Exit(); | 606 g_isolate_holder->isolate()->Exit(); |
| 607 delete g_isolate_holder; | 607 delete g_isolate_holder; |
| 608 g_isolate_holder = nullptr; | 608 g_isolate_holder = nullptr; |
| 609 } | 609 } |
| 610 | 610 |
| 611 int GetBlockForJpeg(void* param, | 611 int GetBlockForJpeg(void* param, |
| (...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4138 FPDF_DOCUMENT doc = | 4138 FPDF_DOCUMENT doc = |
| 4139 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4139 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 4140 if (!doc) | 4140 if (!doc) |
| 4141 return false; | 4141 return false; |
| 4142 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4142 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4143 FPDF_CloseDocument(doc); | 4143 FPDF_CloseDocument(doc); |
| 4144 return success; | 4144 return success; |
| 4145 } | 4145 } |
| 4146 | 4146 |
| 4147 } // namespace chrome_pdf | 4147 } // namespace chrome_pdf |
| OLD | NEW |