Index: fxjse/fxjs_perisolatedata.cpp |
diff --git a/fxjse/fxjs_perisolatedata.cpp b/fxjse/fxjs_perisolatedata.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a2f96b363571e18b0f748cb3c9c645ad36fe475 |
--- /dev/null |
+++ b/fxjse/fxjs_perisolatedata.cpp |
@@ -0,0 +1,31 @@ |
+// Copyright 2016 PDFium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
+ |
+#include "fxjse/include/fxjs_perisolatedata.h" |
+ |
+static unsigned int g_embedderDataSlot = 1u; |
+ |
+// static |
+void FXJS_PerIsolateData::SetEmbedderDataSlot(unsigned int slot) { |
+ g_embedderDataSlot = slot; |
+} |
+ |
+// static |
+unsigned int FXJS_PerIsolateData::EmbedderDataSlot() { |
+ return g_embedderDataSlot; |
+} |
+ |
+// static |
+void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) { |
+ if (!pIsolate->GetData(g_embedderDataSlot)) |
+ pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData()); |
+} |
+ |
+// static |
+FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { |
+ return static_cast<FXJS_PerIsolateData*>( |
+ pIsolate->GetData(g_embedderDataSlot)); |
+} |