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

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

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
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 <vector> 9 #include <vector>
10 #include <list>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "cc/animation/animation_events.h" 19 #include "cc/animation/animation_events.h"
19 #include "cc/base/cc_export.h" 20 #include "cc/base/cc_export.h"
20 #include "cc/base/scoped_ptr_vector.h" 21 #include "cc/base/scoped_ptr_vector.h"
21 #include "cc/input/input_handler.h" 22 #include "cc/input/input_handler.h"
22 #include "cc/input/scrollbar.h" 23 #include "cc/input/scrollbar.h"
23 #include "cc/input/top_controls_state.h" 24 #include "cc/input/top_controls_state.h"
24 #include "cc/layers/layer_lists.h" 25 #include "cc/layers/layer_lists.h"
25 #include "cc/output/output_surface.h" 26 #include "cc/output/output_surface.h"
27 #include "cc/resources/ui_resource_manager.h"
26 #include "cc/scheduler/rate_limiter.h" 28 #include "cc/scheduler/rate_limiter.h"
27 #include "cc/trees/layer_tree_host_client.h" 29 #include "cc/trees/layer_tree_host_client.h"
28 #include "cc/trees/layer_tree_host_common.h" 30 #include "cc/trees/layer_tree_host_common.h"
29 #include "cc/trees/layer_tree_settings.h" 31 #include "cc/trees/layer_tree_settings.h"
30 #include "cc/trees/occlusion_tracker.h" 32 #include "cc/trees/occlusion_tracker.h"
31 #include "cc/trees/proxy.h" 33 #include "cc/trees/proxy.h"
32 #include "skia/ext/refptr.h" 34 #include "skia/ext/refptr.h"
33 #include "third_party/skia/include/core/SkColor.h" 35 #include "third_party/skia/include/core/SkColor.h"
34 #include "third_party/skia/include/core/SkPicture.h" 36 #include "third_party/skia/include/core/SkPicture.h"
35 #include "ui/base/latency_info.h" 37 #include "ui/base/latency_info.h"
(...skipping 19 matching lines...) Expand all
55 class Layer; 57 class Layer;
56 class LayerTreeHostImpl; 58 class LayerTreeHostImpl;
57 class LayerTreeHostImplClient; 59 class LayerTreeHostImplClient;
58 class PrioritizedResourceManager; 60 class PrioritizedResourceManager;
59 class PrioritizedResource; 61 class PrioritizedResource;
60 class Region; 62 class Region;
61 class RenderingStatsInstrumentation; 63 class RenderingStatsInstrumentation;
62 class ResourceProvider; 64 class ResourceProvider;
63 class ResourceUpdateQueue; 65 class ResourceUpdateQueue;
64 class TopControlsManager; 66 class TopControlsManager;
67
aelias_OOO_until_Jul13 2013/07/10 23:07:22 nit: unnecessary spacing change
powei 2013/07/11 23:54:44 Done.
65 struct RenderingStats; 68 struct RenderingStats;
66 struct ScrollAndScaleSet; 69 struct ScrollAndScaleSet;
67 70
68 // Provides information on an Impl's rendering capabilities back to the 71 // Provides information on an Impl's rendering capabilities back to the
69 // LayerTreeHost. 72 // LayerTreeHost.
70 struct CC_EXPORT RendererCapabilities { 73 struct CC_EXPORT RendererCapabilities {
71 RendererCapabilities(); 74 RendererCapabilities();
72 ~RendererCapabilities(); 75 ~RendererCapabilities();
73 76
74 unsigned best_texture_format; 77 unsigned best_texture_format;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 251
249 skia::RefPtr<SkPicture> CapturePicture(); 252 skia::RefPtr<SkPicture> CapturePicture();
250 253
251 bool BlocksPendingCommit() const; 254 bool BlocksPendingCommit() const;
252 255
253 // Obtains a thorough dump of the LayerTreeHost as a value. 256 // Obtains a thorough dump of the LayerTreeHost as a value.
254 scoped_ptr<base::Value> AsValue() const; 257 scoped_ptr<base::Value> AsValue() const;
255 258
256 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } 259 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
257 260
261 // UI Resource management
262 UIResourceId CreateUIResource(scoped_refptr<UIResourceBitmap> bitmap,
263 UIResourceManagerClient* client);
264 void UpdateUIResource(UIResourceId uid,
aelias_OOO_until_Jul13 2013/07/10 23:07:22 I think we can delete this for simplicity, there a
powei 2013/07/11 23:54:44 Done.
265 scoped_refptr<UIResourceBitmap> bitmap,
266 gfx::Rect update_region);
267 // Deletes a UI resource. May safely be called more than once.
268 void DeleteUIResource(UIResourceId id);
269 void UIResourceReady(UIResourceId id);
aelias_OOO_until_Jul13 2013/07/10 23:07:22 Put these two into the "// LayerTreeHost interface
powei 2013/07/11 23:54:44 On 2013/07/10 23:07:22, aelias wrote: > Put these
270 void UIResourceLost(UIResourceId id);
271
258 protected: 272 protected:
259 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 273 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
260 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 274 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
261 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 275 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
262 276
263 private: 277 private:
264 bool InitializeProxy(scoped_ptr<Proxy> proxy); 278 bool InitializeProxy(scoped_ptr<Proxy> proxy);
265 279
266 bool PaintLayerContents(const LayerList& render_surface_layer_list, 280 bool PaintLayerContents(const LayerList& render_surface_layer_list,
267 ResourceUpdateQueue* quue); 281 ResourceUpdateQueue* quue);
268 bool PaintMasksForRenderSurface(Layer* render_surface_layer, 282 bool PaintMasksForRenderSurface(Layer* render_surface_layer,
269 ResourceUpdateQueue* queue); 283 ResourceUpdateQueue* queue);
270 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); 284 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue);
271 void UpdateHudLayer(); 285 void UpdateHudLayer();
272 void TriggerPrepaint(); 286 void TriggerPrepaint();
273 287
274 void ReduceMemoryUsage(); 288 void ReduceMemoryUsage();
275 289
276 void PrioritizeTextures(const LayerList& render_surface_layer_list, 290 void PrioritizeTextures(const LayerList& render_surface_layer_list,
277 OverdrawMetrics* metrics); 291 OverdrawMetrics* metrics);
278 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 292 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
279 void SetPrioritiesForLayers(const LayerList& update_list); 293 void SetPrioritiesForLayers(const LayerList& update_list);
280 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list); 294 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list);
281 295
282 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 296 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
283 297
298 typedef base::hash_map<UIResourceId, UIResourceManagerClient* >
299 UIResourceClientMap;
300 UIResourceClientMap ui_resource_client_map_;
301 int ui_resource_counter_;
302
303 struct UIResourceRequest {
304 UIResourceId id;
305 scoped_refptr<UIResourceBitmap> bitmap;
306 bool async;
307 };
308 typedef std::list<UIResourceRequest> UIResourceRequestQueue;
309 UIResourceRequestQueue ui_resource_request_queue_;
310
311 typedef std::list<UIResourceId> UIResourceRemoveQueue;
312 UIResourceRemoveQueue ui_resource_remove_queue_;
313
284 void CalculateLCDTextMetricsCallback(Layer* layer); 314 void CalculateLCDTextMetricsCallback(Layer* layer);
285 315
286 bool animating_; 316 bool animating_;
287 bool needs_full_tree_sync_; 317 bool needs_full_tree_sync_;
288 bool needs_filter_context_; 318 bool needs_filter_context_;
289 319
290 base::CancelableClosure prepaint_callback_; 320 base::CancelableClosure prepaint_callback_;
291 321
292 LayerTreeHostClient* client_; 322 LayerTreeHostClient* client_;
293 scoped_ptr<Proxy> proxy_; 323 scoped_ptr<Proxy> proxy_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 int64 total_num_cc_layers_will_use_lcd_text; 391 int64 total_num_cc_layers_will_use_lcd_text;
362 }; 392 };
363 LCDTextMetrics lcd_text_metrics_; 393 LCDTextMetrics lcd_text_metrics_;
364 394
365 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 395 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
366 }; 396 };
367 397
368 } // namespace cc 398 } // namespace cc
369 399
370 #endif // CC_TREES_LAYER_TREE_HOST_H_ 400 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698