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 13 matching lines...) Expand all Loading... | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 32 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
33 #include "core/rendering/RenderObject.h" | 33 #include "core/rendering/RenderObject.h" |
34 #include "platform/TraceEvent.h" | |
34 | 35 |
35 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 ResourceLoadPriorityOptimizer* ResourceLoadPriorityOptimizer::resourceLoadPriori tyOptimizer() | 40 ResourceLoadPriorityOptimizer* ResourceLoadPriorityOptimizer::resourceLoadPriori tyOptimizer() |
40 { | 41 { |
41 DEFINE_STATIC_LOCAL(ResourceLoadPriorityOptimizer, s_renderLoadOptimizer, () ); | 42 DEFINE_STATIC_LOCAL(ResourceLoadPriorityOptimizer, s_renderLoadOptimizer, () ); |
42 return &s_renderLoadOptimizer; | 43 return &s_renderLoadOptimizer; |
43 } | 44 } |
(...skipping 26 matching lines...) Expand all Loading... | |
70 void ResourceLoadPriorityOptimizer::removeRenderObject(RenderObject* renderer) | 71 void ResourceLoadPriorityOptimizer::removeRenderObject(RenderObject* renderer) |
71 { | 72 { |
72 if (!renderer->hasPendingResourceUpdate()) | 73 if (!renderer->hasPendingResourceUpdate()) |
73 return; | 74 return; |
74 m_objects.remove(renderer); | 75 m_objects.remove(renderer); |
75 renderer->setHasPendingResourceUpdate(false); | 76 renderer->setHasPendingResourceUpdate(false); |
76 } | 77 } |
77 | 78 |
78 void ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities() | 79 void ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities() |
79 { | 80 { |
81 TRACE_EVENT0("webkit", "ResourceLoadPriorityOptimizer::updateAllImageResourc ePriorities"); | |
dsinclair
2014/06/18 18:37:52
I've seen some of these as "webkit" and some as "b
esprehn
2014/06/18 19:17:06
Lets use webkit for now, and rename them all to "b
| |
82 | |
80 m_imageResources.clear(); | 83 m_imageResources.clear(); |
81 | 84 |
82 Vector<RenderObject*> objectsToRemove; | 85 Vector<RenderObject*> objectsToRemove; |
83 for (RenderObjectSet::iterator it = m_objects.begin(); it != m_objects.end() ; ++it) { | 86 for (RenderObjectSet::iterator it = m_objects.begin(); it != m_objects.end() ; ++it) { |
84 RenderObject* obj = *it; | 87 RenderObject* obj = *it; |
85 if (!obj->updateImageLoadingPriorities()) { | 88 if (!obj->updateImageLoadingPriorities()) { |
86 objectsToRemove.append(obj); | 89 objectsToRemove.append(obj); |
87 } | 90 } |
88 } | 91 } |
89 m_objects.removeAll(objectsToRemove); | 92 m_objects.removeAll(objectsToRemove); |
(...skipping 25 matching lines...) Expand all Loading... | |
115 screenArea += static_cast<uint32_t>(screenRect.width() * screenRect.heig ht()); | 118 screenArea += static_cast<uint32_t>(screenRect.width() * screenRect.heig ht()); |
116 | 119 |
117 ImageResourceMap::AddResult result = m_imageResources.add(img->identifier(), adoptPtr(new ResourceAndVisibility(img, status, screenArea))); | 120 ImageResourceMap::AddResult result = m_imageResources.add(img->identifier(), adoptPtr(new ResourceAndVisibility(img, status, screenArea))); |
118 if (!result.isNewEntry && status == Visible) { | 121 if (!result.isNewEntry && status == Visible) { |
119 result.storedValue->value->status = status; | 122 result.storedValue->value->status = status; |
120 result.storedValue->value->screenArea = status; | 123 result.storedValue->value->screenArea = status; |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 } | 127 } |
OLD | NEW |