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

Side by Side Diff: Source/core/fetch/ResourceLoadPriorityOptimizer.h

Issue 131233003: Refactor ResourceLoadPriorityOptimizer to avoid walking render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes from review. Created 6 years, 11 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef ResourceLoadPriorityOptimizer_h 31 #ifndef ResourceLoadPriorityOptimizer_h
32 #define ResourceLoadPriorityOptimizer_h 32 #define ResourceLoadPriorityOptimizer_h
33 33
34 #include "core/fetch/ImageResource.h" 34 #include "core/fetch/ImageResource.h"
35 #include "core/fetch/ResourcePtr.h" 35 #include "core/fetch/ResourcePtr.h"
36 #include "platform/geometry/LayoutRect.h" 36 #include "platform/geometry/LayoutRect.h"
37 37
38 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
39 #include "wtf/HashSet.h"
39 #include "wtf/OwnPtr.h" 40 #include "wtf/OwnPtr.h"
40 41
41 namespace WebCore { 42 namespace WebCore {
42 43
43 class ResourceLoadPriorityOptimizer { 44 class ResourceLoadPriorityOptimizer {
44 public: 45 public:
45 enum VisibilityStatus { 46 enum VisibilityStatus {
46 NotVisible, 47 NotVisible,
47 Visible, 48 Visible,
48 }; 49 };
50 void notifyImageResourceVisibility(ImageResource*, VisibilityStatus);
51 void updateAllImageResourcePriorities();
52 void addRenderObject(RenderObject*);
53 void removeRenderObject(RenderObject*);
54
55 static ResourceLoadPriorityOptimizer* resourceLoadPriorityOptimizer();
56
57 private:
49 ResourceLoadPriorityOptimizer(); 58 ResourceLoadPriorityOptimizer();
50 ~ResourceLoadPriorityOptimizer(); 59 ~ResourceLoadPriorityOptimizer();
51 void notifyImageResourceVisibility(ImageResource*, VisibilityStatus);
52 60
53 private:
54 void updateImageResourcesWithLoadPriority(); 61 void updateImageResourcesWithLoadPriority();
55 62
56 struct ResourceAndVisibility { 63 struct ResourceAndVisibility {
57 ResourceAndVisibility(ImageResource*, VisibilityStatus); 64 ResourceAndVisibility(ImageResource*, VisibilityStatus);
58 ~ResourceAndVisibility(); 65 ~ResourceAndVisibility();
59 ResourcePtr<ImageResource> imageResource; 66 ResourcePtr<ImageResource> imageResource;
60 VisibilityStatus status; 67 VisibilityStatus status;
61 }; 68 };
62 69
63 typedef HashMap<unsigned long, OwnPtr<ResourceAndVisibility> > ImageResource Map; 70 typedef HashMap<unsigned long, OwnPtr<ResourceAndVisibility> > ImageResource Map;
64 ImageResourceMap m_imageResources; 71 ImageResourceMap m_imageResources;
72
73 typedef HashSet<RenderObject*> RenderObjectSet;
ojan 2014/01/23 06:32:59 Since we only ever add RenderImages, could we tigh
74 RenderObjectSet m_objects;
65 }; 75 };
66 76
67 } 77 }
68 78
69 #endif 79 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/fetch/ResourceLoadPriorityOptimizer.cpp » ('j') | Source/core/rendering/RenderBlock.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698