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

Unified Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1129253004: Use phantom handles instead of weak handles (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Object.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/jsapi/fxjs_v8.cpp
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index 7af8237c2e30a5453865b4428d524d8093a87b63..59c99acdfefa1387668175b4dab18e5d0776d426 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -47,7 +47,7 @@ public:
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New(isolate);
- objTemplate->SetInternalFieldCount(1);
+ objTemplate->SetInternalFieldCount(2);
m_objTemplate.Reset(isolate, objTemplate);
//Document as the global object.
@@ -527,10 +527,15 @@ void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj)
return pPrivateData->pPrivate;
}
+void JS_FreePrivate(void* pPrivateData)
+{
+ delete (CJS_PrivateData*)pPrivateData;
+}
+
void JS_FreePrivate(v8::Handle<v8::Object> pObj)
{
if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return;
- delete (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
+ JS_FreePrivate(pObj->GetAlignedPointerFromInternalField(0));
pObj->SetAlignedPointerInInternalField(0, NULL);
}
« no previous file with comments | « fpdfsdk/src/javascript/JS_Object.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698