Chromium Code Reviews| Index: Source/core/fetch/ResourceLoadPriorityOptimizer.h |
| diff --git a/Source/core/rendering/SubtreeLayoutScope.h b/Source/core/fetch/ResourceLoadPriorityOptimizer.h |
| similarity index 66% |
| copy from Source/core/rendering/SubtreeLayoutScope.h |
| copy to Source/core/fetch/ResourceLoadPriorityOptimizer.h |
| index c073b7f4cf1e801517c5e8654504b7f3b3ae7ed7..e5b99314934894d8a0fb9f60a6a83360410af42c 100644 |
| --- a/Source/core/rendering/SubtreeLayoutScope.h |
| +++ b/Source/core/fetch/ResourceLoadPriorityOptimizer.h |
| @@ -28,41 +28,39 @@ |
| * 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" |
| -// 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" |
| 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(); |
| + ~ResourceAndVisibility(); |
| + ResourcePtr<ImageResource> imageResource; |
| + VisibilityStatus status; |
| + }; |
| + |
| + typedef WTF::HashMap<unsigned long, ResourceAndVisibility> ImageResourceMap; |
|
abarth-chromium
2013/12/02 19:34:56
Rather than using ResourceAndVisibility, you shoul
shatch
2013/12/02 22:32:46
Cool, thanks for the explanation! Done.
|
| + ImageResourceMap m_imageResources; |
| }; |
| } |