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

Unified Diff: content/browser/renderer_host/offscreen_canvas_surface_impl.h

Issue 2479563005: Create manager to track OffscreenCanvasSurfaceImpl instances (Closed)
Patch Set: Created 4 years, 1 month 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
Index: content/browser/renderer_host/offscreen_canvas_surface_impl.h
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
index 6ab9214688f598d4f8d5cb1e798b6c2972d50b24..845fb7fb0331132f8cbdabd513e5c718bcf3c28c 100644
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.h
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_
#define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_
+#include "base/memory/weak_ptr.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "mojo/public/cpp/bindings/interface_request.h"
@@ -21,16 +22,27 @@ class OffscreenCanvasSurfaceImpl : public blink::mojom::OffscreenCanvasSurface {
static void Create(blink::mojom::OffscreenCanvasSurfaceRequest request);
// blink::mojom::OffscreenCanvasSurface implementation.
- void GetSurfaceId(const GetSurfaceIdCallback& callback) override;
+ void GetSurfaceId(uint32_t canvas_id,
+ const GetSurfaceIdCallback& callback) override;
void Require(const cc::SurfaceId& surface_id,
const cc::SurfaceSequence& sequence) override;
void Satisfy(const cc::SurfaceSequence& sequence) override;
+ base::WeakPtr<OffscreenCanvasSurfaceImpl> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
+
private:
// Surface-related state
std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_;
cc::SurfaceId surface_id_;
+ // Each OffscreenCanvasSurfaceImpl instance takes care of one transferred
+ // HTMLCanvasElement with a unique canvas id.
+ int canvas_id_;
dcheng 2016/11/08 18:30:23 Nit: ditto, make sure the types match please.
xlai (Olivia) 2016/11/10 15:45:11 Sure. I make all of them to be int32_t. I think we
+
+ base::WeakPtrFactory<OffscreenCanvasSurfaceImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl);
};

Powered by Google App Engine
This is Rietveld 408576698