forked from saary/node.net
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathv8external.cpp
More file actions
28 lines (24 loc) · 921 Bytes
/
v8external.cpp
File metadata and controls
28 lines (24 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// v8sharp is a community project available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty – Use at your own risk
// View the project and the latest code at http://v8sharp.codeplex.com/
#include "v8external.h"
#include <node.h>
V8ExternalWrapper::~V8ExternalWrapper()
{
/*if (this->Object != nullptr && System::IDisposable::typeid->IsAssignableFrom(this->Object->GetType()) {
safe_cast<System::IDisposable^>(this->Object)->Dispose();
this->Object = nullptr;
}*/
}
V8ExternalWrapper* V8ExternalWrapper::Create(gcroot<System::Object^> obj)
{
V8ExternalWrapper* wrapper = new V8ExternalWrapper();
wrapper->Object = obj;
return wrapper;
}
V8ExternalWrapper* V8ExternalWrapper::Unwrap(v8::Handle<v8::Value> value)
{
v8::External* external = v8::External::Cast(*value);
V8ExternalWrapper* wrapper = static_cast<V8ExternalWrapper*>(external->Value());
return wrapper;
}