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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for most 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());
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 3530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4142 FPDF_DOCUMENT doc = 4142 FPDF_DOCUMENT doc =
4143 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 4143 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
4144 if (!doc) 4144 if (!doc)
4145 return false; 4145 return false;
4146 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4146 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4147 FPDF_CloseDocument(doc); 4147 FPDF_CloseDocument(doc);
4148 return success; 4148 return success;
4149 } 4149 }
4150 4150
4151 } // namespace chrome_pdf 4151 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698