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

Side by Side Diff: cc/surfaces/surface_factory_unittest.cc

Issue 666163006: Allow layers to signal that additional sequences are needed before surface destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/compositor_frame.h" 5 #include "cc/output/compositor_frame.h"
6 #include "cc/output/delegated_frame_data.h" 6 #include "cc/output/delegated_frame_data.h"
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_factory.h" 8 #include "cc/surfaces/surface_factory.h"
9 #include "cc/surfaces/surface_factory_client.h" 9 #include "cc/surfaces/surface_factory_client.h"
10 #include "cc/surfaces/surface_manager.h" 10 #include "cc/surfaces/surface_manager.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 surface_id_ = SurfaceId(); 375 surface_id_ = SurfaceId();
376 factory_.DestroyAll(); 376 factory_.DestroyAll();
377 } 377 }
378 378
379 TEST_F(SurfaceFactoryTest, DestroySequence) { 379 TEST_F(SurfaceFactoryTest, DestroySequence) {
380 SurfaceId id2(5); 380 SurfaceId id2(5);
381 factory_.Create(id2, gfx::Size(5, 5)); 381 factory_.Create(id2, gfx::Size(5, 5));
382 382
383 // Check that waiting before the sequence is satisfied works. 383 // Check that waiting before the sequence is satisfied works.
384 std::set<SurfaceSequence> sequence; 384 manager_.GetSurfaceForId(id2)
385 sequence.insert(SurfaceSequence(0, 4)); 385 ->AddDestructionDependency(SurfaceSequence(0, 4));
386 factory_.DestroyOnSequence(id2, sequence); 386 factory_.Destroy(id2);
387 387
388 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 388 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
389 scoped_ptr<CompositorFrame> frame(new CompositorFrame); 389 scoped_ptr<CompositorFrame> frame(new CompositorFrame);
390 frame->metadata.satisfies_sequences.push_back(6); 390 frame->metadata.satisfies_sequences.push_back(6);
391 frame->metadata.satisfies_sequences.push_back(4); 391 frame->metadata.satisfies_sequences.push_back(4);
392 frame->delegated_frame_data = frame_data.Pass(); 392 frame->delegated_frame_data = frame_data.Pass();
393 DCHECK(manager_.GetSurfaceForId(id2)); 393 DCHECK(manager_.GetSurfaceForId(id2));
394 factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure()); 394 factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure());
395 DCHECK(!manager_.GetSurfaceForId(id2)); 395 DCHECK(!manager_.GetSurfaceForId(id2));
396 396
397 // Check that waiting after the sequence is satisfied works. 397 // Check that waiting after the sequence is satisfied works.
398 factory_.Create(id2, gfx::Size(5, 5)); 398 factory_.Create(id2, gfx::Size(5, 5));
399 sequence.clear();
400 sequence.insert(SurfaceSequence(0, 6));
401 DCHECK(manager_.GetSurfaceForId(id2)); 399 DCHECK(manager_.GetSurfaceForId(id2));
402 factory_.DestroyOnSequence(id2, sequence); 400 manager_.GetSurfaceForId(id2)
401 ->AddDestructionDependency(SurfaceSequence(0, 6));
402 factory_.Destroy(id2);
403 DCHECK(!manager_.GetSurfaceForId(id2)); 403 DCHECK(!manager_.GetSurfaceForId(id2));
404 } 404 }
405 405
406 } // namespace 406 } // namespace
407 } // namespace cc 407 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698