OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1601 rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats(); | 1601 rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats(); |
1602 } | 1602 } |
1603 | 1603 |
1604 void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { | 1604 void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { |
1605 for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) | 1605 for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) |
1606 frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); | 1606 frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); |
1607 | 1607 |
1608 // Once all layers have been drawn, pending texture uploads should no | 1608 // Once all layers have been drawn, pending texture uploads should no |
1609 // longer block future uploads. | 1609 // longer block future uploads. |
1610 resource_provider_->MarkPendingUploadsAsNonBlocking(); | 1610 resource_provider_->MarkPendingUploadsAsNonBlocking(); |
1611 | |
1612 if (active_tree()->RequiresHighResToDraw()) | |
1613 active_tree()->ResetRequiresHighResToDraw(); | |
sohanjg
2014/09/10 06:28:07
we reset this on swap buffers too, but tests don't
| |
1611 } | 1614 } |
1612 | 1615 |
1613 void LayerTreeHostImpl::FinishAllRendering() { | 1616 void LayerTreeHostImpl::FinishAllRendering() { |
1614 if (renderer_) | 1617 if (renderer_) |
1615 renderer_->Finish(); | 1618 renderer_->Finish(); |
1616 } | 1619 } |
1617 | 1620 |
1618 bool LayerTreeHostImpl::IsContextLost() { | 1621 bool LayerTreeHostImpl::IsContextLost() { |
1619 DCHECK(proxy_->IsImplThread()); | 1622 DCHECK(proxy_->IsImplThread()); |
1620 // To avoid races, rely only on the lost-surface callback. | 1623 // To avoid races, rely only on the lost-surface callback. |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2055 // Note: order is important here. | 2058 // Note: order is important here. |
2056 renderer_.reset(); | 2059 renderer_.reset(); |
2057 DestroyTileManager(); | 2060 DestroyTileManager(); |
2058 resource_provider_.reset(); | 2061 resource_provider_.reset(); |
2059 output_surface_.reset(); | 2062 output_surface_.reset(); |
2060 | 2063 |
2061 if (!output_surface->BindToClient(this)) | 2064 if (!output_surface->BindToClient(this)) |
2062 return false; | 2065 return false; |
2063 | 2066 |
2064 output_surface_ = output_surface.Pass(); | 2067 output_surface_ = output_surface.Pass(); |
2068 | |
2069 // There will not be anything to draw here, so set high res | |
2070 // to avoid checkerboards, typically when we are recovering | |
2071 // from lost context. | |
2072 active_tree_->SetRequiresHighResToDraw(); | |
2073 | |
2065 have_valid_output_surface_ = true; | 2074 have_valid_output_surface_ = true; |
2066 resource_provider_ = | 2075 resource_provider_ = |
2067 ResourceProvider::Create(output_surface_.get(), | 2076 ResourceProvider::Create(output_surface_.get(), |
2068 shared_bitmap_manager_, | 2077 shared_bitmap_manager_, |
2069 settings_.highp_threshold_min, | 2078 settings_.highp_threshold_min, |
2070 settings_.use_rgba_4444_textures, | 2079 settings_.use_rgba_4444_textures, |
2071 settings_.texture_id_allocation_chunk_size, | 2080 settings_.texture_id_allocation_chunk_size, |
2072 settings_.use_distance_field_text); | 2081 settings_.use_distance_field_text); |
2073 | 2082 |
2074 if (output_surface_->capabilities().deferred_gl_initialization) | 2083 if (output_surface_->capabilities().deferred_gl_initialization) |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3348 } | 3357 } |
3349 | 3358 |
3350 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3359 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3351 std::vector<PictureLayerImpl*>::iterator it = | 3360 std::vector<PictureLayerImpl*>::iterator it = |
3352 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3361 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3353 DCHECK(it != picture_layers_.end()); | 3362 DCHECK(it != picture_layers_.end()); |
3354 picture_layers_.erase(it); | 3363 picture_layers_.erase(it); |
3355 } | 3364 } |
3356 | 3365 |
3357 } // namespace cc | 3366 } // namespace cc |
OLD | NEW |