Commit 82279ba0 authored by jochen@chromium.org's avatar jochen@chromium.org

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=
R=dcarney@chromium.org, svenpanne@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/215893005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20463 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 066956dd
...@@ -4428,6 +4428,20 @@ class V8_EXPORT Isolate { ...@@ -4428,6 +4428,20 @@ class V8_EXPORT Isolate {
*/ */
void SetEventLogger(LogEventCallback that); 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: private:
template<class K, class V, class Traits> friend class PersistentValueMap; template<class K, class V, class Traits> friend class PersistentValueMap;
...@@ -4795,11 +4809,15 @@ class V8_EXPORT V8 { ...@@ -4795,11 +4809,15 @@ class V8_EXPORT V8 {
* CallCompletedCallback is only invoked when the outer-most script * CallCompletedCallback is only invoked when the outer-most script
* execution ends. Executing scripts inside the callback do not trigger * execution ends. Executing scripts inside the callback do not trigger
* further callbacks. * further callbacks.
*
* Will be deprecated soon. Use Isolate::AddCallCompletedCallback.
*/ */
static void AddCallCompletedCallback(CallCompletedCallback callback); static void AddCallCompletedCallback(CallCompletedCallback callback);
/** /**
* Removes callback that was installed by AddCallCompletedCallback. * Removes callback that was installed by AddCallCompletedCallback.
*
* Will be deprecated soon. Use Isolate::RemoveCallCompletedCallback.
*/ */
static void RemoveCallCompletedCallback(CallCompletedCallback callback); static void RemoveCallCompletedCallback(CallCompletedCallback callback);
......
...@@ -6684,6 +6684,20 @@ void Isolate::SetEventLogger(LogEventCallback that) { ...@@ -6684,6 +6684,20 @@ void Isolate::SetEventLogger(LogEventCallback that) {
isolate->set_event_logger(that); 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) String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
: str_(NULL), length_(0) { : str_(NULL), length_(0) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment