| Index: content/browser/compositor/delegated_frame_host.cc
|
| diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
|
| index 09e5688e9244685b17d90682b8271fa386301a6f..bf45f7ec448500799b8d347349876104397a3987 100644
|
| --- a/content/browser/compositor/delegated_frame_host.cc
|
| +++ b/content/browser/compositor/delegated_frame_host.cc
|
| @@ -332,9 +332,11 @@ void DelegatedFrameHost::SwapDelegatedFrame(
|
| }
|
| last_output_surface_id_ = output_surface_id;
|
| }
|
| + bool modified_layers = false;
|
| if (frame_size.IsEmpty()) {
|
| DCHECK(frame_data->resource_list.empty());
|
| EvictDelegatedFrame();
|
| + modified_layers = true;
|
| } else {
|
| if (use_surfaces_) {
|
| if (!surface_factory_) {
|
| @@ -347,11 +349,12 @@ void DelegatedFrameHost::SwapDelegatedFrame(
|
| if (surface_id_.is_null() || frame_size != current_surface_size_ ||
|
| frame_size_in_dip != current_frame_size_in_dip_) {
|
| if (!surface_id_.is_null())
|
| - surface_factory_->Destroy(surface_id_);
|
| + surfaces_to_destroy_after_commit_.push_back(surface_id_);
|
| surface_id_ = id_allocator_->GenerateId();
|
| surface_factory_->Create(surface_id_, frame_size);
|
| client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip);
|
| current_surface_size_ = frame_size;
|
| + modified_layers = true;
|
| }
|
| scoped_ptr<cc::CompositorFrame> compositor_frame =
|
| make_scoped_ptr(new cc::CompositorFrame());
|
| @@ -377,18 +380,23 @@ void DelegatedFrameHost::SwapDelegatedFrame(
|
| } else {
|
| frame_provider_->SetFrameData(frame_data.Pass());
|
| }
|
| + modified_layers = true;
|
| }
|
| }
|
| released_front_lock_ = NULL;
|
| current_frame_size_in_dip_ = frame_size_in_dip;
|
| CheckResizeLock();
|
|
|
| - client_->SchedulePaintInRect(damage_rect_in_dip);
|
| + if (modified_layers) {
|
| + // TODO(jbauman): Need to always tell the window observer about the
|
| + // damage.
|
| + client_->SchedulePaintInRect(damage_rect_in_dip);
|
| + }
|
|
|
| pending_delegated_ack_count_++;
|
|
|
| ui::Compositor* compositor = client_->GetCompositor();
|
| - if (!compositor) {
|
| + if (!compositor || !modified_layers) {
|
| SendDelegatedFrameAck(output_surface_id);
|
| } else {
|
| std::vector<ui::LatencyInfo>::const_iterator it;
|
| @@ -468,7 +476,7 @@ void DelegatedFrameHost::EvictDelegatedFrame() {
|
| client_->GetLayer()->SetShowPaintedContent();
|
| frame_provider_ = NULL;
|
| if (!surface_id_.is_null()) {
|
| - surface_factory_->Destroy(surface_id_);
|
| + surfaces_to_destroy_after_commit_.push_back(surface_id_);
|
| surface_id_ = cc::SurfaceId();
|
| }
|
| delegated_frame_evictor_->DiscardedFrame();
|
| @@ -756,6 +764,10 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo(
|
|
|
| void DelegatedFrameHost::OnCompositingDidCommit(
|
| ui::Compositor* compositor) {
|
| + std::copy(surfaces_to_destroy_after_commit_.begin(),
|
| + surfaces_to_destroy_after_commit_.end(),
|
| + std::back_inserter(surfaces_to_destroy_after_swap_));
|
| + surfaces_to_destroy_after_commit_.clear();
|
| RenderWidgetHostImpl* host = client_->GetHost();
|
| if (can_lock_compositor_ == NO_PENDING_COMMIT) {
|
| can_lock_compositor_ = YES_CAN_LOCK;
|
| @@ -781,6 +793,13 @@ void DelegatedFrameHost::OnCompositingStarted(
|
|
|
| void DelegatedFrameHost::OnCompositingEnded(
|
| ui::Compositor* compositor) {
|
| + for (std::vector<cc::SurfaceId>::iterator it =
|
| + surfaces_to_destroy_after_swap_.begin();
|
| + it != surfaces_to_destroy_after_swap_.end();
|
| + ++it) {
|
| + surface_factory_->Destroy(*it);
|
| + }
|
| + surfaces_to_destroy_after_swap_.clear();
|
| }
|
|
|
| void DelegatedFrameHost::OnCompositingAborted(ui::Compositor* compositor) {
|
| @@ -824,6 +843,20 @@ DelegatedFrameHost::~DelegatedFrameHost() {
|
|
|
| if (!surface_id_.is_null())
|
| surface_factory_->Destroy(surface_id_);
|
| + for (std::vector<cc::SurfaceId>::iterator it =
|
| + surfaces_to_destroy_after_commit_.begin();
|
| + it != surfaces_to_destroy_after_commit_.end();
|
| + ++it) {
|
| + surface_factory_->Destroy(*it);
|
| + }
|
| + surfaces_to_destroy_after_commit_.clear();
|
| + for (std::vector<cc::SurfaceId>::iterator it =
|
| + surfaces_to_destroy_after_swap_.begin();
|
| + it != surfaces_to_destroy_after_swap_.end();
|
| + ++it) {
|
| + surface_factory_->Destroy(*it);
|
| + }
|
| + surfaces_to_destroy_after_swap_.clear();
|
| if (resource_collection_.get())
|
| resource_collection_->SetClient(NULL);
|
|
|
|
|