diff options
author | jbauman <jbauman@chromium.org> | 2014-10-09 17:22:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-10 00:23:11 +0000 |
commit | fdc3baa3f2ae1554292165b53189196acd7418e4 (patch) | |
tree | d18943bb63a7be1fcaf04ccdfc3389b99604d8a0 /cc/surfaces/surface.cc | |
parent | f41800135c80bd45b9ddedf3e09316bfb0d5fa21 (diff) | |
download | chromium_src-fdc3baa3f2ae1554292165b53189196acd7418e4.zip chromium_src-fdc3baa3f2ae1554292165b53189196acd7418e4.tar.gz chromium_src-fdc3baa3f2ae1554292165b53189196acd7418e4.tar.bz2 |
Avoid destroying surface before the parent surface stops referencing it.
Add surface sequence numbers, which are used to schedule the
destruction of surfaces. The child surface's destruction can
wait on a set of sequence numbers, and the parent surface can
later queue a frame that satisfies those numbers, causing the
former child surface to be destroyed.
Also move ownership of the SurfaceIdAllocator to the
ui::Compositor, so that the surface id namespace for a
compositor will stay the same across all output surfaces it
ever uses.
BUG=411118
Review URL: https://codereview.chromium.org/553213003
Cr-Commit-Position: refs/heads/master@{#299022}
Diffstat (limited to 'cc/surfaces/surface.cc')
-rw-r--r-- | cc/surfaces/surface.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc index d58ed4c..4d32d72 100644 --- a/cc/surfaces/surface.cc +++ b/cc/surfaces/surface.cc @@ -7,6 +7,7 @@ #include "cc/output/compositor_frame.h" #include "cc/output/copy_output_request.h" #include "cc/surfaces/surface_factory.h" +#include "cc/surfaces/surface_manager.h" namespace cc { @@ -17,7 +18,7 @@ static const int kFrameIndexStart = 2; Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) : surface_id_(id), size_(size), - factory_(factory), + factory_(factory->AsWeakPtr()), frame_index_(kFrameIndexStart) { } @@ -28,7 +29,7 @@ Surface::~Surface() { (*it)->SendEmptyResult(); } copy_requests_.clear(); - if (current_frame_) { + if (current_frame_ && factory_) { ReturnedResourceArray current_resources; TransferableResource::ReturnResources( current_frame_->delegated_frame_data->resource_list, @@ -39,6 +40,7 @@ Surface::~Surface() { void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, const base::Closure& callback) { + DCHECK(factory_); for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); it != copy_requests_.end(); ++it) { @@ -63,6 +65,8 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, if (!draw_callback_.is_null()) draw_callback_.Run(); draw_callback_ = callback; + factory_->manager()->DidSatisfySequences( + surface_id_, ¤t_frame_->metadata.satisfies_sequences); } void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { |