コード例 #1
0
v8::Local<v8::Value> WebDOMFileSystem::toV8Value(v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
{
    // We no longer use |creationContext| because it's often misused and points
    // to a context faked by user script.
    DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
    if (!m_private.get())
        return v8::Local<v8::Value>();
    return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate);
}
コード例 #2
0
void ScriptPromisePropertyBase::resolveOrRejectInternal(v8::Local<v8::Promise::Resolver> resolver)
{
    v8::Local<v8::Context> context = resolver->CreationContext();
    switch (m_state) {
    case Pending:
        ASSERT_NOT_REACHED();
        break;
    case Resolved:
        resolver->Resolve(context, resolvedValue(m_isolate, context->Global()));
        break;
    case Rejected:
        resolver->Reject(context, rejectedValue(m_isolate, context->Global()));
        break;
    }
}
コード例 #3
0
v8::Local<v8::Value> WebDOMFileSystem::createV8Entry(
    const WebString& path,
    EntryType entryType,
    v8::Local<v8::Object> creationContext,
    v8::Isolate* isolate)
{
    // We no longer use |creationContext| because it's often misused and points
    // to a context faked by user script.
    DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext());
    if (!m_private.get())
        return v8::Local<v8::Value>();
    if (entryType == EntryTypeDirectory)
        return toV8(DirectoryEntry::create(m_private.get(), path), isolate->GetCurrentContext()->Global(), isolate);
    DCHECK_EQ(entryType, EntryTypeFile);
    return toV8(FileEntry::create(m_private.get(), path), isolate->GetCurrentContext()->Global(), isolate);
}
コード例 #4
0
 /**
  * Set the callback function. need to be called in main loop
  */
 void SetCB(v8::Local<v8::Function> cb) {
     mCB.Reset(cb->CreationContext()->GetIsolate(), cb);
 }