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

Unified Diff: cc/surfaces/surface_factory_unittest.cc

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_id_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory_unittest.cc
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index 5cb83fec5881d41ed0adfc2ea7e90d203bcd600e..ba2a8884f9b5b52dfe1ec499f345101e41858058 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -372,5 +372,32 @@ TEST_F(SurfaceFactoryTest, DestroyWithResourceRefs) {
factory_.SubmitFrame(id, frame.Pass(), base::Closure());
}
+TEST_F(SurfaceFactoryTest, DestroySequence) {
+ SurfaceId id2(5);
+ factory_.Create(id2, gfx::Size(5, 5));
+
+ // Check that waiting before the sequence is satisfied works.
+ std::set<SurfaceSequence> sequence;
+ sequence.insert(SurfaceSequence(0, 4));
+ factory_.DestroyOnSequence(id2, sequence);
+
+ scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
+ scoped_ptr<CompositorFrame> frame(new CompositorFrame);
+ frame->metadata.satisfies_sequences.push_back(6);
+ frame->metadata.satisfies_sequences.push_back(4);
+ frame->delegated_frame_data = frame_data.Pass();
+ DCHECK(manager_.GetSurfaceForId(id2));
+ factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure());
+ DCHECK(!manager_.GetSurfaceForId(id2));
+
+ // Check that waiting after the sequence is satisfied works.
+ factory_.Create(id2, gfx::Size(5, 5));
+ sequence.clear();
+ sequence.insert(SurfaceSequence(0, 6));
+ DCHECK(manager_.GetSurfaceForId(id2));
+ factory_.DestroyOnSequence(id2, sequence);
+ DCHECK(!manager_.GetSurfaceForId(id2));
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_id_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698