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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "cc/trees/tree_synchronizer.h" | 40 #include "cc/trees/tree_synchronizer.h" |
41 #include "ui/gfx/size_conversions.h" | 41 #include "ui/gfx/size_conversions.h" |
42 | 42 |
43 namespace { | 43 namespace { |
44 static int s_num_layer_tree_instances; | 44 static int s_num_layer_tree_instances; |
45 } | 45 } |
46 | 46 |
47 namespace cc { | 47 namespace cc { |
48 | 48 |
49 RendererCapabilities::RendererCapabilities() | 49 RendererCapabilities::RendererCapabilities() |
50 : best_texture_format(0), | 50 : best_texture_format(RGBA_8888), |
51 using_partial_swap(false), | 51 using_partial_swap(false), |
52 using_set_visibility(false), | 52 using_set_visibility(false), |
53 using_egl_image(false), | 53 using_egl_image(false), |
54 allow_partial_texture_updates(false), | 54 allow_partial_texture_updates(false), |
55 using_offscreen_context3d(false), | 55 using_offscreen_context3d(false), |
56 max_texture_size(0), | 56 max_texture_size(0), |
57 avoid_pow2_textures(false), | 57 avoid_pow2_textures(false), |
58 using_map_image(false), | 58 using_map_image(false), |
59 using_shared_memory_resources(false), | 59 using_shared_memory_resources(false), |
60 using_discard_framebuffer(false) {} | 60 using_discard_framebuffer(false) {} |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 settings_.max_partial_texture_updates, | 190 settings_.max_partial_texture_updates, |
191 proxy_->MaxPartialTextureUpdates()); | 191 proxy_->MaxPartialTextureUpdates()); |
192 } | 192 } |
193 settings_.max_partial_texture_updates = max_partial_texture_updates; | 193 settings_.max_partial_texture_updates = max_partial_texture_updates; |
194 | 194 |
195 if (!contents_texture_manager_ && | 195 if (!contents_texture_manager_ && |
196 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { | 196 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { |
197 contents_texture_manager_ = | 197 contents_texture_manager_ = |
198 PrioritizedResourceManager::Create(proxy_.get()); | 198 PrioritizedResourceManager::Create(proxy_.get()); |
199 surface_memory_placeholder_ = | 199 surface_memory_placeholder_ = |
200 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); | 200 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); |
201 } | 201 } |
202 | 202 |
203 client_->DidInitializeOutputSurface(true); | 203 client_->DidInitializeOutputSurface(true); |
204 return CreateSucceeded; | 204 return CreateSucceeded; |
205 } | 205 } |
206 | 206 |
207 // Failure path. | 207 // Failure path. |
208 | 208 |
209 client_->DidFailToInitializeOutputSurface(); | 209 client_->DidFailToInitializeOutputSurface(); |
210 | 210 |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 size_t contents_texture_bytes = 0; | 910 size_t contents_texture_bytes = 0; |
911 | 911 |
912 // Start iteration at 1 to skip the root surface as it does not have a texture | 912 // Start iteration at 1 to skip the root surface as it does not have a texture |
913 // cost. | 913 // cost. |
914 for (size_t i = 1; i < update_list.size(); ++i) { | 914 for (size_t i = 1; i < update_list.size(); ++i) { |
915 Layer* render_surface_layer = update_list.at(i); | 915 Layer* render_surface_layer = update_list.at(i); |
916 RenderSurface* render_surface = render_surface_layer->render_surface(); | 916 RenderSurface* render_surface = render_surface_layer->render_surface(); |
917 | 917 |
918 size_t bytes = | 918 size_t bytes = |
919 Resource::MemorySizeBytes(render_surface->content_rect().size(), | 919 Resource::MemorySizeBytes(render_surface->content_rect().size(), |
920 GL_RGBA); | 920 RGBA_8888); |
921 contents_texture_bytes += bytes; | 921 contents_texture_bytes += bytes; |
922 | 922 |
923 if (render_surface_layer->background_filters().IsEmpty()) | 923 if (render_surface_layer->background_filters().IsEmpty()) |
924 continue; | 924 continue; |
925 | 925 |
926 if (bytes > max_background_texture_bytes) | 926 if (bytes > max_background_texture_bytes) |
927 max_background_texture_bytes = bytes; | 927 max_background_texture_bytes = bytes; |
928 if (!readback_bytes) { | 928 if (!readback_bytes) { |
929 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, | 929 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, |
930 GL_RGBA); | 930 RGBA_8888); |
931 } | 931 } |
932 } | 932 } |
933 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; | 933 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; |
934 } | 934 } |
935 | 935 |
936 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, | 936 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, |
937 ResourceUpdateQueue* queue, | 937 ResourceUpdateQueue* queue, |
938 bool* did_paint_content, | 938 bool* did_paint_content, |
939 bool* need_more_updates) { | 939 bool* need_more_updates) { |
940 // Note: Masks and replicas only exist for layers that own render surfaces. If | 940 // Note: Masks and replicas only exist for layers that own render surfaces. If |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 UIResourceRequest request; | 1184 UIResourceRequest request; |
1185 request.type = UIResourceRequest::UIResourceCreate; | 1185 request.type = UIResourceRequest::UIResourceCreate; |
1186 request.id = uid; | 1186 request.id = uid; |
1187 request.bitmap = iter->second->GetBitmap(uid, resource_lost); | 1187 request.bitmap = iter->second->GetBitmap(uid, resource_lost); |
1188 DCHECK(request.bitmap.get()); | 1188 DCHECK(request.bitmap.get()); |
1189 ui_resource_request_queue_.push_back(request); | 1189 ui_resource_request_queue_.push_back(request); |
1190 } | 1190 } |
1191 } | 1191 } |
1192 | 1192 |
1193 } // namespace cc | 1193 } // namespace cc |
OLD | NEW |