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

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

Issue 1873323002: Have bindings layer assume and insist that all interface types are GCed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
index 56066def09bf5da55179e5ea291031755826cf78..e39e0ed203cb3752c32c8a1b681701d4f99ae8de 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
@@ -164,31 +164,13 @@ private:
scriptWrappable->disposeWrapper(data);
auto wrapperTypeInfo = reinterpret_cast<WrapperTypeInfo*>(data.GetInternalField(v8DOMWrapperTypeIndex));
- if (wrapperTypeInfo->isGarbageCollected()) {
- // derefObject() for garbage collected objects is very cheap, so
- // we don't delay derefObject to the second pass.
- //
- // More importantly, we've already disposed the wrapper at this
- // moment, so the ScriptWrappable may have already been collected
- // by GC by the second pass. We shouldn't use a pointer to the
- // ScriptWrappable in secondWeakCallback in case of garbage
- // collected objects. Thus calls derefObject right now.
- wrapperTypeInfo->derefObject(scriptWrappable);
- } else {
- // For reference counted objects, let's delay the destruction of
- // the object to the second pass.
- data.SetSecondPassCallback(secondWeakCallback);
- }
- }
-
- static void secondWeakCallback(const v8::WeakCallbackInfo<ScriptWrappable>& data)
- {
- // 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.
- auto scriptWrappable = reinterpret_cast<ScriptWrappable*>(data.GetInternalField(v8DOMWrapperObjectIndex));
- auto wrapperTypeInfo = reinterpret_cast<WrapperTypeInfo*>(data.GetInternalField(v8DOMWrapperTypeIndex));
- wrapperTypeInfo->derefObject(scriptWrappable);
+ // derefObject() for garbage collected objects is very cheap, so
+ // we don't delay derefObject to any second pass.
+ //
+ // More importantly, we've already disposed the wrapper at this
+ // moment, so the ScriptWrappable may have already been collected
+ // by GC by the second pass.
+ wrapperTypeInfo->derefObject();
}
v8::Persistent<v8::Object> m_wrapper;

Powered by Google App Engine
This is Rietveld 408576698