summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/appcache/DOMApplicationCache.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/loader/appcache/DOMApplicationCache.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/loader/appcache/DOMApplicationCache.cpp')
-rw-r--r--WebCore/loader/appcache/DOMApplicationCache.cpp115
1 files changed, 17 insertions, 98 deletions
diff --git a/WebCore/loader/appcache/DOMApplicationCache.cpp b/WebCore/loader/appcache/DOMApplicationCache.cpp
index ab5802f..1496b8a 100644
--- a/WebCore/loader/appcache/DOMApplicationCache.cpp
+++ b/WebCore/loader/appcache/DOMApplicationCache.cpp
@@ -42,8 +42,10 @@ namespace WebCore {
DOMApplicationCache::DOMApplicationCache(Frame* frame)
: m_frame(frame)
{
- ASSERT(applicationCacheHost());
- applicationCacheHost()->setDOMApplicationCache(this);
+ ASSERT(!m_frame || applicationCacheHost());
+ ApplicationCacheHost* cacheHost = applicationCacheHost();
+ if (cacheHost)
+ cacheHost->setDOMApplicationCache(this);
}
void DOMApplicationCache::disconnectFrame()
@@ -76,90 +78,17 @@ void DOMApplicationCache::update(ExceptionCode& ec)
ec = INVALID_STATE_ERR;
}
-bool DOMApplicationCache::swapCache()
-{
- ApplicationCacheHost* cacheHost = applicationCacheHost();
- if (!cacheHost)
- return false;
- return cacheHost->swapCache();
-}
-
void DOMApplicationCache::swapCache(ExceptionCode& ec)
{
- if (!swapCache())
+ ApplicationCacheHost* cacheHost = applicationCacheHost();
+ if (!cacheHost || !cacheHost->swapCache())
ec = INVALID_STATE_ERR;
}
ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const
{
- return m_frame->document();
-}
-
-void DOMApplicationCache::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
-{
- EventListenersMap::iterator iter = m_eventListeners.find(eventType);
- if (iter == m_eventListeners.end()) {
- ListenerVector listeners;
- listeners.append(eventListener);
- m_eventListeners.add(eventType, listeners);
- } else {
- ListenerVector& listeners = iter->second;
- for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
- if (*listenerIter == eventListener)
- return;
- }
-
- listeners.append(eventListener);
- m_eventListeners.add(eventType, listeners);
- }
-}
-
-void DOMApplicationCache::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool)
-{
- EventListenersMap::iterator iter = m_eventListeners.find(eventType);
- if (iter == m_eventListeners.end())
- return;
-
- ListenerVector& listeners = iter->second;
- for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
- if (*listenerIter == eventListener) {
- listeners.remove(listenerIter - listeners.begin());
- return;
- }
- }
-}
-
-bool DOMApplicationCache::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
-{
- if (!event || event->type().isEmpty()) {
- ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
- return true;
- }
-
- ListenerVector listenersCopy = m_eventListeners.get(event->type());
- for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) {
- event->setTarget(this);
- event->setCurrentTarget(this);
- listenerIter->get()->handleEvent(event.get(), false);
- }
-
- return !event->defaultPrevented();
-}
-
-void DOMApplicationCache::callListener(const AtomicString& eventType, EventListener* listener)
-{
ASSERT(m_frame);
-
- RefPtr<Event> event = Event::create(eventType, false, false);
- if (listener) {
- event->setTarget(this);
- event->setCurrentTarget(this);
- listener->handleEvent(event.get(), false);
- }
-
- ExceptionCode ec = 0;
- dispatchEvent(event.release(), ec);
- ASSERT(!ec);
+ return m_frame->document();
}
const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::EventID id)
@@ -186,29 +115,19 @@ const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::Event
return eventNames().errorEvent;
}
-ApplicationCacheHost::EventID DOMApplicationCache::toEventID(const AtomicString& eventType)
+EventTargetData* DOMApplicationCache::eventTargetData()
{
- if (eventType == eventNames().checkingEvent)
- return ApplicationCacheHost::CHECKING_EVENT;
- if (eventType == eventNames().errorEvent)
- return ApplicationCacheHost::ERROR_EVENT;
- if (eventType == eventNames().noupdateEvent)
- return ApplicationCacheHost::NOUPDATE_EVENT;
- if (eventType == eventNames().downloadingEvent)
- return ApplicationCacheHost::DOWNLOADING_EVENT;
- if (eventType == eventNames().progressEvent)
- return ApplicationCacheHost::PROGRESS_EVENT;
- if (eventType == eventNames().updatereadyEvent)
- return ApplicationCacheHost::UPDATEREADY_EVENT;
- if (eventType == eventNames().cachedEvent)
- return ApplicationCacheHost::CACHED_EVENT;
- if (eventType == eventNames().obsoleteEvent)
- return ApplicationCacheHost::OBSOLETE_EVENT;
-
- ASSERT_NOT_REACHED();
- return ApplicationCacheHost::ERROR_EVENT;
+ return &m_eventTargetData;
+}
+
+<<<<<<< HEAD:WebCore/loader/appcache/DOMApplicationCache.cpp
+=======
+EventTargetData* DOMApplicationCache::ensureEventTargetData()
+{
+ return &m_eventTargetData;
}
+>>>>>>> webkit.org at 49305:WebCore/loader/appcache/DOMApplicationCache.cpp
} // namespace WebCore
#endif // ENABLE(OFFLINE_WEB_APPLICATIONS)