CanvasImageDecoder::CanvasImageDecoder( mojo::ScopedDataPipeConsumerHandle handle, PassOwnPtr<ImageDecoderCallback> callback) : callback_(callback) { CHECK(callback_); buffer_ = SharedBuffer::create(); drainer_ = adoptPtr(new mojo::common::DataPipeDrainer(this, handle.Pass())); }
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())); }
void WebLocalFrameImpl::loadFromDataPipeWithURL(mojo::ScopedDataPipeConsumerHandle responseStream, const WebURL& url) { frame()->mojoLoader().init(url); frame()->mojoLoader().parse(responseStream.Pass()); }
PassRefPtr<CanvasImageDecoder> CanvasImageDecoder::create( mojo::ScopedDataPipeConsumerHandle handle, PassOwnPtr<ImageDecoderCallback> callback) { return adoptRef(new CanvasImageDecoder(handle.Pass(), callback)); }