Permalink
Browse files

core, refactor: move ValueHolder to fibjs domain.

  • Loading branch information...
xicilion committed May 16, 2018
1 parent 2722598 commit a3373d24624425e9512a1a1a29b181bf4ba110c1
Showing with 14 additions and 11 deletions.
  1. +2 −11 fibjs/include/Chain.h
  2. +12 −0 fibjs/include/object.h
View
@@ -18,12 +18,6 @@ namespace fibjs {
class Chain : public Chain_base {
public:
class asyncInvoke : public AsyncState {
private:
class ValueHolder : public object_base {
public:
v8::Global<v8::Value> m_v;
};
public:
asyncInvoke(Handler_base* hdlr, object_base* v, AsyncEvent* ac)
: AsyncState(ac)
@@ -120,11 +114,8 @@ class Chain : public Chain_base {
while (true) {
hr = hdlr1->invoke(m_v, hdlr2, &ac);
if (hr == CALL_E_NOSYNC) {
if (!m_vholder) {
m_vholder = new ValueHolder();
m_vholder->m_v.Reset(m_v->holder()->m_isolate, m_v->wrap());
m_vholder->setJSObject();
}
if (!m_vholder)
m_vholder = new ValueHolder(m_v->wrap());
m_next = hdlr1;
return 0;
View
@@ -419,6 +419,18 @@ class object_base : public obj_base {
static void s_toJSON(const v8::FunctionCallbackInfo<v8::Value>& args);
};
class ValueHolder : public object_base {
public:
ValueHolder(v8::Local<v8::Value> v)
{
m_v.Reset(holder()->m_isolate, v);
setJSObject();
}
public:
v8::Global<v8::Value> m_v;
};
class RootModule {
public:
RootModule()

0 comments on commit a3373d2

Please sign in to comment.