Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2862)

Unified Diff: services/ui/demo/bitmap_uploader.cc

Issue 2440453002: Splitting the Mus demo code out of a service. (Closed)
Patch Set: Addressed @sky comments and synced Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/demo/bitmap_uploader.h ('k') | services/ui/demo/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « services/ui/demo/bitmap_uploader.h ('k') | services/ui/demo/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698