OLD | NEW |
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 "content/browser/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (output_surface_id != last_output_surface_id_) { | 342 if (output_surface_id != last_output_surface_id_) { |
343 // Resource ids are scoped by the output surface. | 343 // Resource ids are scoped by the output surface. |
344 // If the originating output surface doesn't match the last one, it | 344 // If the originating output surface doesn't match the last one, it |
345 // indicates the renderer's output surface may have been recreated, in which | 345 // indicates the renderer's output surface may have been recreated, in which |
346 // case we should recreate the DelegatedRendererLayer, to avoid matching | 346 // case we should recreate the DelegatedRendererLayer, to avoid matching |
347 // resources from the old one with resources from the new one which would | 347 // resources from the old one with resources from the new one which would |
348 // have the same id. Changing the layer to showing painted content destroys | 348 // have the same id. Changing the layer to showing painted content destroys |
349 // the DelegatedRendererLayer. | 349 // the DelegatedRendererLayer. |
350 EvictDelegatedFrame(); | 350 EvictDelegatedFrame(); |
351 | 351 |
| 352 surface_factory_.reset(); |
| 353 if (!surface_returned_resources_.empty()) |
| 354 SendReturnedDelegatedResources(last_output_surface_id_); |
| 355 |
352 // Drop the cc::DelegatedFrameResourceCollection so that we will not return | 356 // Drop the cc::DelegatedFrameResourceCollection so that we will not return |
353 // any resources from the old output surface with the new output surface id. | 357 // any resources from the old output surface with the new output surface id. |
354 if (resource_collection_.get()) { | 358 if (resource_collection_.get()) { |
355 resource_collection_->SetClient(NULL); | 359 resource_collection_->SetClient(NULL); |
356 | 360 |
357 if (resource_collection_->LoseAllResources()) | 361 if (resource_collection_->LoseAllResources()) |
358 SendReturnedDelegatedResources(last_output_surface_id_); | 362 SendReturnedDelegatedResources(last_output_surface_id_); |
359 | 363 |
360 resource_collection_ = NULL; | 364 resource_collection_ = NULL; |
361 } | 365 } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 if (frame_provider_.get()) { | 996 if (frame_provider_.get()) { |
993 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 997 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
994 current_frame_size_in_dip_); | 998 current_frame_size_in_dip_); |
995 } | 999 } |
996 if (!surface_id_.is_null()) { | 1000 if (!surface_id_.is_null()) { |
997 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); | 1001 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); |
998 } | 1002 } |
999 } | 1003 } |
1000 | 1004 |
1001 } // namespace content | 1005 } // namespace content |
OLD | NEW |