Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 #include "cc/resources/texture_mailbox_deleter.h" | 55 #include "cc/resources/texture_mailbox_deleter.h" |
| 56 #include "cc/resources/ui_resource_bitmap.h" | 56 #include "cc/resources/ui_resource_bitmap.h" |
| 57 #include "cc/scheduler/delay_based_time_source.h" | 57 #include "cc/scheduler/delay_based_time_source.h" |
| 58 #include "cc/trees/damage_tracker.h" | 58 #include "cc/trees/damage_tracker.h" |
| 59 #include "cc/trees/layer_tree_host.h" | 59 #include "cc/trees/layer_tree_host.h" |
| 60 #include "cc/trees/layer_tree_host_common.h" | 60 #include "cc/trees/layer_tree_host_common.h" |
| 61 #include "cc/trees/layer_tree_impl.h" | 61 #include "cc/trees/layer_tree_impl.h" |
| 62 #include "cc/trees/occlusion_tracker.h" | 62 #include "cc/trees/occlusion_tracker.h" |
| 63 #include "cc/trees/single_thread_proxy.h" | 63 #include "cc/trees/single_thread_proxy.h" |
| 64 #include "cc/trees/tree_synchronizer.h" | 64 #include "cc/trees/tree_synchronizer.h" |
| 65 #include "gpu/command_buffer/client/gles2_interface.h" | |
| 65 #include "gpu/GLES2/gl2extchromium.h" | 66 #include "gpu/GLES2/gl2extchromium.h" |
| 66 #include "ui/gfx/frame_time.h" | 67 #include "ui/gfx/frame_time.h" |
| 67 #include "ui/gfx/size_conversions.h" | 68 #include "ui/gfx/size_conversions.h" |
| 68 #include "ui/gfx/vector2d_conversions.h" | 69 #include "ui/gfx/vector2d_conversions.h" |
| 69 | 70 |
| 71 using gpu::gles2::GLES2Interface; | |
| 72 | |
| 70 namespace { | 73 namespace { |
| 71 | 74 |
| 72 void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { | 75 void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { |
| 73 if (visible) { | 76 if (visible) { |
| 74 TRACE_EVENT_ASYNC_BEGIN1("webkit", | 77 TRACE_EVENT_ASYNC_BEGIN1("webkit", |
| 75 "LayerTreeHostImpl::SetVisible", | 78 "LayerTreeHostImpl::SetVisible", |
| 76 id, | 79 id, |
| 77 "LayerTreeHostImpl", | 80 "LayerTreeHostImpl", |
| 78 id); | 81 id); |
| 79 return; | 82 return; |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1345 // because they were exported. | 1348 // because they were exported. |
| 1346 if (tile_manager_) { | 1349 if (tile_manager_) { |
| 1347 DCHECK(resource_pool_); | 1350 DCHECK(resource_pool_); |
| 1348 | 1351 |
| 1349 resource_pool_->CheckBusyResources(); | 1352 resource_pool_->CheckBusyResources(); |
| 1350 resource_pool_->ReduceResourceUsage(); | 1353 resource_pool_->ReduceResourceUsage(); |
| 1351 } | 1354 } |
| 1352 // If we're not visible, we likely released resources, so we want to | 1355 // If we're not visible, we likely released resources, so we want to |
| 1353 // aggressively flush here to make sure those DeleteTextures make it to the | 1356 // aggressively flush here to make sure those DeleteTextures make it to the |
| 1354 // GPU process to free up the memory. | 1357 // GPU process to free up the memory. |
| 1355 if (resource_provider_ && !visible_) | 1358 if (output_surface_ && !visible_) { |
|
danakj
2014/07/10 17:01:44
you'll have to check that context_provider() is no
sohanjg
2014/07/11 16:43:32
Done.
| |
| 1356 resource_provider_->ShallowFlushIfSupported(); | 1359 output_surface_->context_provider()->ContextGL()->ShallowFlushCHROMIUM(); |
| 1360 } | |
| 1357 } | 1361 } |
| 1358 | 1362 |
| 1359 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { | 1363 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { |
| 1360 client_->OnCanDrawStateChanged(CanDraw()); | 1364 client_->OnCanDrawStateChanged(CanDraw()); |
| 1361 } | 1365 } |
| 1362 | 1366 |
| 1363 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1367 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| 1364 CompositorFrameMetadata metadata; | 1368 CompositorFrameMetadata metadata; |
| 1365 metadata.device_scale_factor = device_scale_factor_; | 1369 metadata.device_scale_factor = device_scale_factor_; |
| 1366 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); | 1370 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); |
| (...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3152 } | 3156 } |
| 3153 | 3157 |
| 3154 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3158 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3155 std::vector<PictureLayerImpl*>::iterator it = | 3159 std::vector<PictureLayerImpl*>::iterator it = |
| 3156 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3160 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3157 DCHECK(it != picture_layers_.end()); | 3161 DCHECK(it != picture_layers_.end()); |
| 3158 picture_layers_.erase(it); | 3162 picture_layers_.erase(it); |
| 3159 } | 3163 } |
| 3160 | 3164 |
| 3161 } // namespace cc | 3165 } // namespace cc |
| OLD | NEW |