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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for all comments Created 3 years, 6 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
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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698