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

Unified Diff: pdf/pdf.cc

Issue 1346143003: Don't initialize V8 via Blink in ppapi plugins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pdf/OWNERS ('k') | pdf/pdf.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdf.cc
diff --git a/pdf/pdf.cc b/pdf/pdf.cc
index 655a13359eefb7420310213430ceed8ab4713730..1f580e4f1532a7d543314d2e3f1f87f0d1851f30 100644
--- a/pdf/pdf.cc
+++ b/pdf/pdf.cc
@@ -10,21 +10,36 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "gin/array_buffer.h"
+#include "gin/public/isolate_holder.h"
#include "pdf/out_of_process_instance.h"
#include "ppapi/c/ppp.h"
#include "ppapi/cpp/private/internal_module.h"
#include "ppapi/cpp/private/pdf.h"
#include "v8/include/v8.h"
+namespace chrome_pdf {
+
+namespace {
+
bool g_sdk_initialized_via_pepper = false;
-namespace chrome_pdf {
+gin::IsolateHolder* g_isolate_holder = nullptr;
+
+void TearDownV8() {
+ g_isolate_holder->isolate()->Exit();
+ delete g_isolate_holder;
+ g_isolate_holder = nullptr;
+}
+
+} // namespace
PDFModule::PDFModule() {
}
PDFModule::~PDFModule() {
if (g_sdk_initialized_via_pepper) {
+ TearDownV8();
chrome_pdf::ShutdownSDK();
g_sdk_initialized_via_pepper = false;
}
@@ -45,8 +60,15 @@ pp::Instance* PDFModule::CreateInstance(PP_Instance instance) {
v8::V8::SetNativesDataBlob(&natives);
v8::V8::SetSnapshotDataBlob(&snapshot);
}
- if (!chrome_pdf::InitializeSDK())
+ gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
+ gin::ArrayBufferAllocator::SharedInstance());
+ g_isolate_holder =
+ new gin::IsolateHolder(gin::IsolateHolder::kSingleThread);
+ g_isolate_holder->isolate()->Enter();
+ if (!chrome_pdf::InitializeSDK()) {
+ TearDownV8();
return NULL;
+ }
g_sdk_initialized_via_pepper = true;
}
« no previous file with comments | « pdf/OWNERS ('k') | pdf/pdf.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698