CanvasImageDecoder::CanvasImageDecoder(
    mojo::ScopedDataPipeConsumerHandle handle,
    PassOwnPtr<ImageDecoderCallback> callback)
    : callback_(callback), weak_factory_(this) {
  CHECK(callback_);
  if (!handle.is_valid()) {
    base::MessageLoop::current()->PostTask(
        FROM_HERE, base::Bind(&CanvasImageDecoder::RejectCallback,
                              weak_factory_.GetWeakPtr()));
    return;
  }

  buffer_ = SharedBuffer::create();
  drainer_ = adoptPtr(new mojo::common::DataPipeDrainer(this, handle.Pass()));
}
示例#2
0
CanvasImageDecoder::CanvasImageDecoder(
    mojo::ScopedDataPipeConsumerHandle handle,
    PassOwnPtr<ImageDecoderCallback> callback)
  : callback_(callback) {
  CHECK(callback_);
  buffer_ = SharedBuffer::create();
  drainer_ = adoptPtr(new mojo::common::DataPipeDrainer(this, handle.Pass()));
}
示例#3
0
void WebLocalFrameImpl::loadFromDataPipeWithURL(mojo::ScopedDataPipeConsumerHandle responseStream, const WebURL& url)
{
    frame()->mojoLoader().init(url);
    frame()->mojoLoader().parse(responseStream.Pass());
}
示例#4
0
PassRefPtr<CanvasImageDecoder> CanvasImageDecoder::create(
  mojo::ScopedDataPipeConsumerHandle handle,
  PassOwnPtr<ImageDecoderCallback> callback)
{
  return adoptRef(new CanvasImageDecoder(handle.Pass(), callback));
}