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

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 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "cc/animation/animation_events.h" 18 #include "cc/animation/animation_events.h"
19 #include "cc/base/cc_export.h" 19 #include "cc/base/cc_export.h"
20 #include "cc/base/scoped_ptr_vector.h" 20 #include "cc/base/scoped_ptr_vector.h"
21 #include "cc/input/input_handler.h" 21 #include "cc/input/input_handler.h"
22 #include "cc/input/scrollbar.h" 22 #include "cc/input/scrollbar.h"
23 #include "cc/input/top_controls_state.h" 23 #include "cc/input/top_controls_state.h"
24 #include "cc/layers/layer_lists.h" 24 #include "cc/layers/layer_lists.h"
25 #include "cc/output/output_surface.h" 25 #include "cc/output/output_surface.h"
26 #include "cc/resources/ui_resource_manager.h"
26 #include "cc/scheduler/rate_limiter.h" 27 #include "cc/scheduler/rate_limiter.h"
27 #include "cc/trees/layer_tree_host_client.h" 28 #include "cc/trees/layer_tree_host_client.h"
28 #include "cc/trees/layer_tree_host_common.h" 29 #include "cc/trees/layer_tree_host_common.h"
29 #include "cc/trees/layer_tree_settings.h" 30 #include "cc/trees/layer_tree_settings.h"
30 #include "cc/trees/occlusion_tracker.h" 31 #include "cc/trees/occlusion_tracker.h"
31 #include "cc/trees/proxy.h" 32 #include "cc/trees/proxy.h"
32 #include "skia/ext/refptr.h" 33 #include "skia/ext/refptr.h"
33 #include "third_party/skia/include/core/SkColor.h" 34 #include "third_party/skia/include/core/SkColor.h"
34 #include "third_party/skia/include/core/SkPicture.h" 35 #include "third_party/skia/include/core/SkPicture.h"
35 #include "ui/base/latency_info.h" 36 #include "ui/base/latency_info.h"
(...skipping 19 matching lines...) Expand all
55 class Layer; 56 class Layer;
56 class LayerTreeHostImpl; 57 class LayerTreeHostImpl;
57 class LayerTreeHostImplClient; 58 class LayerTreeHostImplClient;
58 class PrioritizedResourceManager; 59 class PrioritizedResourceManager;
59 class PrioritizedResource; 60 class PrioritizedResource;
60 class Region; 61 class Region;
61 class RenderingStatsInstrumentation; 62 class RenderingStatsInstrumentation;
62 class ResourceProvider; 63 class ResourceProvider;
63 class ResourceUpdateQueue; 64 class ResourceUpdateQueue;
64 class TopControlsManager; 65 class TopControlsManager;
66
65 struct RenderingStats; 67 struct RenderingStats;
66 struct ScrollAndScaleSet; 68 struct ScrollAndScaleSet;
67 69
68 // Provides information on an Impl's rendering capabilities back to the 70 // Provides information on an Impl's rendering capabilities back to the
69 // LayerTreeHost. 71 // LayerTreeHost.
70 struct CC_EXPORT RendererCapabilities { 72 struct CC_EXPORT RendererCapabilities {
71 RendererCapabilities(); 73 RendererCapabilities();
72 ~RendererCapabilities(); 74 ~RendererCapabilities();
73 75
74 unsigned best_texture_format; 76 unsigned best_texture_format;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 250
249 skia::RefPtr<SkPicture> CapturePicture(); 251 skia::RefPtr<SkPicture> CapturePicture();
250 252
251 bool BlocksPendingCommit() const; 253 bool BlocksPendingCommit() const;
252 254
253 // Obtains a thorough dump of the LayerTreeHost as a value. 255 // Obtains a thorough dump of the LayerTreeHost as a value.
254 scoped_ptr<base::Value> AsValue() const; 256 scoped_ptr<base::Value> AsValue() const;
255 257
256 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } 258 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
257 259
260 // UI Resource management
261 UIResourceId CreateUIResource(scoped_refptr<UIResourceBitmap> bitmap,
262 UIResourceManagerClient* client);
263 void UpdateUIResource(UIResourceId uid,
264 scoped_refptr<UIResourceBitmap> bitmap,
265 gfx::Rect update_region);
266 // Deletes a UI resource. May safely be called more than once.
267 void DeleteUIResource(UIResourceId id);
268 void UIResourceReady(UIResourceId id);
enne (OOO) 2013/07/09 17:57:48 What does UIResourceReady mean? Does that mean tha
aelias_OOO_until_Jul13 2013/07/09 20:22:19 Yes, it means it's uploaded and ready to draw. Th
enne (OOO) 2013/07/09 20:32:52 Huh. I guess I'm just curious about what you woul
aelias_OOO_until_Jul13 2013/07/09 20:54:30 My thinking is that the impl-side will always bloc
269 void UIResourceLost(UIResourceId id);
enne (OOO) 2013/07/09 17:57:48 Do you think we'll ever want to lose just one reso
aelias_OOO_until_Jul13 2013/07/09 20:22:19 Since the only cause is lost context in the curren
270
258 protected: 271 protected:
259 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 272 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
260 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 273 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
261 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 274 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
262 275
263 private: 276 private:
264 bool InitializeProxy(scoped_ptr<Proxy> proxy); 277 bool InitializeProxy(scoped_ptr<Proxy> proxy);
265 278
266 bool PaintLayerContents(const LayerList& render_surface_layer_list, 279 bool PaintLayerContents(const LayerList& render_surface_layer_list,
267 ResourceUpdateQueue* quue); 280 ResourceUpdateQueue* quue);
268 bool PaintMasksForRenderSurface(Layer* render_surface_layer, 281 bool PaintMasksForRenderSurface(Layer* render_surface_layer,
269 ResourceUpdateQueue* queue); 282 ResourceUpdateQueue* queue);
270 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); 283 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue);
271 void UpdateHudLayer(); 284 void UpdateHudLayer();
272 void TriggerPrepaint(); 285 void TriggerPrepaint();
273 286
274 void ReduceMemoryUsage(); 287 void ReduceMemoryUsage();
275 288
276 void PrioritizeTextures(const LayerList& render_surface_layer_list, 289 void PrioritizeTextures(const LayerList& render_surface_layer_list,
277 OverdrawMetrics* metrics); 290 OverdrawMetrics* metrics);
278 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 291 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
279 void SetPrioritiesForLayers(const LayerList& update_list); 292 void SetPrioritiesForLayers(const LayerList& update_list);
280 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list); 293 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list);
281 294
282 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 295 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
283 296
297
298 typedef base::hash_map<UIResourceId, UIResourceManagerClient* >
299 UIResourceClientMap;
300 UIResourceClientMap ui_resource_client_map_;
301 int ui_resource_counter_;
302
303
284 void CalculateLCDTextMetricsCallback(Layer* layer); 304 void CalculateLCDTextMetricsCallback(Layer* layer);
285 305
286 bool animating_; 306 bool animating_;
287 bool needs_full_tree_sync_; 307 bool needs_full_tree_sync_;
288 bool needs_filter_context_; 308 bool needs_filter_context_;
289 309
290 base::CancelableClosure prepaint_callback_; 310 base::CancelableClosure prepaint_callback_;
291 311
292 LayerTreeHostClient* client_; 312 LayerTreeHostClient* client_;
293 scoped_ptr<Proxy> proxy_; 313 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; 381 int64 total_num_cc_layers_will_use_lcd_text;
362 }; 382 };
363 LCDTextMetrics lcd_text_metrics_; 383 LCDTextMetrics lcd_text_metrics_;
364 384
365 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 385 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
366 }; 386 };
367 387
368 } // namespace cc 388 } // namespace cc
369 389
370 #endif // CC_TREES_LAYER_TREE_HOST_H_ 390 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698