| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 size_t max_transfer_buffer_usage_bytes = | 145 size_t max_transfer_buffer_usage_bytes = |
| 146 ms_per_frame * kMaxBytesUploadedPerMs; | 146 ms_per_frame * kMaxBytesUploadedPerMs; |
| 147 | 147 |
| 148 // The context may request a lower limit based on the device capabilities. | 148 // The context may request a lower limit based on the device capabilities. |
| 149 return std::min(context_capabilities.max_transfer_buffer_usage_bytes, | 149 return std::min(context_capabilities.max_transfer_buffer_usage_bytes, |
| 150 max_transfer_buffer_usage_bytes); | 150 max_transfer_buffer_usage_bytes); |
| 151 } | 151 } |
| 152 | 152 |
| 153 unsigned GetMapImageTextureTarget( | 153 unsigned GetMapImageTextureTarget( |
| 154 const ContextProvider::Capabilities& context_capabilities) { | 154 const ContextProvider::Capabilities& context_capabilities) { |
| 155 // TODO(reveman): This should be a setting passed to the compositor instead |
| 156 // of hard-coded here. The target that need to be used depends on our choice |
| 157 // of GpuMemoryBuffer type. Note: SURFACE_TEXTURE needs EXTERNAL_OES, |
| 158 // IO_SURFACE needs RECTANGLE_ARB. crbug.com/431059 |
| 159 #if defined(OS_ANDROID) |
| 155 if (context_capabilities.gpu.egl_image_external) | 160 if (context_capabilities.gpu.egl_image_external) |
| 156 return GL_TEXTURE_EXTERNAL_OES; | 161 return GL_TEXTURE_EXTERNAL_OES; |
| 162 #endif |
| 157 if (context_capabilities.gpu.texture_rectangle) | 163 if (context_capabilities.gpu.texture_rectangle) |
| 158 return GL_TEXTURE_RECTANGLE_ARB; | 164 return GL_TEXTURE_RECTANGLE_ARB; |
| 159 | 165 |
| 160 return GL_TEXTURE_2D; | 166 return GL_TEXTURE_2D; |
| 161 } | 167 } |
| 162 | 168 |
| 163 size_t GetMaxStagingResourceCount() { | 169 size_t GetMaxStagingResourceCount() { |
| 164 // Upper bound for number of staging resource to allow. | 170 // Upper bound for number of staging resource to allow. |
| 165 return 32; | 171 return 32; |
| 166 } | 172 } |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 client_->RenewTreePriority(); | 1873 client_->RenewTreePriority(); |
| 1868 | 1874 |
| 1869 client_->OnCanDrawStateChanged(CanDraw()); | 1875 client_->OnCanDrawStateChanged(CanDraw()); |
| 1870 client_->DidActivateSyncTree(); | 1876 client_->DidActivateSyncTree(); |
| 1871 if (!tree_activation_callback_.is_null()) | 1877 if (!tree_activation_callback_.is_null()) |
| 1872 tree_activation_callback_.Run(); | 1878 tree_activation_callback_.Run(); |
| 1873 | 1879 |
| 1874 if (debug_state_.continuous_painting) { | 1880 if (debug_state_.continuous_painting) { |
| 1875 const RenderingStats& stats = | 1881 const RenderingStats& stats = |
| 1876 rendering_stats_instrumentation_->GetRenderingStats(); | 1882 rendering_stats_instrumentation_->GetRenderingStats(); |
| 1877 paint_time_counter_->SavePaintTime(stats.main_stats.paint_time + | 1883 // TODO(hendrikw): This requires a different metric when we commit directly |
| 1878 stats.main_stats.record_time + | 1884 // to the active tree. See crbug.com/429311. |
| 1879 stats.impl_stats.rasterize_time); | 1885 paint_time_counter_->SavePaintTime( |
| 1886 stats.impl_stats.commit_to_activate_duration.GetLastTimeDelta() + |
| 1887 stats.impl_stats.draw_duration.GetLastTimeDelta()); |
| 1880 } | 1888 } |
| 1881 | 1889 |
| 1882 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | 1890 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
| 1883 DCHECK(active_tree_->root_layer()); | 1891 DCHECK(active_tree_->root_layer()); |
| 1884 | 1892 |
| 1885 scoped_ptr<PageScaleAnimation> page_scale_animation = | 1893 scoped_ptr<PageScaleAnimation> page_scale_animation = |
| 1886 active_tree_->TakePageScaleAnimation(); | 1894 active_tree_->TakePageScaleAnimation(); |
| 1887 if (page_scale_animation) { | 1895 if (page_scale_animation) { |
| 1888 page_scale_animation_ = page_scale_animation.Pass(); | 1896 page_scale_animation_ = page_scale_animation.Pass(); |
| 1889 SetNeedsAnimate(); | 1897 SetNeedsAnimate(); |
| (...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 } | 3522 } |
| 3515 | 3523 |
| 3516 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3524 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3517 std::vector<PictureLayerImpl*>::iterator it = | 3525 std::vector<PictureLayerImpl*>::iterator it = |
| 3518 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3526 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3519 DCHECK(it != picture_layers_.end()); | 3527 DCHECK(it != picture_layers_.end()); |
| 3520 picture_layers_.erase(it); | 3528 picture_layers_.erase(it); |
| 3521 } | 3529 } |
| 3522 | 3530 |
| 3523 } // namespace cc | 3531 } // namespace cc |
| OLD | NEW |