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

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

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool using_egl_image; 80 bool using_egl_image;
81 bool allow_partial_texture_updates; 81 bool allow_partial_texture_updates;
82 bool using_offscreen_context3d; 82 bool using_offscreen_context3d;
83 int max_texture_size; 83 int max_texture_size;
84 bool avoid_pow2_textures; 84 bool avoid_pow2_textures;
85 bool using_map_image; 85 bool using_map_image;
86 bool using_shared_memory_resources; 86 bool using_shared_memory_resources;
87 bool using_discard_framebuffer; 87 bool using_discard_framebuffer;
88 }; 88 };
89 89
90 struct CC_EXPORT UIResourceRequest { 90 class CC_EXPORT UIResourceRequest {
91 public:
91 enum UIResourceRequestType { 92 enum UIResourceRequestType {
92 UIResourceCreate, 93 UIResourceCreate,
93 UIResourceDelete, 94 UIResourceDelete,
94 UIResourceInvalidRequest 95 UIResourceInvalidRequest
95 }; 96 };
96 97
97 UIResourceRequest(); 98 UIResourceRequest(UIResourceRequestType type, UIResourceId id);
99 UIResourceRequest(UIResourceRequestType type,
100 UIResourceId id,
101 const UIResourceBitmap& bitmap);
102 UIResourceRequest(const UIResourceRequest& request);
103
98 ~UIResourceRequest(); 104 ~UIResourceRequest();
99 UIResourceRequestType type; 105
100 UIResourceId id; 106 UIResourceRequestType GetType() const { return type_; }
101 scoped_refptr<UIResourceBitmap> bitmap; 107 UIResourceId GetId() const { return id_; }
108 UIResourceBitmap GetBitmap() const {
109 DCHECK(bitmap_);
110 return *bitmap_.get();
111 }
112
113 UIResourceRequest& operator=(const UIResourceRequest& request);
114
115 private:
116 UIResourceRequestType type_;
117 UIResourceId id_;
118 scoped_ptr<UIResourceBitmap> bitmap_;
102 }; 119 };
103 120
104 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { 121 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
105 public: 122 public:
106 static scoped_ptr<LayerTreeHost> Create( 123 static scoped_ptr<LayerTreeHost> Create(
107 LayerTreeHostClient* client, 124 LayerTreeHostClient* client,
108 const LayerTreeSettings& settings, 125 const LayerTreeSettings& settings,
109 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 126 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
110 virtual ~LayerTreeHost(); 127 virtual ~LayerTreeHost();
111 128
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // parameter of the interface is a single boolean, which indicates whether the 305 // parameter of the interface is a single boolean, which indicates whether the
289 // resource has been lost or not. CreateUIResource returns an Id of the 306 // resource has been lost or not. CreateUIResource returns an Id of the
290 // resource, which is always positive. 307 // resource, which is always positive.
291 virtual UIResourceId CreateUIResource(UIResourceClient* client); 308 virtual UIResourceId CreateUIResource(UIResourceClient* client);
292 // Deletes a UI resource. May safely be called more than once. 309 // Deletes a UI resource. May safely be called more than once.
293 virtual void DeleteUIResource(UIResourceId id); 310 virtual void DeleteUIResource(UIResourceId id);
294 // Put the recreation of all UI resources into the resource queue after they 311 // Put the recreation of all UI resources into the resource queue after they
295 // were evicted on the impl thread. 312 // were evicted on the impl thread.
296 void RecreateUIResources(); 313 void RecreateUIResources();
297 314
315 virtual gfx::Size GetUIResourceSize(UIResourceId id) const;
316
298 bool UsingSharedMemoryResources(); 317 bool UsingSharedMemoryResources();
299 int id() const { return tree_id_; } 318 int id() const { return tree_id_; }
300 319
301 protected: 320 protected:
302 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 321 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
303 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 322 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
304 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 323 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
305 324
306 private: 325 private:
307 bool InitializeProxy(scoped_ptr<Proxy> proxy); 326 bool InitializeProxy(scoped_ptr<Proxy> proxy);
(...skipping 16 matching lines...) Expand all
324 void PrioritizeTextures( 343 void PrioritizeTextures(
325 const RenderSurfaceLayerList& render_surface_layer_list, 344 const RenderSurfaceLayerList& render_surface_layer_list,
326 OverdrawMetrics* metrics); 345 OverdrawMetrics* metrics);
327 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 346 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
328 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); 347 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list);
329 size_t CalculateMemoryForRenderSurfaces( 348 size_t CalculateMemoryForRenderSurfaces(
330 const RenderSurfaceLayerList& update_list); 349 const RenderSurfaceLayerList& update_list);
331 350
332 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 351 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
333 352
334 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; 353 struct UIResourceClientData {
354 UIResourceClient* client;
355 gfx::Size size;
356 };
357
358 typedef base::hash_map<UIResourceId, UIResourceClientData>
359 UIResourceClientMap;
335 UIResourceClientMap ui_resource_client_map_; 360 UIResourceClientMap ui_resource_client_map_;
336 int next_ui_resource_id_; 361 int next_ui_resource_id_;
337 362
338 typedef std::list<UIResourceRequest> UIResourceRequestQueue; 363 typedef std::list<UIResourceRequest> UIResourceRequestQueue;
339 UIResourceRequestQueue ui_resource_request_queue_; 364 UIResourceRequestQueue ui_resource_request_queue_;
340 365
341 void CalculateLCDTextMetricsCallback(Layer* layer); 366 void CalculateLCDTextMetricsCallback(Layer* layer);
342 367
343 bool animating_; 368 bool animating_;
344 bool needs_full_tree_sync_; 369 bool needs_full_tree_sync_;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 scoped_refptr<Layer> page_scale_layer_; 452 scoped_refptr<Layer> page_scale_layer_;
428 scoped_refptr<Layer> inner_viewport_scroll_layer_; 453 scoped_refptr<Layer> inner_viewport_scroll_layer_;
429 scoped_refptr<Layer> outer_viewport_scroll_layer_; 454 scoped_refptr<Layer> outer_viewport_scroll_layer_;
430 455
431 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 456 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
432 }; 457 };
433 458
434 } // namespace cc 459 } // namespace cc
435 460
436 #endif // CC_TREES_LAYER_TREE_HOST_H_ 461 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698