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

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1468423004: CFXJS_ObjDefinition's lifetime must match isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/jsapi/fxjs_v8.h" 7 #include "fpdfsdk/include/jsapi/fxjs_v8.h"
8 8
9 #include "core/include/fxcrt/fx_basic.h" 9 #include "core/include/fxcrt/fx_basic.h"
10 10
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); 344 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i));
345 delete pStaticObjects->at(i); 345 delete pStaticObjects->at(i);
346 pStaticObjects->at(i) = nullptr; 346 pStaticObjects->at(i) = nullptr;
347 } 347 }
348 348
349 if (!pObj.IsEmpty()) { 349 if (!pObj.IsEmpty()) {
350 if (pObjDef->m_pDestructor) 350 if (pObjDef->m_pDestructor)
351 pObjDef->m_pDestructor(pObj); 351 pObjDef->m_pDestructor(pObj);
352 FXJS_FreePrivate(pObj); 352 FXJS_FreePrivate(pObj);
353 } 353 }
354 delete pObjDef;
355 } 354 }
356 355
357 if (pIsolate == g_isolate && --g_isolate_ref_count > 0) 356 if (pIsolate == g_isolate && --g_isolate_ref_count > 0)
358 return; 357 return;
359 358
359 for (int i = 0; i < maxID; ++i)
360 delete CFXJS_ObjDefinition::ForID(pIsolate, i);
361
360 pIsolate->SetData(g_embedderDataSlot, nullptr); 362 pIsolate->SetData(g_embedderDataSlot, nullptr);
361 delete pData; 363 delete pData;
362 } 364 }
363 365
364 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { 366 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) {
365 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 367 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
366 return static_cast<IJS_Runtime*>( 368 return static_cast<IJS_Runtime*>(
367 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); 369 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex));
368 } 370 }
369 371
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 return v8::Local<v8::Array>(); 751 return v8::Local<v8::Array>();
750 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 752 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
751 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); 753 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
752 } 754 }
753 755
754 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { 756 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) {
755 pTo = pFrom; 757 pTo = pFrom;
756 } 758 }
757 759
758 760
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698