diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-03 04:23:44 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-06 17:44:44 +0200 |
commit | 110a9cd8db515c4d1a9ac5cd8837291da7c6c5ea (patch) | |
tree | 71e5a14a98131d89d670f842eb36bfcccab00b7b /src/tls_wrap.h | |
parent | 9b3de60d3537df657e75887436a5b1df5ed80c2d (diff) | |
download | android-node-v8-110a9cd8db515c4d1a9ac5cd8837291da7c6c5ea.tar.gz android-node-v8-110a9cd8db515c4d1a9ac5cd8837291da7c6c5ea.tar.bz2 android-node-v8-110a9cd8db515c4d1a9ac5cd8837291da7c6c5ea.zip |
lib, src: upgrade after v8 api change
This is a big commit that touches just about every file in the src/
directory. The V8 API has changed in significant ways. The most
important changes are:
* Binding functions take a const v8::FunctionCallbackInfo<T>& argument
rather than a const v8::Arguments& argument.
* Binding functions return void rather than v8::Handle<v8::Value>. The
return value is returned with the args.GetReturnValue().Set() family
of functions.
* v8::Persistent<T> no longer derives from v8::Handle<T> and no longer
allows you to directly dereference the object that the persistent
handle points to. This means that the common pattern of caching
oft-used JS values in a persistent handle no longer quite works,
you first need to reconstruct a v8::Local<T> from the persistent
handle with the Local<T>::New(isolate, persistent) factory method.
A handful of (internal) convenience classes and functions have been
added to make dealing with the new API a little easier.
The most visible one is node::Cached<T>, which wraps a v8::Persistent<T>
with some template sugar. It can hold arbitrary types but so far it's
exclusively used for v8::Strings (which was by far the most commonly
cached handle type.)
Diffstat (limited to 'src/tls_wrap.h')
-rw-r--r-- | src/tls_wrap.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/tls_wrap.h b/src/tls_wrap.h index be97fe3efc..3e56926328 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -118,17 +118,19 @@ class TLSCallbacks : public StreamWrapCallbacks { v8::Handle<v8::Value> GetSSLError(int status, int* err); - static v8::Handle<v8::Value> Wrap(const v8::Arguments& args); - static v8::Handle<v8::Value> Start(const v8::Arguments& args); - static v8::Handle<v8::Value> GetPeerCertificate(const v8::Arguments& args); - static v8::Handle<v8::Value> GetSession(const v8::Arguments& args); - static v8::Handle<v8::Value> SetSession(const v8::Arguments& args); - static v8::Handle<v8::Value> LoadSession(const v8::Arguments& args); - static v8::Handle<v8::Value> GetCurrentCipher(const v8::Arguments& args); - static v8::Handle<v8::Value> VerifyError(const v8::Arguments& args); - static v8::Handle<v8::Value> SetVerifyMode(const v8::Arguments& args); - static v8::Handle<v8::Value> IsSessionReused(const v8::Arguments& args); - static v8::Handle<v8::Value> EnableSessionCallbacks(const v8::Arguments& args); + static void Wrap(const v8::FunctionCallbackInfo<v8::Value>& args); + static void Start(const v8::FunctionCallbackInfo<v8::Value>& args); + static void GetPeerCertificate( + const v8::FunctionCallbackInfo<v8::Value>& args); + static void GetSession(const v8::FunctionCallbackInfo<v8::Value>& args); + static void SetSession(const v8::FunctionCallbackInfo<v8::Value>& args); + static void LoadSession(const v8::FunctionCallbackInfo<v8::Value>& args); + static void GetCurrentCipher(const v8::FunctionCallbackInfo<v8::Value>& args); + static void VerifyError(const v8::FunctionCallbackInfo<v8::Value>& args); + static void SetVerifyMode(const v8::FunctionCallbackInfo<v8::Value>& args); + static void IsSessionReused(const v8::FunctionCallbackInfo<v8::Value>& args); + static void EnableSessionCallbacks( + const v8::FunctionCallbackInfo<v8::Value>& args); // TLS Session API static SSL_SESSION* GetSessionCallback(SSL* s, @@ -138,8 +140,9 @@ class TLSCallbacks : public StreamWrapCallbacks { static int NewSessionCallback(SSL* s, SSL_SESSION* sess); #ifdef OPENSSL_NPN_NEGOTIATED - static v8::Handle<v8::Value> GetNegotiatedProto(const v8::Arguments& args); - static v8::Handle<v8::Value> SetNPNProtocols(const v8::Arguments& args); + static void GetNegotiatedProto( + const v8::FunctionCallbackInfo<v8::Value>& args); + static void SetNPNProtocols(const v8::FunctionCallbackInfo<v8::Value>& args); static int AdvertiseNextProtoCallback(SSL* s, const unsigned char** data, unsigned int* len, @@ -153,15 +156,23 @@ class TLSCallbacks : public StreamWrapCallbacks { #endif // OPENSSL_NPN_NEGOTIATED #ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB - static v8::Handle<v8::Value> GetServername(const v8::Arguments& args); - static v8::Handle<v8::Value> SetServername(const v8::Arguments& args); + static void GetServername(const v8::FunctionCallbackInfo<v8::Value>& args); + static void SetServername(const v8::FunctionCallbackInfo<v8::Value>& args); static int SelectSNIContextCallback(SSL* s, int* ad, void* arg); #endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB + inline v8::Local<v8::Object> object() { + return v8::Local<v8::Object>::New(node_isolate, persistent()); + } + + inline v8::Persistent<v8::Object>& persistent() { + return object_; + } + Kind kind_; crypto::SecureContext* sc_; v8::Persistent<v8::Object> sc_handle_; - v8::Persistent<v8::Object> handle_; + v8::Persistent<v8::Object> object_; SSL* ssl_; BIO* enc_in_; BIO* enc_out_; |