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

Unified Diff: content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc

Issue 2479563005: Create manager to track OffscreenCanvasSurfaceImpl instances (Closed)
Patch Set: fix 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_compositor_frame_sink.cc
diff --git a/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc b/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc
index 0c4d066e37895a768142f2491c6e6b1d489ce988..3a085462bfe6d03cd472d0123e7f6303835b4483 100644
--- a/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc
+++ b/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc
@@ -7,6 +7,7 @@
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_manager.h"
#include "content/browser/compositor/surface_utils.h"
+#include "content/browser/renderer_host/offscreen_canvas_surface_manager.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
namespace content {
@@ -14,12 +15,15 @@ namespace content {
OffscreenCanvasCompositorFrameSink::OffscreenCanvasCompositorFrameSink(
const cc::SurfaceId& surface_id,
cc::mojom::MojoCompositorFrameSinkClientPtr client)
- : surface_id_(surface_id), client_(std::move(client)) {
+ : surface_id_(surface_id), client_(std::move(client)), weak_factory_(this) {
Fady Samuel 2016/11/11 23:33:16 Don't store this SurfaceId maybe? Store a const F
xlai (Olivia) 2016/11/14 15:13:19 I'm going to do it in the next CL. Because right n
cc::SurfaceManager* manager = GetSurfaceManager();
surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
surface_id_.frame_sink_id(), manager, this);
manager->RegisterFrameSinkId(surface_id_.frame_sink_id());
surface_factory_->Create(surface_id_.local_frame_id());
+
+ OffscreenCanvasSurfaceManager::GetInstance()
+ ->RegisterCompositorFrameSinkInstance(surface_id_.frame_sink_id(), this);
}
OffscreenCanvasCompositorFrameSink::~OffscreenCanvasCompositorFrameSink() {
@@ -32,6 +36,9 @@ OffscreenCanvasCompositorFrameSink::~OffscreenCanvasCompositorFrameSink() {
manager->InvalidateFrameSinkId(surface_id_.frame_sink_id());
}
surface_factory_->Destroy(surface_id_.local_frame_id());
+
+ OffscreenCanvasSurfaceManager::GetInstance()
+ ->UnregisterCompositorFrameSinkInstance(surface_id_.frame_sink_id());
}
// static

Powered by Google App Engine
This is Rietveld 408576698