| Index: services/ui/demo/bitmap_uploader.cc
|
| diff --git a/services/ui/demo/bitmap_uploader.cc b/services/ui/demo/bitmap_uploader.cc
|
| index 4d3144387604e1e27503c39bb270eaaea69317ad..b5253bb4f1a5d72483952f7e1b8f4b8cd0c00a74 100644
|
| --- a/services/ui/demo/bitmap_uploader.cc
|
| +++ b/services/ui/demo/bitmap_uploader.cc
|
| @@ -36,14 +36,12 @@ BitmapUploader::BitmapUploader(Window* window)
|
| width_(0),
|
| height_(0),
|
| format_(BGRA),
|
| - next_resource_id_(1u) {
|
| -}
|
| + next_resource_id_(1u),
|
| + weak_factory_(this) {}
|
|
|
| void BitmapUploader::Init(ui::GpuService* gpu_service) {
|
| - compositor_frame_sink_ = window_->RequestCompositorFrameSink(
|
| - mojom::SurfaceType::DEFAULT,
|
| - new ContextProvider(gpu_service->EstablishGpuChannelSync()));
|
| - compositor_frame_sink_->BindToClient(this);
|
| + gpu_service->EstablishGpuChannel(base::Bind(
|
| + &BitmapUploader::OnGpuChannelEstablished, weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| BitmapUploader::~BitmapUploader() {
|
| @@ -175,6 +173,14 @@ void BitmapUploader::Upload() {
|
| compositor_frame_sink_->SubmitCompositorFrame(std::move(frame));
|
| }
|
|
|
| +void BitmapUploader::OnGpuChannelEstablished(
|
| + scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
|
| + compositor_frame_sink_ = window_->RequestCompositorFrameSink(
|
| + mojom::SurfaceType::DEFAULT,
|
| + new ContextProvider(gpu_channel));
|
| + compositor_frame_sink_->BindToClient(this);
|
| +}
|
| +
|
| uint32_t BitmapUploader::BindTextureForSize(const gfx::Size& size) {
|
| gpu::gles2::GLES2Interface* gl =
|
| compositor_frame_sink_->context_provider()->ContextGL();
|
|
|