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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 2265873003: binding: Moves hasPendingActivity from ActiveScriptWrappable to ScriptWrappable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 4 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/V8GCController.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
index c1f74c4286e808879c9edb1af455d55690c9cafd..65d5796c042b88751e32c60eb7d3dc3f3e554f97 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
@@ -116,7 +116,8 @@ public:
v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8::Persistent<v8::Object>::Cast(*value));
ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
- if (toWrapperTypeInfo(wrapper)->hasPendingActivity(wrapper)) {
+ if (toWrapperTypeInfo(wrapper)->isActiveScriptWrappable()
+ && toScriptWrappable(wrapper)->hasPendingActivity()) {
v8::Persistent<v8::Object>::Cast(*value).MarkActive();
return;
}
@@ -157,22 +158,19 @@ public:
if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInfo::ObjectClassId)
return;
+ if (value->IsIndependent())
+ return;
+
v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8::Persistent<v8::Object>::Cast(*value));
- ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
+ DCHECK(V8DOMWrapper::hasInternalFieldsSet(wrapper));
const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper);
- if (type->hasPendingActivity(wrapper)) {
- // If you hit this assert, you'll need to add a [DependentiLifetime]
- // extended attribute to the DOM interface. A DOM interface that
- // overrides hasPendingActivity must be marked as [DependentLifetime].
- RELEASE_ASSERT(!value->IsIndependent());
+ if (type->isActiveScriptWrappable()
+ && toScriptWrappable(wrapper)->hasPendingActivity()) {
m_isolate->SetObjectGroupId(*value, liveRootId());
++m_domObjectsWithPendingActivity;
}
- if (value->IsIndependent())
- return;
-
if (classId == WrapperTypeInfo::NodeClassId) {
DCHECK(V8Node::hasInstance(wrapper, m_isolate));
Node* node = V8Node::toImpl(wrapper);
@@ -185,7 +183,7 @@ public:
} else if (classId == WrapperTypeInfo::ObjectClassId) {
type->visitDOMWrapper(m_isolate, toScriptWrappable(wrapper), v8::Persistent<v8::Object>::Cast(*value));
} else {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
}
@@ -457,7 +455,8 @@ public:
v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8::Persistent<v8::Object>::Cast(*value));
ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
// The ExecutionContext check is heavy, so it should be done at the last.
- if (toWrapperTypeInfo(wrapper)->hasPendingActivity(wrapper)
+ if (toWrapperTypeInfo(wrapper)->isActiveScriptWrappable()
+ && toScriptWrappable(wrapper)->hasPendingActivity()
// TODO(haraken): Currently we don't have a way to get a creation
// context from a wrapper. We should implement the way and enable
// the following condition.

Powered by Google App Engine
This is Rietveld 408576698