Exemple #1
0
void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
    switch (m_binaryType) {
    case BinaryTypeBlob:
        // FIXME: Handle Blob after supporting WebBlob.
        break;
    case BinaryTypeArrayBuffer:
        m_client->didReceiveArrayBuffer(WebArrayBuffer(ArrayBuffer::create(binaryData->data(), binaryData->size())));
        break;
    }
}
void WebPepperSocketImpl::didReceiveBinaryMessage(
    std::unique_ptr<Vector<char>> payload) {
  switch (m_binaryType) {
    case BinaryTypeBlob:
      // FIXME: Handle Blob after supporting WebBlob.
      break;
    case BinaryTypeArrayBuffer:
      m_client->didReceiveArrayBuffer(WebArrayBuffer(
          DOMArrayBuffer::create(payload->data(), payload->size())));
      break;
  }
}
Exemple #3
0
static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer)
{
    if (!object || (object->_class != npScriptObjectClass))
        return false;

    V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object);
    v8::Handle<v8::Object> v8Object(v8NPObject->v8Object);
    ArrayBuffer* native = V8ArrayBuffer::HasInstance(v8Object) ? V8ArrayBuffer::toNative(v8Object) : 0;
    if (!native)
        return false;

    *arrayBuffer = WebArrayBuffer(native);
    return true;
}
Exemple #4
0
void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
#if ENABLE(WEB_SOCKETS)
    switch (m_binaryType) {
    case BinaryTypeBlob:
        // FIXME: Handle Blob after supporting WebBlob.
        break;
    case BinaryTypeArrayBuffer:
        m_client->didReceiveArrayBuffer(WebArrayBuffer(ArrayBuffer::create(binaryData->data(), binaryData->size())));
        break;
    }
#else
    ASSERT_NOT_REACHED();
#endif
}
Exemple #5
0
static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer, v8::Isolate* isolate)
{
    if (!object)
        return false;

    V8NPObject* v8NPObject = npObjectToV8NPObject(object);
    if (!v8NPObject)
        return false;

    v8::HandleScope handleScope(isolate);
    v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object);
    if (v8Object.IsEmpty())
        return false;
    DOMArrayBuffer* impl = V8ArrayBuffer::hasInstance(v8Object, isolate) ? V8ArrayBuffer::toImpl(v8Object) : 0;
    if (!impl)
        return false;

    *arrayBuffer = WebArrayBuffer(impl);
    return true;
}
Exemple #6
0
WebArrayBuffer WebArrayBuffer::create(unsigned numElements, unsigned elementByteSize)
{
    RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(numElements, elementByteSize);
    return WebArrayBuffer(buffer);
}