当前位置: 首页>>代码示例>>C++>>正文


C++ Handle::GetIsolate方法代码示例

本文整理汇总了C++中v8::Handle::GetIsolate方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::GetIsolate方法的具体用法?C++ Handle::GetIsolate怎么用?C++ Handle::GetIsolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在v8::Handle的用法示例。


在下文中一共展示了Handle::GetIsolate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: scope

bool V8PerContextDebugData::setContextDebugData(v8::Handle<v8::Context> context, const char* worldName, int debugId)
{
    if (!debugData(context)->IsUndefined())
        return false;
    v8::HandleScope scope(context->GetIsolate());
    v8::Handle<v8::Value> debugData = createDebugData(worldName, debugId, context->GetIsolate());
    setDebugData(context, debugData);
    return true;
}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:9,代码来源:V8PerContextData.cpp

示例2: Init

//Init
void DeviceNode::Init(v8::Handle<v8::Object> exports) {
  Isolate* isolate = exports->GetIsolate();

  // Prepare constructor template
  Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
  tpl->SetClassName(String::NewFromUtf8(isolate, "DeviceNode"));
  tpl->InstanceTemplate()->SetInternalFieldCount(1);

  // Prototype
  NODE_SET_PROTOTYPE_METHOD(tpl, "getName", DeviceNode::GetName);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getId", DeviceNode::GetId);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getModel", DeviceNode::GetModel);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getProtocol", DeviceNode::GetProtocol);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getDeviceType", DeviceNode::GetDeviceType);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getLastSentValue", DeviceNode::GetLastSentValue);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getMethods", DeviceNode::GetMethods);
  NODE_SET_PROTOTYPE_METHOD(tpl, "getDimValue", DeviceNode::GetDimValue);
  NODE_SET_PROTOTYPE_METHOD(tpl, "isOn", DeviceNode::IsOn);
  NODE_SET_PROTOTYPE_METHOD(tpl, "isDimmable", DeviceNode::IsDimmable);

  NODE_SET_PROTOTYPE_METHOD(tpl, "turnOff", DeviceNode::TurnOff);
  NODE_SET_PROTOTYPE_METHOD(tpl, "turnOn", DeviceNode::TurnOn);
  NODE_SET_PROTOTYPE_METHOD(tpl, "dim", DeviceNode::Dim);

  constructor.Reset(isolate, tpl->GetFunction());
  exports->Set(String::NewFromUtf8(isolate, "DeviceNode"),
               tpl->GetFunction());
}
开发者ID:egeback,项目名称:node-tellstick,代码行数:29,代码来源:device-node.cpp

示例3: CustomElementBindingMap

V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context)
    : m_wrapperBoilerplates(context->GetIsolate())
    , m_constructorMap(context->GetIsolate())
    , m_isolate(context->GetIsolate())
    , m_contextHolder(adoptPtr(new gin::ContextHolder(context->GetIsolate())))
    , m_context(m_isolate, context)
    , m_customElementBindings(adoptPtr(new CustomElementBindingMap()))
{
    m_contextHolder->SetContext(context);

    v8::Context::Scope contextScope(context);
    ASSERT(m_errorPrototype.isEmpty());
    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8AtomicString(m_isolate, "Error")));
    ASSERT(!object.IsEmpty());
    v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype"));
    ASSERT(!prototypeValue.IsEmpty());
    m_errorPrototype.set(m_isolate, prototypeValue);
}
开发者ID:coinpayee,项目名称:blink,代码行数:18,代码来源:V8PerContextData.cpp

示例4: ASSERT

ScriptState::ScriptState(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
    : m_isolate(context->GetIsolate())
    , m_context(m_isolate, context)
    , m_world(world)
    , m_perContextData(V8PerContextData::create(context))
{
    ASSERT(m_world);
    m_context.setWeak(this, &weakCallback);
    context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, this);
}
开发者ID:davemichael,项目名称:mojo,代码行数:10,代码来源:ScriptState.cpp

示例5: makeContextWeak

void DOMWrapperWorld::makeContextWeak(v8::Handle<v8::Context> context)
{
    ASSERT(isIsolatedWorld());
    ASSERT(isolatedWorld(context) == this);
    v8::Isolate* isolate = context->GetIsolate();
    v8::Persistent<v8::Context> persistent = v8::Persistent<v8::Context>::New(isolate, context);
    WeakHandleListener<DOMWrapperWorld>::makeWeak(isolate, persistent, this);
    // Matching deref is in weak callback.
    this->ref();
}
开发者ID:fmalita,项目名称:webkit,代码行数:10,代码来源:DOMWrapperWorld.cpp

示例6: RunShell

// The read-eval-execute loop of the shell.
void RunShell(v8::Handle<v8::Context> context) {
  fprintf(stderr, "V8 version %s [sample shell]\n", v8::V8::GetVersion());
  static const int kBufferSize = 256;
  // Enter the execution environment before evaluating any code.
  v8::Context::Scope context_scope(context);
  v8::Local<v8::String> name(
      v8::String::NewFromUtf8(context->GetIsolate(), "(shell)"));
  while (true) {
    char buffer[kBufferSize];
    fprintf(stderr, "> ");
    char* str = fgets(buffer, kBufferSize, stdin);
    if (str == NULL) break;
    v8::HandleScope handle_scope(context->GetIsolate());
    ExecuteString(context->GetIsolate(),
                  v8::String::NewFromUtf8(context->GetIsolate(), str),
                  name,
                  true,
                  true);
  }
  fprintf(stderr, "\n");
}
开发者ID:hanappe,项目名称:opensensordata.net,代码行数:22,代码来源:jswrap.cpp

示例7: contextScope

V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context)
    : m_isolate(context->GetIsolate())
    , m_wrapperBoilerplates(m_isolate)
    , m_constructorMap(m_isolate)
    , m_contextHolder(adoptPtr(new gin::ContextHolder(m_isolate)))
    , m_context(m_isolate, context)
    , m_activityLogger(0)
    , m_compiledPrivateScript(m_isolate)
{
    m_contextHolder->SetContext(context);

    v8::Context::Scope contextScope(context);
    ASSERT(m_errorPrototype.isEmpty());
    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8AtomicString(m_isolate, "Error")));
    ASSERT(!object.IsEmpty());
    v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype"));
    ASSERT(!prototypeValue.IsEmpty());
    m_errorPrototype.set(m_isolate, prototypeValue);
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:19,代码来源:V8PerContextData.cpp

示例8: Register

      // Registers this module with Node
      static void Register (v8::Handle <v8::Object> target)
      {
         auto isolate = target->GetIsolate ();

         // Prepare constructor template
         auto function_template = v8::FunctionTemplate::New (isolate, Create);
         function_template->SetClassName (v8::String::NewFromUtf8 (isolate, descriptor.GetName ().c_str ()));
         function_template->InstanceTemplate ()->SetInternalFieldCount (1);

         // add GetModuleInfo function
         descriptor.AddFunction ("getModuleInfo", GetModuleInfo, "Retrieves framework information about this module.", NO_PARAMETERS, RETURNS_AN OBJECT);

         // Set up exported function prototypes
         for (auto function : descriptor.GetFunctions ())
         {
            NODE_SET_PROTOTYPE_METHOD (function_template, function.name.c_str (), function.callback);
         }

         constructor.Reset (isolate, function_template->GetFunction ());
         target->Set (v8::String::NewFromUtf8 (isolate, descriptor.GetName ().c_str ()), function_template->GetFunction ());
      }
开发者ID:clutteredmind,项目名称:Loki,代码行数:22,代码来源:LokiModule.hpp

示例9: handle_scope

CContext::CContext(v8::Handle<v8::Context> context)
{
  v8::HandleScope handle_scope(v8::Isolate::GetCurrent());

  m_context.Reset(context->GetIsolate(), context);
}
开发者ID:bjorkegeek,项目名称:pyv8,代码行数:6,代码来源:Context.cpp

示例10: __registerModule

void __registerModule(v8::Handle<v8::Object> target)
{
	v8::Isolate* isolate = target->GetIsolate();
	target->Set(JSTRING("ModuleName"), JSTRING("Example Addon"));
}
开发者ID:mobileFX,项目名称:Coconut2D,代码行数:5,代码来源:example.cpp


注:本文中的v8::Handle::GetIsolate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。