Title: [155040] trunk/Source/WebCore
- Revision
- 155040
- Author
- [email protected]
- Date
- 2013-09-04 06:59:19 -0700 (Wed, 04 Sep 2013)
Log Message
Use Vector<Ref<T>> in three random WebCore loops.
<https://webkit.org/b/120661>
Reviewed by Darin Adler.
Clean up three little loops to use Refs to avoid null checking known-valid objects.
Also apply auto, reserveInitialCapacity and uncheckedAppend as appropriate.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents):
(WebCore::DOMWindow::dispatchAllPendingUnloadEvents):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::invalidate):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (155039 => 155040)
--- trunk/Source/WebCore/ChangeLog 2013-09-04 13:44:25 UTC (rev 155039)
+++ trunk/Source/WebCore/ChangeLog 2013-09-04 13:59:19 UTC (rev 155040)
@@ -1,3 +1,19 @@
+2013-09-04 Andreas Kling <[email protected]>
+
+ Use Vector<Ref<T>> in three random WebCore loops.
+ <https://webkit.org/b/120661>
+
+ Reviewed by Darin Adler.
+
+ Clean up three little loops to use Refs to avoid null checking known-valid objects.
+ Also apply auto, reserveInitialCapacity and uncheckedAppend as appropriate.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents):
+ (WebCore::DOMWindow::dispatchAllPendingUnloadEvents):
+ * platform/graphics/FontCache.cpp:
+ (WebCore::FontCache::invalidate):
+
2013-09-04 Claudio Saavedra <[email protected]>
[GTK] Color of input button's text broken with recent gnome-themes-standard
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (155039 => 155040)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2013-09-04 13:44:25 UTC (rev 155039)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2013-09-04 13:59:19 UTC (rev 155040)
@@ -232,25 +232,24 @@
if (alreadyDispatched)
return true;
- Vector<RefPtr<DOMWindow> > windows;
- DOMWindowSet::iterator end = set.end();
- for (DOMWindowSet::iterator it = set.begin(); it != end; ++it)
- windows.append(it->key);
+ Vector<Ref<DOMWindow>> windows;
+ windows.reserveInitialCapacity(set.size());
+ for (auto it = set.begin(), end = set.end(); it != end; ++it)
+ windows.uncheckedAppend(*it->key);
- size_t size = windows.size();
- for (size_t i = 0; i < size; ++i) {
- DOMWindow* window = windows[i].get();
- if (!set.contains(window))
+ for (unsigned i = 0; i < windows.size(); ++i) {
+ DOMWindow& window = windows[i].get();
+ if (!set.contains(&window))
continue;
- Frame* frame = window->frame();
+ Frame* frame = window.frame();
if (!frame)
continue;
if (!frame->loader().shouldClose())
return false;
- window->enableSuddenTermination();
+ window.enableSuddenTermination();
}
alreadyDispatched = true;
@@ -273,21 +272,20 @@
if (alreadyDispatched)
return;
- Vector<RefPtr<DOMWindow> > windows;
- DOMWindowSet::iterator end = set.end();
- for (DOMWindowSet::iterator it = set.begin(); it != end; ++it)
- windows.append(it->key);
+ Vector<Ref<DOMWindow>> windows;
+ windows.reserveInitialCapacity(set.size());
+ for (auto it = set.begin(), end = set.end(); it != end; ++it)
+ windows.uncheckedAppend(*it->key);
- size_t size = windows.size();
- for (size_t i = 0; i < size; ++i) {
- DOMWindow* window = windows[i].get();
- if (!set.contains(window))
+ for (unsigned i = 0; i < windows.size(); ++i) {
+ DOMWindow& window = windows[i].get();
+ if (!set.contains(&window))
continue;
- window->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), window->document());
- window->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), window->document());
+ window.dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), window.document());
+ window.dispatchEvent(Event::create(eventNames().unloadEvent, false, false), window.document());
- window->enableSuddenTermination();
+ window.enableSuddenTermination();
}
alreadyDispatched = true;
Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (155039 => 155040)
--- trunk/Source/WebCore/platform/graphics/FontCache.cpp 2013-09-04 13:44:25 UTC (rev 155039)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp 2013-09-04 13:59:19 UTC (rev 155040)
@@ -535,15 +535,12 @@
gGeneration++;
- Vector<RefPtr<FontSelector> > clients;
- size_t numClients = gClients->size();
- clients.reserveInitialCapacity(numClients);
- HashSet<FontSelector*>::iterator end = gClients->end();
- for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++it)
- clients.append(*it);
+ Vector<Ref<FontSelector>> clients;
+ clients.reserveInitialCapacity(gClients->size());
+ for (auto it = gClients->begin(), end = gClients->end(); it != end; ++it)
+ clients.uncheckedAppend(**it);
- ASSERT(numClients == clients.size());
- for (size_t i = 0; i < numClients; ++i)
+ for (unsigned i = 0; i < clients.size(); ++i)
clients[i]->fontCacheInvalidated();
purgeInactiveFontData();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes