diff options
Diffstat (limited to 'WebCore/loader/appcache/DOMApplicationCache.cpp')
-rw-r--r-- | WebCore/loader/appcache/DOMApplicationCache.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/WebCore/loader/appcache/DOMApplicationCache.cpp b/WebCore/loader/appcache/DOMApplicationCache.cpp index 5bc4420..12d86a7 100644 --- a/WebCore/loader/appcache/DOMApplicationCache.cpp +++ b/WebCore/loader/appcache/DOMApplicationCache.cpp @@ -132,7 +132,7 @@ PassRefPtr<DOMStringList> DOMApplicationCache::items() Vector<String> result; if (ApplicationCache* cache = associatedCache()) { unsigned numEntries = cache->numDynamicEntries(); - result.reserveCapacity(numEntries); + result.reserveInitialCapacity(numEntries); for (unsigned i = 0; i < numEntries; ++i) result.append(cache->dynamicEntry(i)); } @@ -298,6 +298,51 @@ void DOMApplicationCache::callObsoleteListener() callListener(eventNames().obsoleteEvent, m_onObsoleteListener.get()); } +#if USE(V8) +RefPtr<EventListener>* DOMApplicationCache::getAttributeEventListenerStorage(const AtomicString& eventType) +{ + if (eventType == eventNames().checkingEvent) + return &m_onCheckingListener; + else if (eventType == eventNames().errorEvent) + return &m_onErrorListener; + else if (eventType == eventNames().noupdateEvent) + return &m_onNoUpdateListener; + else if (eventType == eventNames().downloadingEvent) + return &m_onDownloadingListener; + else if (eventType == eventNames().progressEvent) + return &m_onProgressListener; + else if (eventType == eventNames().updatereadyEvent) + return &m_onUpdateReadyListener; + else if (eventType == eventNames().cachedEvent) + return &m_onCachedListener; + else if (eventType == eventNames().obsoleteEvent) + return &m_onObsoleteListener; + else + return 0; +} + +EventListener* DOMApplicationCache::getAttributeEventListener(const AtomicString& eventType) +{ + RefPtr<EventListener>* storage = getAttributeEventListenerStorage(eventType); + ASSERT(storage); + return (*storage).get(); +} + +void DOMApplicationCache::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) +{ + RefPtr<EventListener>* storage = getAttributeEventListenerStorage(eventType); + ASSERT(storage); + (*storage) = listener; +} + +void DOMApplicationCache::clearAttributeEventListener(const AtomicString& eventType) +{ + RefPtr<EventListener>* storage = getAttributeEventListenerStorage(eventType); + ASSERT(storage); + (*storage) = 0; +} +#endif + } // namespace WebCore #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) |