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

Unified Diff: Source/bindings/core/v8/ScriptWrappable.h

Issue 806693004: Use new phantom handles for ScriptWrappable. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptWrappable.h
diff --git a/Source/bindings/core/v8/ScriptWrappable.h b/Source/bindings/core/v8/ScriptWrappable.h
index 3e9c59da767b8a940eb82bab891aabdbe612ef60..ecd07a494f3c84b465463c430613bd06655cc475 100644
--- a/Source/bindings/core/v8/ScriptWrappable.h
+++ b/Source/bindings/core/v8/ScriptWrappable.h
@@ -85,7 +85,7 @@ public:
RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(toScriptWrappable(wrapper) == this);
m_wrapper.Reset(isolate, wrapper);
wrapperTypeInfo->configureWrapper(&m_wrapper);
- m_wrapper.SetWeak(this, &setWeakCallback);
+ m_wrapper.SetPhantom(&setWeakCallback, v8DOMWrapperTypeIndex, v8DOMWrapperObjectIndex);
ASSERT(containsWrapper());
}
@@ -159,21 +159,15 @@ protected:
// already broken), we must not hit the RELEASE_ASSERT.
private:
- void disposeWrapper(v8::Local<v8::Object> wrapper)
+ static void setWeakCallback(const v8::InternalFieldsCallbackData<WrapperTypeInfo, ScriptWrappable>& data)
haraken 2014/12/15 15:49:37 setWeakCallback => wealCallback? It is not settin
{
- ASSERT(containsWrapper());
- ASSERT(wrapper == m_wrapper);
- m_wrapper.Reset();
- }
-
- static void setWeakCallback(const v8::WeakCallbackData<v8::Object, ScriptWrappable>& data)
- {
- data.GetParameter()->disposeWrapper(data.GetValue());
-
// FIXME: I noticed that 50%~ of minor GC cycle times can be consumed
// inside data.GetParameter()->deref(), which causes Node destructions. We should
// make Node destructions incremental.
- releaseObject(data.GetValue());
+ WrapperTypeInfo* wrapperTypeInfo = reinterpret_cast<WrapperTypeInfo*>(data.GetInternalField1());
+ ScriptWrappable* scriptWrappable = reinterpret_cast<ScriptWrappable*>(data.GetInternalField2());
+ scriptWrappable->m_wrapper.Empty();
haraken 2014/12/15 15:49:37 Shall we rename Empty to Reset or Clear, for consi
+ wrapperTypeInfo->derefObject(scriptWrappable);
}
v8::Persistent<v8::Object> m_wrapper;
« 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