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 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
| 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "cc/animation/animation_events.h" | 17 #include "cc/animation/animation_events.h" |
17 #include "cc/animation/animation_registrar.h" | 18 #include "cc/animation/animation_registrar.h" |
18 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } | 395 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } |
395 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; | 396 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; |
396 scoped_ptr<base::Value> ActivationStateAsValue() const; | 397 scoped_ptr<base::Value> ActivationStateAsValue() const; |
397 | 398 |
398 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 399 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
399 | 400 |
400 void CreateUIResource(UIResourceId uid, | 401 void CreateUIResource(UIResourceId uid, |
401 scoped_refptr<UIResourceBitmap> bitmap); | 402 scoped_refptr<UIResourceBitmap> bitmap); |
402 // Deletes a UI resource. May safely be called more than once. | 403 // Deletes a UI resource. May safely be called more than once. |
403 void DeleteUIResource(UIResourceId uid); | 404 void DeleteUIResource(UIResourceId uid); |
404 void DeleteAllUIResources(); | 405 void EvictAllUIResources(); |
| 406 bool EvictedUIResourcesExist() const; |
405 | 407 |
406 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 408 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
407 | 409 |
408 void DidInitializeVisibleTileForTesting() { DidInitializeVisibleTile(); } | 410 void DidInitializeVisibleTileForTesting() { DidInitializeVisibleTile(); } |
409 | 411 |
410 protected: | 412 protected: |
411 LayerTreeHostImpl( | 413 LayerTreeHostImpl( |
412 const LayerTreeSettings& settings, | 414 const LayerTreeSettings& settings, |
413 LayerTreeHostImplClient* client, | 415 LayerTreeHostImplClient* client, |
414 Proxy* proxy, | 416 Proxy* proxy, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 475 |
474 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; | 476 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; |
475 | 477 |
476 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); | 478 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); |
477 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, | 479 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, |
478 bool zero_budget); | 480 bool zero_budget); |
479 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 481 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
480 | 482 |
481 void DidInitializeVisibleTile(); | 483 void DidInitializeVisibleTile(); |
482 | 484 |
| 485 void MarkUIResourceNotEvicted(UIResourceId uid); |
| 486 |
483 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> | 487 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> |
484 UIResourceMap; | 488 UIResourceMap; |
485 UIResourceMap ui_resource_map_; | 489 UIResourceMap ui_resource_map_; |
486 | 490 |
| 491 // Resources that were evicted by EvictAllUIResources. Resources are removed |
| 492 // from this when they are touched by a create or destroy from the UI resource |
| 493 // request queue. |
| 494 std::set<UIResourceId> evicted_ui_resources_; |
| 495 |
487 scoped_ptr<OutputSurface> output_surface_; | 496 scoped_ptr<OutputSurface> output_surface_; |
488 scoped_refptr<ContextProvider> offscreen_context_provider_; | 497 scoped_refptr<ContextProvider> offscreen_context_provider_; |
489 | 498 |
490 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 499 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
491 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 500 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
492 scoped_ptr<ResourceProvider> resource_provider_; | 501 scoped_ptr<ResourceProvider> resource_provider_; |
493 scoped_ptr<TileManager> tile_manager_; | 502 scoped_ptr<TileManager> tile_manager_; |
494 scoped_ptr<Renderer> renderer_; | 503 scoped_ptr<Renderer> renderer_; |
495 | 504 |
496 // Tree currently being drawn. | 505 // Tree currently being drawn. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 607 |
599 // Optional callback to notify of new tree activations. | 608 // Optional callback to notify of new tree activations. |
600 base::Closure tree_activation_callback_; | 609 base::Closure tree_activation_callback_; |
601 | 610 |
602 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 611 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
603 }; | 612 }; |
604 | 613 |
605 } // namespace cc | 614 } // namespace cc |
606 | 615 |
607 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 616 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |