| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/content_layer.h" | 5 #include "cc/layers/content_layer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 bool ContentLayer::HasDrawableContent() const { | 51 bool ContentLayer::HasDrawableContent() const { |
| 52 return client_ && TiledLayer::HasDrawableContent(); | 52 return client_ && TiledLayer::HasDrawableContent(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ContentLayer::SetLayerTreeHost(LayerTreeHost* host) { | 55 void ContentLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 56 TiledLayer::SetLayerTreeHost(host); | 56 TiledLayer::SetLayerTreeHost(host); |
| 57 | 57 |
| 58 if (!updater_.get()) | 58 if (!updater_.get()) |
| 59 return; | 59 return; |
| 60 | |
| 61 if (host) { | |
| 62 updater_->set_rendering_stats_instrumentation( | |
| 63 host->rendering_stats_instrumentation()); | |
| 64 } else { | |
| 65 updater_->set_rendering_stats_instrumentation(nullptr); | |
| 66 } | |
| 67 } | 60 } |
| 68 | 61 |
| 69 void ContentLayer::SetTexturePriorities( | 62 void ContentLayer::SetTexturePriorities( |
| 70 const PriorityCalculator& priority_calc) { | 63 const PriorityCalculator& priority_calc) { |
| 71 // Update the tile data before creating all the layer's tiles. | 64 // Update the tile data before creating all the layer's tiles. |
| 72 UpdateTileSizeAndTilingOption(); | 65 UpdateTileSizeAndTilingOption(); |
| 73 | 66 |
| 74 TiledLayer::SetTexturePriorities(priority_calc); | 67 TiledLayer::SetTexturePriorities(priority_calc); |
| 75 } | 68 } |
| 76 | 69 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 101 return; | 94 return; |
| 102 scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_); | 95 scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_); |
| 103 if (layer_tree_host()->settings().per_tile_painting_enabled) { | 96 if (layer_tree_host()->settings().per_tile_painting_enabled) { |
| 104 updater_ = BitmapSkPictureContentLayerUpdater::Create( | 97 updater_ = BitmapSkPictureContentLayerUpdater::Create( |
| 105 painter.Pass(), | 98 painter.Pass(), |
| 106 rendering_stats_instrumentation(), | 99 rendering_stats_instrumentation(), |
| 107 id()); | 100 id()); |
| 108 } else { | 101 } else { |
| 109 updater_ = BitmapContentLayerUpdater::Create( | 102 updater_ = BitmapContentLayerUpdater::Create( |
| 110 painter.Pass(), | 103 painter.Pass(), |
| 111 rendering_stats_instrumentation(), | |
| 112 id()); | 104 id()); |
| 113 } | 105 } |
| 114 updater_->SetOpaque(contents_opaque()); | 106 updater_->SetOpaque(contents_opaque()); |
| 115 if (client_) | 107 if (client_) |
| 116 updater_->SetFillsBoundsCompletely(client_->FillsBoundsCompletely()); | 108 updater_->SetFillsBoundsCompletely(client_->FillsBoundsCompletely()); |
| 117 updater_->SetBackgroundColor(background_color()); | 109 updater_->SetBackgroundColor(background_color()); |
| 118 | 110 |
| 119 SetTextureFormat( | 111 SetTextureFormat( |
| 120 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 112 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
| 121 } | 113 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return picture; | 147 return picture; |
| 156 } | 148 } |
| 157 | 149 |
| 158 void ContentLayer::OnOutputSurfaceCreated() { | 150 void ContentLayer::OnOutputSurfaceCreated() { |
| 159 SetTextureFormat( | 151 SetTextureFormat( |
| 160 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 152 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
| 161 TiledLayer::OnOutputSurfaceCreated(); | 153 TiledLayer::OnOutputSurfaceCreated(); |
| 162 } | 154 } |
| 163 | 155 |
| 164 } // namespace cc | 156 } // namespace cc |
| OLD | NEW |