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

Unified Diff: Source/core/fetch/ResourceLoadPriorityOptimizer.h

Issue 109153003: Raise the loading priority of in-viewport images. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes from review. Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/fetch/ResourceLoadPriorityOptimizer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
}
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/fetch/ResourceLoadPriorityOptimizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698