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

Unified Diff: include/v8-util.h

Issue 265823006: Add defensive assert for having a weak, empty presistent in a (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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: include/v8-util.h
diff --git a/include/v8-util.h b/include/v8-util.h
index 60feff549d99da5c1c2b76a40a25a40580e0d857..3b4dd486b597b6eb18f60e83e237a755114efa22 100644
--- a/include/v8-util.h
+++ b/include/v8-util.h
@@ -283,6 +283,10 @@ class PersistentValueMap {
*/
UniquePersistent<V> SetUnique(const K& key, UniquePersistent<V>* persistent) {
if (Traits::kCallbackType != kNotWeak) {
+ // If the persistent is empty, the weak callback will actually never
+ // happen since there's no object to be garbage collected.
+ RELEASE_ASSERT(!persistent->IsEmpty());
jochen (gone - plz use gerrit) 2014/05/05 17:42:46 the v8 equivalent to RELEASE_ASSERT() is CHECK(),
+
Local<V> value(Local<V>::New(isolate_, *persistent));
persistent->template SetWeak<typename Traits::WeakCallbackDataType>(
Traits::WeakCallbackParameter(this, key, value), WeakCallback);
« 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