diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-03 06:23:44 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-06 19:44:44 +0400 |
commit | 110a9cd8db515c4d1a9ac5cd8837291da7c6c5ea (patch) | |
tree | 71e5a14a98131d89d670f842eb36bfcccab00b7b /src/tty_wrap.h | |
parent | 9b3de60d3537df657e75887436a5b1df5ed80c2d (diff) |
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/tty_wrap.h')
-rw-r--r-- | src/tty_wrap.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/tty_wrap.h b/src/tty_wrap.h index f20fea6ad64..898bd115734 100644 --- a/src/tty_wrap.h +++ b/src/tty_wrap.h @@ -27,28 +27,21 @@ namespace node { -using v8::Object; -using v8::Handle; -using v8::Local; -using v8::Value; -using v8::Arguments; - - class TTYWrap : public StreamWrap { public: - static void Initialize(Handle<Object> target); - static TTYWrap* Unwrap(Local<Object> obj); + static void Initialize(v8::Handle<v8::Object> target); + static TTYWrap* Unwrap(v8::Local<v8::Object> obj); uv_tty_t* UVHandle(); private: - TTYWrap(Handle<Object> object, int fd, bool readable); + TTYWrap(v8::Handle<v8::Object> object, int fd, bool readable); - static Handle<Value> GuessHandleType(const Arguments& args); - static Handle<Value> IsTTY(const Arguments& args); - static Handle<Value> GetWindowSize(const Arguments& args); - static Handle<Value> SetRawMode(const Arguments& args); - static Handle<Value> New(const Arguments& args); + static void GuessHandleType(const v8::FunctionCallbackInfo<v8::Value>& args); + static void IsTTY(const v8::FunctionCallbackInfo<v8::Value>& args); + static void GetWindowSize(const v8::FunctionCallbackInfo<v8::Value>& args); + static void SetRawMode(const v8::FunctionCallbackInfo<v8::Value>& args); + static void New(const v8::FunctionCallbackInfo<v8::Value>& args); uv_tty_t handle_; }; |