Index: Source/core/fetch/ResourceLoadPriorityOptimizer.h |
diff --git a/Source/core/rendering/SubtreeLayoutScope.h b/Source/core/fetch/ResourceLoadPriorityOptimizer.h |
similarity index 65% |
copy from Source/core/rendering/SubtreeLayoutScope.h |
copy to Source/core/fetch/ResourceLoadPriorityOptimizer.h |
index c073b7f4cf1e801517c5e8654504b7f3b3ae7ed7..cb58320a410b54afd1fba7bbe4957f039092f55c 100644 |
--- a/Source/core/rendering/SubtreeLayoutScope.h |
+++ b/Source/core/fetch/ResourceLoadPriorityOptimizer.h |
@@ -28,41 +28,40 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef SubtreeLayoutScope_h |
-#define SubtreeLayoutScope_h |
+#ifndef ResourceLoadPriorityOptimizer_h |
+#define ResourceLoadPriorityOptimizer_h |
-#include "wtf/HashSet.h" |
+#include "core/fetch/ImageResource.h" |
+#include "core/fetch/ResourcePtr.h" |
+#include "platform/geometry/LayoutRect.h" |
-// This is the way to mark a subtree as needing layout during layout, |
-// e.g. for the purposes of doing a multipass layout. |
-// |
-// It should only be used during layout. Outside of layout, you should |
-// just call renderer->setNeedsLayout() directly. |
-// |
-// It ensures that you don't accidentally mark part of the tree as |
-// needing layout and not actually lay it out. |
+#include "wtf/HashMap.h" |
+#include "wtf/OwnPtr.h" |
namespace WebCore { |
-class RenderObject; |
- |
-class SubtreeLayoutScope { |
+class ResourceLoadPriorityOptimizer { |
public: |
- SubtreeLayoutScope(RenderObject* root); |
- ~SubtreeLayoutScope(); |
- |
- void setNeedsLayout(RenderObject* descendant); |
- void setChildNeedsLayout(RenderObject* descendant); |
- |
- RenderObject* root() { return m_root; } |
- void addRendererToLayout(RenderObject* renderer); |
+ enum VisibilityStatus { |
+ NotVisible, |
+ Visible, |
+ }; |
+ ResourceLoadPriorityOptimizer(); |
+ ~ResourceLoadPriorityOptimizer(); |
+ void notifyImageResourceVisibility(ImageResource*, VisibilityStatus); |
private: |
- RenderObject* m_root; |
+ void updateImageResourcesWithLoadPriority(); |
-#ifndef NDEBUG |
- HashSet<RenderObject*> m_renderersToLayout; |
-#endif |
+ struct ResourceAndVisibility { |
+ ResourceAndVisibility(ImageResource*, VisibilityStatus); |
+ ~ResourceAndVisibility(); |
+ ResourcePtr<ImageResource> imageResource; |
+ VisibilityStatus status; |
+ }; |
+ |
+ typedef HashMap<unsigned long, OwnPtr<ResourceAndVisibility> > ImageResourceMap; |
+ ImageResourceMap m_imageResources; |
}; |
} |