diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-10-27 13:40:00 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-01 12:03:45 +0100 |
commit | 721a248c287cf9534a1715496f8eaa7ed871feb4 (patch) | |
tree | 745adaab4ceedcdc71d1b253eeffa2b95de79da5 /src/3rdparty/v8/src/isolate.cc | |
parent | 121ba5bcd134dbc37088e7fadf7dc60a695c7596 (diff) | |
download | qtjsbackend-721a248c287cf9534a1715496f8eaa7ed871feb4.tar.gz |
[V8] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
When two JSObjects are compared (== or !=), if either one has
the MarkAsUseUserObjectComparison() bit set, the custom comparison
callback is invoked to do the actual comparison.
This is useful when you have "value" objects that you want to
compare as equal, even though they are actually different JS object
instances.
Change-Id: Ifb4074058566062accc2be20d43e3febc1089d13
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/isolate.cc')
-rw-r--r-- | src/3rdparty/v8/src/isolate.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/isolate.cc b/src/3rdparty/v8/src/isolate.cc index a073af9..36c1dfd 100644 --- a/src/3rdparty/v8/src/isolate.cc +++ b/src/3rdparty/v8/src/isolate.cc @@ -96,6 +96,7 @@ void ThreadLocalTop::InitializeInternal() { thread_id_ = ThreadId::Invalid(); external_caught_exception_ = false; failed_access_check_callback_ = NULL; + user_object_comparison_callback_ = NULL; save_context_ = NULL; catcher_ = NULL; top_lookup_result_ = NULL; @@ -729,6 +730,12 @@ void Isolate::SetFailedAccessCheckCallback( thread_local_top()->failed_access_check_callback_ = callback; } + +void Isolate::SetUserObjectComparisonCallback( + v8::UserObjectComparisonCallback callback) { + thread_local_top()->user_object_comparison_callback_ = callback; +} + void Isolate::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) { if (!thread_local_top()->failed_access_check_callback_) return; |