| Index: services/ui/demo/bitmap_uploader.cc
|
| diff --git a/services/ui/demo/bitmap_uploader.cc b/services/ui/demo/bitmap_uploader.cc
|
| index c6653e1090a5860c5fe8b7c4c6668926f63d758e..51664be84f409e8d327d854d0e755da7a0263f6f 100644
|
| --- a/services/ui/demo/bitmap_uploader.cc
|
| +++ b/services/ui/demo/bitmap_uploader.cc
|
| @@ -35,17 +35,16 @@ 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) {
|
| surface_ = window_->RequestSurface(mojom::SurfaceType::DEFAULT);
|
| surface_->BindToThread();
|
| surface_->set_client(this);
|
|
|
| - gles2_context_ = GLES2Context::CreateOffscreenContext(
|
| - gpu_service->EstablishGpuChannelSync(),
|
| - base::ThreadTaskRunnerHandle::Get());
|
| + gpu_service->EstablishGpuChannel(base::Bind(
|
| + &BitmapUploader::OnGpuChannelEstablished, weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| BitmapUploader::~BitmapUploader() {}
|
| @@ -174,6 +173,12 @@ void BitmapUploader::Upload() {
|
| surface_->SubmitCompositorFrame(std::move(frame), base::Closure());
|
| }
|
|
|
| +void BitmapUploader::OnGpuChannelEstablished(
|
| + scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
|
| + gles2_context_ = GLES2Context::CreateOffscreenContext(
|
| + gpu_channel, base::ThreadTaskRunnerHandle::Get());
|
| +}
|
| +
|
| uint32_t BitmapUploader::BindTextureForSize(const gfx::Size& size) {
|
| gpu::gles2::GLES2Interface* gl = gles2_context_->interface();
|
| // TODO(jamesr): Recycle textures.
|
|
|