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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 { | 79 { |
80 m_imageResources.clear(); | 80 m_imageResources.clear(); |
81 | 81 |
82 Vector<RenderObject*> objectsToRemove; | 82 Vector<RenderObject*> objectsToRemove; |
83 for (RenderObjectSet::iterator it = m_objects.begin(); it != m_objects.end()
; ++it) { | 83 for (RenderObjectSet::iterator it = m_objects.begin(); it != m_objects.end()
; ++it) { |
84 RenderObject* obj = *it; | 84 RenderObject* obj = *it; |
85 if (!obj->updateImageLoadingPriorities()) { | 85 if (!obj->updateImageLoadingPriorities()) { |
86 objectsToRemove.append(obj); | 86 objectsToRemove.append(obj); |
87 } | 87 } |
88 } | 88 } |
89 | 89 m_objects.removeAll(objectsToRemove); |
90 for (Vector<RenderObject*>::iterator it = objectsToRemove.begin(); it != obj
ectsToRemove.end(); ++it) | |
91 m_objects.remove(*it); | |
92 | 90 |
93 updateImageResourcesWithLoadPriority(); | 91 updateImageResourcesWithLoadPriority(); |
94 } | 92 } |
95 | 93 |
96 void ResourceLoadPriorityOptimizer::updateImageResourcesWithLoadPriority() | 94 void ResourceLoadPriorityOptimizer::updateImageResourcesWithLoadPriority() |
97 { | 95 { |
98 for (ImageResourceMap::iterator it = m_imageResources.begin(); it != m_image
Resources.end(); ++it) { | 96 for (ImageResourceMap::iterator it = m_imageResources.begin(); it != m_image
Resources.end(); ++it) { |
99 ResourceLoadPriority priority = it->value->status == Visible ? | 97 ResourceLoadPriority priority = it->value->status == Visible ? |
100 ResourceLoadPriorityLow : ResourceLoadPriorityVeryLow; | 98 ResourceLoadPriorityLow : ResourceLoadPriorityVeryLow; |
101 | 99 |
(...skipping 15 matching lines...) Expand all Loading... |
117 screenArea += static_cast<uint32_t>(screenRect.width() * screenRect.heig
ht()); | 115 screenArea += static_cast<uint32_t>(screenRect.width() * screenRect.heig
ht()); |
118 | 116 |
119 ImageResourceMap::AddResult result = m_imageResources.add(img->identifier(),
adoptPtr(new ResourceAndVisibility(img, status, screenArea))); | 117 ImageResourceMap::AddResult result = m_imageResources.add(img->identifier(),
adoptPtr(new ResourceAndVisibility(img, status, screenArea))); |
120 if (!result.isNewEntry && status == Visible) { | 118 if (!result.isNewEntry && status == Visible) { |
121 result.storedValue->value->status = status; | 119 result.storedValue->value->status = status; |
122 result.storedValue->value->screenArea = status; | 120 result.storedValue->value->screenArea = status; |
123 } | 121 } |
124 } | 122 } |
125 | 123 |
126 } | 124 } |
OLD | NEW |