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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Fix some behaviors Created 3 years, 7 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 FPDF_GetMetaText(doc, key.c_str(), string_adapter.GetData(), size)); 587 FPDF_GetMetaText(doc, key.c_str(), string_adapter.GetData(), size));
588 return base::UTF16ToUTF8(value); 588 return base::UTF16ToUTF8(value);
589 } 589 }
590 590
591 gin::IsolateHolder* g_isolate_holder = nullptr; 591 gin::IsolateHolder* g_isolate_holder = nullptr;
592 592
593 void SetUpV8() { 593 void SetUpV8() {
594 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, 594 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
595 gin::IsolateHolder::kStableV8Extras, 595 gin::IsolateHolder::kStableV8Extras,
596 gin::ArrayBufferAllocator::SharedInstance()); 596 gin::ArrayBufferAllocator::SharedInstance());
597 g_isolate_holder = new gin::IsolateHolder(base::ThreadTaskRunnerHandle::Get(), 597 g_isolate_holder =
598 gin::IsolateHolder::kSingleThread); 598 new gin::IsolateHolder(base::ThreadTaskRunnerHandle::Get());
599 g_isolate_holder->isolate()->Enter(); 599 g_isolate_holder->isolate()->Enter();
600 } 600 }
601 601
602 void TearDownV8() { 602 void TearDownV8() {
603 g_isolate_holder->isolate()->Exit(); 603 g_isolate_holder->isolate()->Exit();
604 delete g_isolate_holder; 604 delete g_isolate_holder;
605 g_isolate_holder = nullptr; 605 g_isolate_holder = nullptr;
606 } 606 }
607 607
608 int GetBlockForJpeg(void* param, 608 int GetBlockForJpeg(void* param,
(...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 FPDF_DOCUMENT doc = 4119 FPDF_DOCUMENT doc =
4120 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 4120 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
4121 if (!doc) 4121 if (!doc)
4122 return false; 4122 return false;
4123 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4123 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4124 FPDF_CloseDocument(doc); 4124 FPDF_CloseDocument(doc);
4125 return success; 4125 return success;
4126 } 4126 }
4127 4127
4128 } // namespace chrome_pdf 4128 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698