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

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

Issue 625943002: Catch uncaught promise rejections from V8 and log to console. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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: Source/bindings/core/v8/ScriptValueTraits.h
diff --git a/Source/bindings/core/v8/ScriptValueTraits.h b/Source/bindings/core/v8/ScriptValueTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..19b7e1ef8886d9c8dfc3becdf0fd052b4cea3fe2
--- /dev/null
+++ b/Source/bindings/core/v8/ScriptValueTraits.h
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ScriptValueTraits_h
+#define ScriptValueTraits_h
+
+#include "bindings/core/v8/ScriptValue.h"
+#include "wtf/HashTraits.h"
+
+namespace blink {
+
+struct ScriptValueHash {
+ static unsigned hash(const ScriptValue& value) { return value.identityHash(); }
+ static bool equal(const ScriptValue& a, const ScriptValue& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct ScriptValueHashTraits : WTF::SimpleClassHashTraits<ScriptValue> {
+ static const bool hasIsEmptyValueFunction = true;
+ static bool isEmptyValue(const ScriptValue& value) { return value.isEmpty() && !value.isHashTableDeletedValue(); }
yurys 2014/10/03 15:08:05 Why do we need !value.isHashTableDeletedValue(); ?
aandrey 2014/10/06 10:52:57 Acknowledged.
+};
+
+} // namespace blink
+
+#endif // !defined(ScriptValueTraits_h)

Powered by Google App Engine
This is Rietveld 408576698