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

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

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: rebased 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.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.cpp
index 81c24eb0711183bd03fff278169c039b4af53845..3534a4ebfb5d2b1cd83854203e91f08945483b90 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.cpp
@@ -16,37 +16,10 @@ struct SameSizeAsScriptWrappable {
static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), "ScriptWrappable should stay small");
-namespace {
-
-class ScriptWrappableProtector final {
- WTF_MAKE_NONCOPYABLE(ScriptWrappableProtector);
-public:
- ScriptWrappableProtector(ScriptWrappable* scriptWrappable, const WrapperTypeInfo* wrapperTypeInfo)
- : m_scriptWrappable(scriptWrappable), m_wrapperTypeInfo(wrapperTypeInfo)
- {
- m_wrapperTypeInfo->refObject(m_scriptWrappable);
- }
- ~ScriptWrappableProtector()
- {
- m_wrapperTypeInfo->derefObject(m_scriptWrappable);
- }
-
-private:
- ScriptWrappable* m_scriptWrappable;
- const WrapperTypeInfo* m_wrapperTypeInfo;
-};
-
-} // namespace
-
v8::Local<v8::Object> ScriptWrappable::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
{
const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
- // It's possible that no one except for the new wrapper owns this object at
- // this moment, so we have to prevent GC to collect this object until the
- // object gets associated with the wrapper.
- ScriptWrappableProtector protect(this, wrapperTypeInfo);
-
ASSERT(!DOMDataStore::containsWrapper(this, isolate));
v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creationContext, wrapperTypeInfo, this);
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h ('k') | third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698