Revision: 20463
Author: [email protected]
Date: Thu Apr 3 07:51:27 2014 UTC
Log: Add API for adding and removing CallCompletedCallbacks to Isolate
The API currently just forwards to the global methods. A follow-up
change will move the callback handling to the Isolate and deprecate the
global versions.
BUG=
[email protected], [email protected]
LOG=n
Review URL: https://codereview.chromium.org/215893005
http://code.google.com/p/v8/source/detail?r=20463
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Tue Apr 1 18:04:06 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Thu Apr 3 07:51:27 2014 UTC
@@ -4428,6 +4428,20 @@
*/
void SetEventLogger(LogEventCallback that);
+ /**
+ * Adds a callback to notify the host application when a script finished
+ * running. If a script re-enters the runtime during executing, the
+ * CallCompletedCallback is only invoked when the outer-most script
+ * execution ends. Executing scripts inside the callback do not trigger
+ * further callbacks.
+ */
+ void AddCallCompletedCallback(CallCompletedCallback callback);
+
+ /**
+ * Removes callback that was installed by AddCallCompletedCallback.
+ */
+ void RemoveCallCompletedCallback(CallCompletedCallback callback);
+
private:
template<class K, class V, class Traits> friend class PersistentValueMap;
@@ -4795,11 +4809,15 @@
* CallCompletedCallback is only invoked when the outer-most script
* execution ends. Executing scripts inside the callback do not trigger
* further callbacks.
+ *
+ * Will be deprecated soon. Use Isolate::AddCallCompletedCallback.
*/
static void AddCallCompletedCallback(CallCompletedCallback callback);
/**
* Removes callback that was installed by AddCallCompletedCallback.
+ *
+ * Will be deprecated soon. Use Isolate::RemoveCallCompletedCallback.
*/
static void RemoveCallCompletedCallback(CallCompletedCallback callback);
=======================================
--- /branches/bleeding_edge/src/api.cc Tue Apr 1 17:43:20 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Thu Apr 3 07:51:27 2014 UTC
@@ -6683,6 +6683,20 @@
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->set_event_logger(that);
}
+
+
+void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
+ if (callback == NULL) return;
+ // TODO(jochen): Make this per isolate.
+ i::V8::AddCallCompletedCallback(callback);
+}
+
+
+void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
+ // TODO(jochen): Make this per isolate.
+ i::V8::RemoveCallCompletedCallback(callback);
+}
+
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
: str_(NULL), length_(0) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.