Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: trunk/src/cc/trees/layer_tree_host.h

Issue 23740010: Revert 223162 "Update the nine patch layer to use UI resources" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/cc/test/layer_tree_json_parser.cc ('k') | trunk/src/cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CC_TREES_LAYER_TREE_HOST_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_
6 #define CC_TREES_LAYER_TREE_HOST_H_ 6 #define CC_TREES_LAYER_TREE_HOST_H_
7 7
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 #include <vector> 10 #include <vector>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool using_egl_image; 79 bool using_egl_image;
80 bool allow_partial_texture_updates; 80 bool allow_partial_texture_updates;
81 bool using_offscreen_context3d; 81 bool using_offscreen_context3d;
82 int max_texture_size; 82 int max_texture_size;
83 bool avoid_pow2_textures; 83 bool avoid_pow2_textures;
84 bool using_map_image; 84 bool using_map_image;
85 bool using_shared_memory_resources; 85 bool using_shared_memory_resources;
86 bool using_discard_framebuffer; 86 bool using_discard_framebuffer;
87 }; 87 };
88 88
89 class CC_EXPORT UIResourceRequest { 89 struct CC_EXPORT UIResourceRequest {
90 public:
91 enum UIResourceRequestType { 90 enum UIResourceRequestType {
92 UIResourceCreate, 91 UIResourceCreate,
93 UIResourceDelete, 92 UIResourceDelete,
94 UIResourceInvalidRequest 93 UIResourceInvalidRequest
95 }; 94 };
96 95
97 UIResourceRequest(UIResourceRequestType type, UIResourceId id); 96 UIResourceRequest();
98 UIResourceRequest(UIResourceRequestType type,
99 UIResourceId id,
100 const UIResourceBitmap& bitmap);
101 UIResourceRequest(const UIResourceRequest& request);
102
103 ~UIResourceRequest(); 97 ~UIResourceRequest();
104 98 UIResourceRequestType type;
105 UIResourceRequestType GetType() const { return type_; } 99 UIResourceId id;
106 UIResourceId GetId() const { return id_; } 100 scoped_refptr<UIResourceBitmap> bitmap;
107 UIResourceBitmap GetBitmap() const {
108 DCHECK(bitmap_);
109 return *bitmap_.get();
110 }
111
112 UIResourceRequest& operator=(const UIResourceRequest& request);
113
114 private:
115 UIResourceRequestType type_;
116 UIResourceId id_;
117 scoped_ptr<UIResourceBitmap> bitmap_;
118 }; 101 };
119 102
120 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { 103 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
121 public: 104 public:
122 static scoped_ptr<LayerTreeHost> Create( 105 static scoped_ptr<LayerTreeHost> Create(
123 LayerTreeHostClient* client, 106 LayerTreeHostClient* client,
124 const LayerTreeSettings& settings, 107 const LayerTreeSettings& settings,
125 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 108 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
126 virtual ~LayerTreeHost(); 109 virtual ~LayerTreeHost();
127 110
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // parameter of the interface is a single boolean, which indicates whether the 283 // parameter of the interface is a single boolean, which indicates whether the
301 // resource has been lost or not. CreateUIResource returns an Id of the 284 // resource has been lost or not. CreateUIResource returns an Id of the
302 // resource, which is always positive. 285 // resource, which is always positive.
303 virtual UIResourceId CreateUIResource(UIResourceClient* client); 286 virtual UIResourceId CreateUIResource(UIResourceClient* client);
304 // Deletes a UI resource. May safely be called more than once. 287 // Deletes a UI resource. May safely be called more than once.
305 virtual void DeleteUIResource(UIResourceId id); 288 virtual void DeleteUIResource(UIResourceId id);
306 // Put the recreation of all UI resources into the resource queue after they 289 // Put the recreation of all UI resources into the resource queue after they
307 // were evicted on the impl thread. 290 // were evicted on the impl thread.
308 void RecreateUIResources(); 291 void RecreateUIResources();
309 292
310 virtual gfx::Size GetUIResourceSize(UIResourceId id) const;
311
312 bool UsingSharedMemoryResources(); 293 bool UsingSharedMemoryResources();
313 int id() const { return tree_id_; } 294 int id() const { return tree_id_; }
314 295
315 protected: 296 protected:
316 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 297 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
317 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 298 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
318 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 299 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
319 300
320 private: 301 private:
321 bool InitializeProxy(scoped_ptr<Proxy> proxy); 302 bool InitializeProxy(scoped_ptr<Proxy> proxy);
(...skipping 16 matching lines...) Expand all
338 void PrioritizeTextures( 319 void PrioritizeTextures(
339 const RenderSurfaceLayerList& render_surface_layer_list, 320 const RenderSurfaceLayerList& render_surface_layer_list,
340 OverdrawMetrics* metrics); 321 OverdrawMetrics* metrics);
341 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 322 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
342 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); 323 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list);
343 size_t CalculateMemoryForRenderSurfaces( 324 size_t CalculateMemoryForRenderSurfaces(
344 const RenderSurfaceLayerList& update_list); 325 const RenderSurfaceLayerList& update_list);
345 326
346 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 327 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
347 328
348 struct UIResourceClientData { 329 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap;
349 UIResourceClient* client;
350 gfx::Size size;
351 };
352
353 typedef base::hash_map<UIResourceId, UIResourceClientData>
354 UIResourceClientMap;
355 UIResourceClientMap ui_resource_client_map_; 330 UIResourceClientMap ui_resource_client_map_;
356 int next_ui_resource_id_; 331 int next_ui_resource_id_;
357 332
358 typedef std::list<UIResourceRequest> UIResourceRequestQueue; 333 typedef std::list<UIResourceRequest> UIResourceRequestQueue;
359 UIResourceRequestQueue ui_resource_request_queue_; 334 UIResourceRequestQueue ui_resource_request_queue_;
360 335
361 void CalculateLCDTextMetricsCallback(Layer* layer); 336 void CalculateLCDTextMetricsCallback(Layer* layer);
362 337
363 bool animating_; 338 bool animating_;
364 bool needs_full_tree_sync_; 339 bool needs_full_tree_sync_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 }; 418 };
444 LCDTextMetrics lcd_text_metrics_; 419 LCDTextMetrics lcd_text_metrics_;
445 int tree_id_; 420 int tree_id_;
446 421
447 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 422 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
448 }; 423 };
449 424
450 } // namespace cc 425 } // namespace cc
451 426
452 #endif // CC_TREES_LAYER_TREE_HOST_H_ 427 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW
« no previous file with comments | « trunk/src/cc/test/layer_tree_json_parser.cc ('k') | trunk/src/cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698