OLD | NEW |
---|---|
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 Loading... | |
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 private: | |
49 ResourceLoadPriorityOptimizer(); | 56 ResourceLoadPriorityOptimizer(); |
50 ~ResourceLoadPriorityOptimizer(); | 57 ~ResourceLoadPriorityOptimizer(); |
51 void notifyImageResourceVisibility(ImageResource*, VisibilityStatus); | |
52 | 58 |
53 private: | |
54 void updateImageResourcesWithLoadPriority(); | 59 void updateImageResourcesWithLoadPriority(); |
55 | 60 |
56 struct ResourceAndVisibility { | 61 struct ResourceAndVisibility { |
57 ResourceAndVisibility(ImageResource*, VisibilityStatus); | 62 ResourceAndVisibility(ImageResource*, VisibilityStatus); |
58 ~ResourceAndVisibility(); | 63 ~ResourceAndVisibility(); |
59 ResourcePtr<ImageResource> imageResource; | 64 ResourcePtr<ImageResource> imageResource; |
60 VisibilityStatus status; | 65 VisibilityStatus status; |
61 }; | 66 }; |
62 | 67 |
63 typedef HashMap<unsigned long, OwnPtr<ResourceAndVisibility> > ImageResource Map; | 68 typedef HashMap<unsigned long, OwnPtr<ResourceAndVisibility> > ImageResource Map; |
64 ImageResourceMap m_imageResources; | 69 ImageResourceMap m_imageResources; |
70 | |
71 typedef HashSet<RenderObject*> RenderObjectSet; | |
72 RenderObjectSet m_objectCache; | |
73 | |
74 friend ResourceLoadPriorityOptimizer* resourceLoadPriorityOptimizer(); | |
esprehn
2014/01/15 01:27:45
Can this just be a static thing instead? Why does
shatch
2014/01/15 19:28:52
Done.
| |
65 }; | 75 }; |
66 | 76 |
77 ResourceLoadPriorityOptimizer* resourceLoadPriorityOptimizer(); | |
78 | |
67 } | 79 } |
68 | 80 |
69 #endif | 81 #endif |
OLD | NEW |