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

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

Issue 2485543004: Make SurfaceFactory lifetime match frame_sink_id registration in OffscreenCanvasCompositorFrameSink (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20515bdcf68353f833d9110638ff4ac5ca3efc37..0c4d066e37895a768142f2491c6e6b1d489ce988 100644
--- a/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc
+++ b/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc
@@ -14,20 +14,24 @@ 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)) {
+ 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());
+}
OffscreenCanvasCompositorFrameSink::~OffscreenCanvasCompositorFrameSink() {
- if (surface_factory_) {
- cc::SurfaceManager* manager = GetSurfaceManager();
- if (!manager) {
- // Inform SurfaceFactory that SurfaceManager's no longer alive to
- // avoid its destruction error.
- surface_factory_->DidDestroySurfaceManager();
- } else {
- manager->InvalidateFrameSinkId(surface_id_.frame_sink_id());
- }
- surface_factory_->Destroy(surface_id_.local_frame_id());
+ cc::SurfaceManager* manager = GetSurfaceManager();
+ if (!manager) {
+ // Inform SurfaceFactory that SurfaceManager's no longer alive to
+ // avoid its destruction error.
+ surface_factory_->DidDestroySurfaceManager();
+ } else {
+ manager->InvalidateFrameSinkId(surface_id_.frame_sink_id());
}
+ surface_factory_->Destroy(surface_id_.local_frame_id());
}
// static
@@ -42,14 +46,6 @@ void OffscreenCanvasCompositorFrameSink::Create(
void OffscreenCanvasCompositorFrameSink::SubmitCompositorFrame(
cc::CompositorFrame frame) {
- if (!surface_factory_) {
- cc::SurfaceManager* manager = GetSurfaceManager();
- surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
- surface_id_.frame_sink_id(), manager, this);
- surface_factory_->Create(surface_id_.local_frame_id());
-
- manager->RegisterFrameSinkId(surface_id_.frame_sink_id());
- }
++ack_pending_count_;
surface_factory_->SubmitCompositorFrame(
surface_id_.local_frame_id(), std::move(frame),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698