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

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

Issue 362963005: Make ScriptWrappable's destructor empty in oilpan bulids (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« 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 e8a741da70c795dbcf1fdb71ff09cc5d3e93c4c4..e92ca760d46fc2bdeb558f0e9e8c4ad5e3f857c1 100644
--- a/Source/bindings/core/v8/ScriptWrappable.h
+++ b/Source/bindings/core/v8/ScriptWrappable.h
@@ -208,11 +208,24 @@ public:
protected:
~ScriptWrappable()
{
+ // In Oilpan we don't need to call the destructor.
+ //
+ // - 'RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!containsWrapper())' is not needed
+ // because Oilpan is not using reference counting at all. If containsWrapper() is true,
+ // it means that ScriptWrappable still has a wrapper. In this case, the destructor
+ // must not be called since the wrapper has a persistent handle back to this ScriptWrappable object.
+ // Assuming that Oilpan's GC is correct (If we cannot assume this, a lot of more things are
+ // already broken), we must not hit the RELEASE_ASSERT.
+ //
+ // - 'm_wrapperOrTypeInfo = 0' is not needed because Oilpan's GC zeros out memory when
+ // the memory is collected and added to a free list.
+#if !ENABLE(OILPAN)
// We must not get deleted as long as we contain a wrapper. If this happens, we screwed up ref
// counting somewhere. Crash here instead of crashing during a later gc cycle.
RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!containsWrapper());
ASSERT(m_wrapperOrTypeInfo); // Assert initialization via init() even if not subsequently wrapped.
m_wrapperOrTypeInfo = 0; // Break UAF attempts to wrap.
+#endif
}
private:
« 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