diff options
Diffstat (limited to 'Source/WebCore/loader')
38 files changed, 234 insertions, 99 deletions
diff --git a/Source/WebCore/loader/CrossOriginPreflightResultCache.h b/Source/WebCore/loader/CrossOriginPreflightResultCache.h index 1016aed..ddd5070 100644 --- a/Source/WebCore/loader/CrossOriginPreflightResultCache.h +++ b/Source/WebCore/loader/CrossOriginPreflightResultCache.h @@ -38,7 +38,8 @@ namespace WebCore { class HTTPHeaderMap; class ResourceResponse; - class CrossOriginPreflightResultCacheItem : public Noncopyable { + class CrossOriginPreflightResultCacheItem { + WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCacheItem); WTF_MAKE_FAST_ALLOCATED; public: CrossOriginPreflightResultCacheItem(bool credentials) : m_absoluteExpiryTime(0) @@ -63,7 +64,8 @@ namespace WebCore { HeadersSet m_headers; }; - class CrossOriginPreflightResultCache : public Noncopyable { + class CrossOriginPreflightResultCache { + WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCache); WTF_MAKE_FAST_ALLOCATED; public: static CrossOriginPreflightResultCache& shared(); diff --git a/Source/WebCore/loader/DocumentThreadableLoader.h b/Source/WebCore/loader/DocumentThreadableLoader.h index ebf3a25..3a3cc64 100644 --- a/Source/WebCore/loader/DocumentThreadableLoader.h +++ b/Source/WebCore/loader/DocumentThreadableLoader.h @@ -47,6 +47,7 @@ namespace WebCore { class ThreadableLoaderClient; class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private SubresourceLoaderClient { + WTF_MAKE_FAST_ALLOCATED; public: static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); diff --git a/Source/WebCore/loader/DocumentWriter.h b/Source/WebCore/loader/DocumentWriter.h index 5fb3dc1..fb93606 100644 --- a/Source/WebCore/loader/DocumentWriter.h +++ b/Source/WebCore/loader/DocumentWriter.h @@ -39,7 +39,8 @@ class Frame; class SecurityOrigin; class TextResourceDecoder; -class DocumentWriter : public Noncopyable { +class DocumentWriter { + WTF_MAKE_NONCOPYABLE(DocumentWriter); public: DocumentWriter(Frame*); diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index e04d22d..d0a4350 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -161,6 +161,9 @@ public: #if ENABLE(TILED_BACKING_STORE) virtual void delegatedScrollRequested(const IntSize&) { } #endif +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation() { } +#endif virtual IntPoint screenToWindow(const IntPoint& p) const { return p; } virtual IntRect windowToScreen(const IntRect& r) const { return r; } @@ -218,8 +221,10 @@ public: #endif }; -class EmptyFrameLoaderClient : public FrameLoaderClient, public Noncopyable { +class EmptyFrameLoaderClient : public FrameLoaderClient { + WTF_MAKE_NONCOPYABLE(EmptyFrameLoaderClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyFrameLoaderClient() { } virtual ~EmptyFrameLoaderClient() { } virtual void frameLoaderDestroyed() { } @@ -395,8 +400,10 @@ public: virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() { return PassRefPtr<FrameNetworkingContext>(); } }; -class EmptyEditorClient : public EditorClient, public Noncopyable { +class EmptyEditorClient : public EditorClient { + WTF_MAKE_NONCOPYABLE(EmptyEditorClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyEditorClient() { } virtual ~EmptyEditorClient() { } virtual void pageDestroyed() { } @@ -509,8 +516,10 @@ public: }; #if ENABLE(CONTEXT_MENUS) -class EmptyContextMenuClient : public ContextMenuClient, public Noncopyable { +class EmptyContextMenuClient : public ContextMenuClient { + WTF_MAKE_NONCOPYABLE(EmptyContextMenuClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyContextMenuClient() { } virtual ~EmptyContextMenuClient() { } virtual void contextMenuDestroyed() { } @@ -536,8 +545,10 @@ public: #endif // ENABLE(CONTEXT_MENUS) #if ENABLE(DRAG_SUPPORT) -class EmptyDragClient : public DragClient, public Noncopyable { +class EmptyDragClient : public DragClient { + WTF_MAKE_NONCOPYABLE(EmptyDragClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyDragClient() { } virtual ~EmptyDragClient() {} virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { } virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) { } @@ -549,8 +560,10 @@ public: }; #endif // ENABLE(DRAG_SUPPORT) -class EmptyInspectorClient : public InspectorClient, public Noncopyable { +class EmptyInspectorClient : public InspectorClient { + WTF_MAKE_NONCOPYABLE(EmptyInspectorClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyInspectorClient() { } virtual ~EmptyInspectorClient() { } virtual void inspectorDestroyed() { } diff --git a/Source/WebCore/loader/FormSubmission.h b/Source/WebCore/loader/FormSubmission.h index d724835..7f58f91 100644 --- a/Source/WebCore/loader/FormSubmission.h +++ b/Source/WebCore/loader/FormSubmission.h @@ -47,7 +47,8 @@ class FormSubmission : public RefCounted<FormSubmission> { public: enum Method { GetMethod, PostMethod }; - class Attributes : public Noncopyable { + class Attributes { + WTF_MAKE_NONCOPYABLE(Attributes); public: Attributes() : m_method(GetMethod) diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 9c6257b..3a19791 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -101,10 +101,6 @@ #include <wtf/text/CString.h> #include <wtf/text/StringConcatenate.h> -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "HTMLMediaElement.h" -#endif - #if ENABLE(SHARED_WORKERS) #include "SharedWorkerRepository.h" #endif @@ -1003,6 +999,18 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S return WebCore::ObjectContentNone; } +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->hideMediaPlayerProxyPlugin(widget); +} + +void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->showMediaPlayerProxyPlugin(widget); +} +#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) + String FrameLoader::outgoingReferrer() const { return m_outgoingReferrer; @@ -1692,13 +1700,13 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const return false; } -void FrameLoader::stopLoadingSubframes() +void FrameLoader::stopLoadingSubframes(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy) { for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->loader()->stopAllLoaders(); + child->loader()->stopAllLoaders(databasePolicy, clearProvisionalItemPolicy); } -void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy) +void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy) { ASSERT(!m_frame->document() || !m_frame->document()->inPageCache()); if (m_pageDismissalEventBeingDispatched) @@ -1712,7 +1720,12 @@ void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy) policyChecker()->stopCheck(); - stopLoadingSubframes(); + // If no new load is in progress, we should clear the provisional item from history + // before we call stopLoading. + if (clearProvisionalItemPolicy == ShouldClearProvisionalItem) + history()->setProvisionalItem(0); + + stopLoadingSubframes(databasePolicy, clearProvisionalItemPolicy); if (m_provisionalDocumentLoader) m_provisionalDocumentLoader->stopLoading(databasePolicy); if (m_documentLoader) @@ -2370,7 +2383,8 @@ void FrameLoader::checkLoadCompleteForThisFrame() // Reset the back forward list to the last committed history item at the top level. item = page->mainFrame()->loader()->history()->currentItem(); - bool shouldReset = true; + // Only reset if we aren't already going to a new provisional item. + bool shouldReset = !history()->provisionalItem(); if (!(pdl->isLoadingInAPISense() && !pdl->isStopping())) { m_delegateIsHandlingProvisionalLoadError = true; m_client->dispatchDidFailProvisionalLoad(error); @@ -2379,7 +2393,7 @@ void FrameLoader::checkLoadCompleteForThisFrame() // FIXME: can stopping loading here possibly have any effect, if isLoading is false, // which it must be to be in this branch of the if? And is it OK to just do a full-on // stopAllLoaders instead of stopLoadingSubframes? - stopLoadingSubframes(); + stopLoadingSubframes(DatabasePolicyStop, ShouldNotClearProvisionalItem); pdl->stopLoading(); // If we're in the middle of loading multipart data, we need to restore the document loader. @@ -2987,7 +3001,8 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass } FrameLoadType type = policyChecker()->loadType(); - stopAllLoaders(); + // A new navigation is in progress, so don't clear the history's provisional item. + stopAllLoaders(DatabasePolicyStop, ShouldNotClearProvisionalItem); // <rdar://problem/6250856> - In certain circumstances on pages with multiple frames, stopAllLoaders() // might detach the current FrameLoader, in which case we should bail on this newly defunct load. diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h index 12afbdd..b9eac9d 100644 --- a/Source/WebCore/loader/FrameLoader.h +++ b/Source/WebCore/loader/FrameLoader.h @@ -86,7 +86,8 @@ struct WindowFeatures; bool isBackForwardLoadType(FrameLoadType); -class FrameLoader : public Noncopyable { +class FrameLoader { + WTF_MAKE_NONCOPYABLE(FrameLoader); public: FrameLoader(Frame*, FrameLoaderClient*); ~FrameLoader(); @@ -129,7 +130,7 @@ public: bool canHandleRequest(const ResourceRequest&); // Also not cool. - void stopAllLoaders(DatabasePolicy = DatabasePolicyStop); + void stopAllLoaders(DatabasePolicy = DatabasePolicyStop, ClearProvisionalItemPolicy = ShouldClearProvisionalItem); void stopForUserCancel(bool deferCheckLoadComplete = false); bool isLoadingMainResource() const { return m_isLoadingMainResource; } @@ -306,6 +307,11 @@ public: void open(CachedFrameBase&); +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + void hideMediaPlayerProxyPlugin(Widget*); + void showMediaPlayerProxyPlugin(Widget*); +#endif + // FIXME: Should these really be public? void completed(); bool allAncestorsAreComplete() const; // including this @@ -351,7 +357,7 @@ private: void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType loadType, bool isMainResource, bool cookiePolicyURLFromRequest); // Also not cool. - void stopLoadingSubframes(); + void stopLoadingSubframes(DatabasePolicy, ClearProvisionalItemPolicy); void clearProvisionalLoad(); void markLoadComplete(); diff --git a/Source/WebCore/loader/FrameLoaderStateMachine.h b/Source/WebCore/loader/FrameLoaderStateMachine.h index c3408c2..fe37ece 100644 --- a/Source/WebCore/loader/FrameLoaderStateMachine.h +++ b/Source/WebCore/loader/FrameLoaderStateMachine.h @@ -35,7 +35,8 @@ namespace WebCore { // Encapsulates a state machine for FrameLoader. Note that this is different from FrameState, // which stores the state of the current load that FrameLoader is executing. -class FrameLoaderStateMachine : public Noncopyable { +class FrameLoaderStateMachine { + WTF_MAKE_NONCOPYABLE(FrameLoaderStateMachine); public: FrameLoaderStateMachine(); diff --git a/Source/WebCore/loader/FrameLoaderTypes.h b/Source/WebCore/loader/FrameLoaderTypes.h index 016de19..9f63c44 100644 --- a/Source/WebCore/loader/FrameLoaderTypes.h +++ b/Source/WebCore/loader/FrameLoaderTypes.h @@ -73,6 +73,11 @@ namespace WebCore { DatabasePolicyStop, // The database thread should be stopped and database connections closed. DatabasePolicyContinue }; + + enum ClearProvisionalItemPolicy { + ShouldClearProvisionalItem, + ShouldNotClearProvisionalItem + }; enum ObjectContentType { ObjectContentNone, diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp index dda4e56..7c0fc97 100644 --- a/Source/WebCore/loader/HistoryController.cpp +++ b/Source/WebCore/loader/HistoryController.cpp @@ -260,6 +260,10 @@ void HistoryController::updateForBackForwardNavigation() // Must grab the current scroll position before disturbing it if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); + + // When traversing history, we may end up redirecting to a different URL + // this time (e.g., due to cookies). See http://webkit.org/b/49654. + updateCurrentItem(); } void HistoryController::updateForReload() @@ -274,11 +278,11 @@ void HistoryController::updateForReload() if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) saveScrollPositionAndViewStateToItem(m_currentItem.get()); - - // Sometimes loading a page again leads to a different result because of cookies. Bugzilla 4072 - if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) - m_currentItem->setURL(m_frame->loader()->documentLoader()->requestURL()); } + + // When reloading the page, we may end up redirecting to a different URL + // this time (e.g., due to cookies). See http://webkit.org/b/4072. + updateCurrentItem(); } // There are 3 things you might think of as "history", all of which are handled by these functions. @@ -310,9 +314,9 @@ void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem()); } - } else if (frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { - m_currentItem->setURL(frameLoader->documentLoader()->url()); - m_currentItem->setFormInfoFromRequest(frameLoader->documentLoader()->request()); + } else { + // The client redirect replaces the current history item. + updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { @@ -349,14 +353,12 @@ void HistoryController::updateForRedirectWithLockedBackForwardList() page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem()); } } - if (m_currentItem) { - m_currentItem->setURL(m_frame->loader()->documentLoader()->url()); - m_currentItem->setFormInfoFromRequest(m_frame->loader()->documentLoader()->request()); - } + // The client redirect replaces the current history item. + updateCurrentItem(); } else { Frame* parentFrame = m_frame->tree()->parent(); if (parentFrame && parentFrame->loader()->history()->m_currentItem) - parentFrame->loader()->history()->m_currentItem->setChildItem(createItem(true)); + parentFrame->loader()->history()->m_currentItem->setChildItem(createItem()); } if (!historyURL.isEmpty() && !needPrivacy) { @@ -506,12 +508,13 @@ void HistoryController::setProvisionalItem(HistoryItem* item) m_provisionalItem = item; } -PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) +void HistoryController::initializeItem(HistoryItem* item) { DocumentLoader* documentLoader = m_frame->loader()->documentLoader(); - - KURL unreachableURL = documentLoader ? documentLoader->unreachableURL() : KURL(); - + ASSERT(documentLoader); + + KURL unreachableURL = documentLoader->unreachableURL(); + KURL url; KURL originalURL; @@ -519,15 +522,10 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) url = unreachableURL; originalURL = unreachableURL; } else { - originalURL = documentLoader ? documentLoader->originalURL() : KURL(); - if (useOriginal) - url = originalURL; - else if (documentLoader) - url = documentLoader->requestURL(); + url = documentLoader->url(); + originalURL = documentLoader->originalURL(); } - LOG(History, "WebCoreHistory: Creating item for %s", url.string().ascii().data()); - // Frames that have never successfully loaded any content // may have no URL at all. Currently our history code can't // deal with such things, so we nip that in the bud here. @@ -540,21 +538,25 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) Frame* parentFrame = m_frame->tree()->parent(); String parent = parentFrame ? parentFrame->tree()->uniqueName() : ""; - String title = documentLoader ? documentLoader->title() : ""; + String title = documentLoader->title(); - RefPtr<HistoryItem> item = HistoryItem::create(url, m_frame->tree()->uniqueName(), parent, title); + item->setURL(url); + item->setTarget(m_frame->tree()->uniqueName()); + item->setParent(parent); + item->setTitle(title); item->setOriginalURLString(originalURL.string()); - if (!unreachableURL.isEmpty() || !documentLoader || documentLoader->response().httpStatusCode() >= 400) + if (!unreachableURL.isEmpty() || documentLoader->response().httpStatusCode() >= 400) item->setLastVisitWasFailure(true); // Save form state if this is a POST - if (documentLoader) { - if (useOriginal) - item->setFormInfoFromRequest(documentLoader->originalRequest()); - else - item->setFormInfoFromRequest(documentLoader->request()); - } + item->setFormInfoFromRequest(documentLoader->request()); +} + +PassRefPtr<HistoryItem> HistoryController::createItem() +{ + RefPtr<HistoryItem> item = HistoryItem::create(); + initializeItem(item.get()); // Set the item for which we will save document state m_frameLoadComplete = false; @@ -566,7 +568,7 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget) { - RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false); + RefPtr<HistoryItem> bfItem = createItem(); if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); @@ -656,6 +658,14 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt bool HistoryController::itemsAreClones(HistoryItem* item1, HistoryItem* item2) const { + // It appears that one of the items can be null in release builds, leading + // to the crashes seen in http://webkit.org/b/52819. For now, try to + // narrow it down with a more specific crash. + if (!item1) + CRASH(); + if (!item2) + CRASH(); + // If the item we're going to is a clone of the item we're at, then we do // not need to load it again. The current frame tree and the frame tree // snapshot in the item have to match. @@ -713,6 +723,31 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) page->backForward()->addItem(topItem.release()); } +void HistoryController::updateCurrentItem() +{ + if (!m_currentItem) + return; + + DocumentLoader* documentLoader = m_frame->loader()->documentLoader(); + + if (!documentLoader->unreachableURL().isEmpty()) + return; + + if (m_currentItem->url() != documentLoader->url()) { + // We ended up on a completely different URL this time, so the HistoryItem + // needs to be re-initialized. Preserve the isTargetItem flag as it is a + // property of how this HistoryItem was originally created and is not + // dependent on the document. + bool isTargetItem = m_currentItem->isTargetItem(); + m_currentItem->reset(); + initializeItem(m_currentItem.get()); + m_currentItem->setIsTargetItem(isTargetItem); + } else { + // Even if the final URL didn't change, the form data may have changed. + m_currentItem->setFormInfoFromRequest(documentLoader->request()); + } +} + void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) { if (!m_currentItem) diff --git a/Source/WebCore/loader/HistoryController.h b/Source/WebCore/loader/HistoryController.h index 9923179..061f235 100644 --- a/Source/WebCore/loader/HistoryController.h +++ b/Source/WebCore/loader/HistoryController.h @@ -41,7 +41,8 @@ class Frame; class HistoryItem; class SerializedScriptValue; -class HistoryController : public Noncopyable { +class HistoryController { + WTF_MAKE_NONCOPYABLE(HistoryController); public: enum HistoryUpdateType { UpdateAll, UpdateAllExceptBackForwardList }; @@ -84,7 +85,8 @@ public: void replaceState(PassRefPtr<SerializedScriptValue>, const String& title, const String& url); private: - PassRefPtr<HistoryItem> createItem(bool useOriginal); + void initializeItem(HistoryItem*); + PassRefPtr<HistoryItem> createItem(); PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget); void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*, FrameLoadType); @@ -93,6 +95,7 @@ private: bool itemsAreClones(HistoryItem*, HistoryItem*) const; bool currentFramesMatchItem(HistoryItem*) const; void updateBackForwardListClippedAtTarget(bool doClip); + void updateCurrentItem(); Frame* m_frame; diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index a77e8c0..069b40e 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -57,7 +57,8 @@ template<> struct ValueCheck<WebCore::ImageLoader*> { namespace WebCore { -class ImageEventSender : public Noncopyable { +class ImageEventSender { + WTF_MAKE_NONCOPYABLE(ImageEventSender); WTF_MAKE_FAST_ALLOCATED; public: ImageEventSender(const AtomicString& eventType); diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp index 175219c..d51575b 100644 --- a/Source/WebCore/loader/NavigationScheduler.cpp +++ b/Source/WebCore/loader/NavigationScheduler.cpp @@ -53,7 +53,8 @@ namespace WebCore { unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; -class ScheduledNavigation : public Noncopyable { +class ScheduledNavigation { + WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED; public: ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange) : m_delay(delay) diff --git a/Source/WebCore/loader/PingLoader.h b/Source/WebCore/loader/PingLoader.h index 3a076fb..5988b60 100644 --- a/Source/WebCore/loader/PingLoader.h +++ b/Source/WebCore/loader/PingLoader.h @@ -50,7 +50,8 @@ class ResourceResponse; // to allow the load to live long enough to ensure the message was actually sent. // Therefore, as soon as a callback is received from the ResourceHandle, this class // will cancel the load and delete itself. -class PingLoader : private ResourceHandleClient, public Noncopyable { +class PingLoader : private ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(PingLoader); WTF_MAKE_FAST_ALLOCATED; public: static void loadImage(Frame*, const KURL& url); static void sendPing(Frame*, const KURL& pingURL, const KURL& destinationURL); diff --git a/Source/WebCore/loader/PolicyChecker.h b/Source/WebCore/loader/PolicyChecker.h index 541729c..3118dae 100644 --- a/Source/WebCore/loader/PolicyChecker.h +++ b/Source/WebCore/loader/PolicyChecker.h @@ -45,7 +45,8 @@ class NavigationAction; class ResourceError; class ResourceResponse; -class PolicyChecker : public Noncopyable { +class PolicyChecker { + WTF_MAKE_NONCOPYABLE(PolicyChecker); public: PolicyChecker(Frame*); diff --git a/Source/WebCore/loader/ProgressTracker.cpp b/Source/WebCore/loader/ProgressTracker.cpp index cd15433..65dd1c5 100644 --- a/Source/WebCore/loader/ProgressTracker.cpp +++ b/Source/WebCore/loader/ProgressTracker.cpp @@ -50,7 +50,9 @@ static const double finalProgressValue = 0.9; // 1.0 - initialProgressValue static const int progressItemDefaultEstimatedLength = 1024 * 16; -struct ProgressItem : Noncopyable { +struct ProgressItem { + WTF_MAKE_NONCOPYABLE(ProgressItem); WTF_MAKE_FAST_ALLOCATED; +public: ProgressItem(long long length) : bytesReceived(0) , estimatedLength(length) { } diff --git a/Source/WebCore/loader/ProgressTracker.h b/Source/WebCore/loader/ProgressTracker.h index 5d5b6b2..ea5f7f9 100644 --- a/Source/WebCore/loader/ProgressTracker.h +++ b/Source/WebCore/loader/ProgressTracker.h @@ -36,7 +36,8 @@ class Frame; class ResourceResponse; struct ProgressItem; -class ProgressTracker : public Noncopyable { +class ProgressTracker { + WTF_MAKE_NONCOPYABLE(ProgressTracker); WTF_MAKE_FAST_ALLOCATED; public: ProgressTracker(); ~ProgressTracker(); diff --git a/Source/WebCore/loader/ResourceLoadNotifier.h b/Source/WebCore/loader/ResourceLoadNotifier.h index 2f10856..a6d92fb 100644 --- a/Source/WebCore/loader/ResourceLoadNotifier.h +++ b/Source/WebCore/loader/ResourceLoadNotifier.h @@ -43,7 +43,8 @@ class ResourceLoader; class ResourceResponse; class ResourceRequest; -class ResourceLoadNotifier : public Noncopyable { +class ResourceLoadNotifier { + WTF_MAKE_NONCOPYABLE(ResourceLoadNotifier); public: ResourceLoadNotifier(Frame*); diff --git a/Source/WebCore/loader/ResourceLoadScheduler.h b/Source/WebCore/loader/ResourceLoadScheduler.h index 163b67e..f2e627f 100644 --- a/Source/WebCore/loader/ResourceLoadScheduler.h +++ b/Source/WebCore/loader/ResourceLoadScheduler.h @@ -44,7 +44,8 @@ class ResourceRequest; class SubresourceLoader; class SubresourceLoaderClient; -class ResourceLoadScheduler : public Noncopyable { +class ResourceLoadScheduler { + WTF_MAKE_NONCOPYABLE(ResourceLoadScheduler); public: friend ResourceLoadScheduler* resourceLoadScheduler(); @@ -69,7 +70,8 @@ private: void scheduleServePendingRequests(); void requestTimerFired(Timer<ResourceLoadScheduler>*); - class HostInformation : public Noncopyable { + class HostInformation { + WTF_MAKE_NONCOPYABLE(HostInformation); public: HostInformation(const String&, unsigned); ~HostInformation(); diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index eba3173..ae8ce98 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -184,17 +184,6 @@ PassRefPtr<Widget> SubframeLoader::loadMediaPlayerProxyPlugin(Node* node, const return widget ? widget.release() : 0; } - -void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget) -{ - m_client->hideMediaPlayerProxyPlugin(widget); -} - -void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget) -{ - m_client->showMediaPlayerProxyPlugin(widget); -} - #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) diff --git a/Source/WebCore/loader/SubframeLoader.h b/Source/WebCore/loader/SubframeLoader.h index a573045..ba63a5c 100644 --- a/Source/WebCore/loader/SubframeLoader.h +++ b/Source/WebCore/loader/SubframeLoader.h @@ -54,7 +54,8 @@ class Node; class Widget; // This is a slight misnomer. It handles the higher level logic of loading both subframes and plugins. -class SubframeLoader : public Noncopyable { +class SubframeLoader { + WTF_MAKE_NONCOPYABLE(SubframeLoader); public: SubframeLoader(Frame*); diff --git a/Source/WebCore/loader/ThreadableLoader.h b/Source/WebCore/loader/ThreadableLoader.h index f41a774..f574c94 100644 --- a/Source/WebCore/loader/ThreadableLoader.h +++ b/Source/WebCore/loader/ThreadableLoader.h @@ -65,7 +65,8 @@ namespace WebCore { // Useful for doing loader operations from any thread (not threadsafe, // just able to run on threads other than the main thread). - class ThreadableLoader : public Noncopyable { + class ThreadableLoader { + WTF_MAKE_NONCOPYABLE(ThreadableLoader); public: static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); @@ -75,6 +76,7 @@ namespace WebCore { void deref() { derefThreadableLoader(); } protected: + ThreadableLoader() { } virtual ~ThreadableLoader() { } virtual void refThreadableLoader() = 0; virtual void derefThreadableLoader() = 0; diff --git a/Source/WebCore/loader/ThreadableLoaderClient.h b/Source/WebCore/loader/ThreadableLoaderClient.h index bcf68be..cea8b0f 100644 --- a/Source/WebCore/loader/ThreadableLoaderClient.h +++ b/Source/WebCore/loader/ThreadableLoaderClient.h @@ -31,14 +31,14 @@ #ifndef ThreadableLoaderClient_h #define ThreadableLoaderClient_h -#include <wtf/Noncopyable.h> namespace WebCore { class ResourceError; class ResourceResponse; - class ThreadableLoaderClient : public Noncopyable { + class ThreadableLoaderClient { + WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient); WTF_MAKE_FAST_ALLOCATED; public: virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } @@ -51,6 +51,7 @@ namespace WebCore { virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { } protected: + ThreadableLoaderClient() { } virtual ~ThreadableLoaderClient() { } }; diff --git a/Source/WebCore/loader/WorkerThreadableLoader.h b/Source/WebCore/loader/WorkerThreadableLoader.h index 81da2e0..65cc637 100644 --- a/Source/WebCore/loader/WorkerThreadableLoader.h +++ b/Source/WebCore/loader/WorkerThreadableLoader.h @@ -54,6 +54,7 @@ namespace WebCore { struct CrossThreadResourceRequestData; class WorkerThreadableLoader : public RefCounted<WorkerThreadableLoader>, public ThreadableLoader { + WTF_MAKE_FAST_ALLOCATED; public: static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h index 2d8b83e..f3a117e 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -53,7 +53,8 @@ enum ApplicationCacheUpdateOption { ApplicationCacheUpdateWithoutBrowsingContext }; -class ApplicationCacheGroup : public Noncopyable, ResourceHandleClient { +class ApplicationCacheGroup : ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(ApplicationCacheGroup); WTF_MAKE_FAST_ALLOCATED; public: ApplicationCacheGroup(const KURL& manifestURL, bool isCopy = false); ~ApplicationCacheGroup(); diff --git a/Source/WebCore/loader/appcache/ApplicationCacheHost.h b/Source/WebCore/loader/appcache/ApplicationCacheHost.h index 8ac5357..a1f2841 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheHost.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheHost.h @@ -58,7 +58,8 @@ namespace WebCore { class ApplicationCacheStorage; #endif - class ApplicationCacheHost : public Noncopyable { + class ApplicationCacheHost { + WTF_MAKE_NONCOPYABLE(ApplicationCacheHost); WTF_MAKE_FAST_ALLOCATED; public: // The Status numeric values are specified in the HTML5 spec. enum Status { diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h index 7db34e6..8bfdf13 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -44,7 +44,8 @@ template <class T> class StorageIDJournal; class SecurityOrigin; -class ApplicationCacheStorage : public Noncopyable { +class ApplicationCacheStorage { + WTF_MAKE_NONCOPYABLE(ApplicationCacheStorage); WTF_MAKE_FAST_ALLOCATED; public: enum FailureReason { OriginQuotaReached, diff --git a/Source/WebCore/loader/archive/ArchiveResourceCollection.h b/Source/WebCore/loader/archive/ArchiveResourceCollection.h index 9d630d1..fd2ddbf 100644 --- a/Source/WebCore/loader/archive/ArchiveResourceCollection.h +++ b/Source/WebCore/loader/archive/ArchiveResourceCollection.h @@ -39,7 +39,8 @@ namespace WebCore { -class ArchiveResourceCollection : public Noncopyable { +class ArchiveResourceCollection { + WTF_MAKE_NONCOPYABLE(ArchiveResourceCollection); WTF_MAKE_FAST_ALLOCATED; public: ArchiveResourceCollection(); diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index 3600a02..5c8b38f 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -50,7 +50,8 @@ class PurgeableBuffer; // A resource that is held in the cache. Classes who want to use this object should derive // from CachedResourceClient, to get the function calls in case the requested data has arrived. // This class also does the actual communication with the loader to obtain the resource from the network. -class CachedResource : public Noncopyable { +class CachedResource { + WTF_MAKE_NONCOPYABLE(CachedResource); WTF_MAKE_FAST_ALLOCATED; friend class MemoryCache; friend class InspectorResource; diff --git a/Source/WebCore/loader/cache/CachedResourceClient.h b/Source/WebCore/loader/cache/CachedResourceClient.h index 275d331..1c56f13 100644 --- a/Source/WebCore/loader/cache/CachedResourceClient.h +++ b/Source/WebCore/loader/cache/CachedResourceClient.h @@ -45,8 +45,8 @@ namespace WebCore { * inherit from this class and overload one of the 3 functions * */ - class CachedResourceClient : public FastAllocBase - { + class CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: virtual ~CachedResourceClient() { } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index bc351ce..4f67e72 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -49,7 +49,8 @@ class ImageLoader; class KURL; // The CachedResourceLoader manages the loading of scripts/images/stylesheets for a single document. -class CachedResourceLoader : public Noncopyable { +class CachedResourceLoader { + WTF_MAKE_NONCOPYABLE(CachedResourceLoader); WTF_MAKE_FAST_ALLOCATED; friend class ImageLoader; public: diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp index 54b4503..8950ddb 100644 --- a/Source/WebCore/loader/cache/CachedScript.cpp +++ b/Source/WebCore/loader/cache/CachedScript.cpp @@ -34,6 +34,10 @@ #include "TextResourceDecoder.h" #include <wtf/Vector.h> +#if USE(JSC) +#include <parser/SourceProvider.h> +#endif + namespace WebCore { CachedScript::CachedScript(const String& url, const String& charset) @@ -111,7 +115,12 @@ void CachedScript::error(CachedResource::Status status) void CachedScript::destroyDecodedData() { m_script = String(); - setDecodedSize(0); + unsigned extraSize = 0; +#if USE(JSC) + // FIXME: SourceInfoCache should be wiped out too but not this easily. + extraSize = m_sourceProviderCache ? m_sourceProviderCache->byteSize() : 0; +#endif + setDecodedSize(extraSize); if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable()) makePurgeable(true); } @@ -121,4 +130,18 @@ void CachedScript::decodedDataDeletionTimerFired(Timer<CachedScript>*) destroyDecodedData(); } +#if USE(JSC) +JSC::SourceProviderCache* CachedScript::sourceProviderCache() const +{ + if (!m_sourceProviderCache) + m_sourceProviderCache = adoptPtr(new JSC::SourceProviderCache); + return m_sourceProviderCache.get(); +} + +void CachedScript::sourceProviderCacheSizeChanged(int delta) +{ + setDecodedSize(decodedSize() + delta); +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/loader/cache/CachedScript.h b/Source/WebCore/loader/cache/CachedScript.h index 30fcb1e..14294f2 100644 --- a/Source/WebCore/loader/cache/CachedScript.h +++ b/Source/WebCore/loader/cache/CachedScript.h @@ -29,6 +29,12 @@ #include "CachedResource.h" #include "Timer.h" +#if USE(JSC) +namespace JSC { + class SourceProviderCache; +} +#endif + namespace WebCore { class CachedResourceLoader; @@ -51,7 +57,11 @@ namespace WebCore { void checkNotify(); virtual void destroyDecodedData(); - +#if USE(JSC) + // Allows JSC to cache additional information about the source. + JSC::SourceProviderCache* sourceProviderCache() const; + void sourceProviderCacheSizeChanged(int delta); +#endif private: void decodedDataDeletionTimerFired(Timer<CachedScript>*); virtual PurgePriority purgePriority() const { return PurgeLast; } @@ -59,6 +69,9 @@ namespace WebCore { String m_script; RefPtr<TextResourceDecoder> m_decoder; Timer<CachedScript> m_decodedDataDeletionTimer; +#if USE(JSC) + mutable OwnPtr<JSC::SourceProviderCache> m_sourceProviderCache; +#endif }; } diff --git a/Source/WebCore/loader/cache/MemoryCache.h b/Source/WebCore/loader/cache/MemoryCache.h index 7a567ea..12452c1 100644 --- a/Source/WebCore/loader/cache/MemoryCache.h +++ b/Source/WebCore/loader/cache/MemoryCache.h @@ -70,7 +70,8 @@ class KURL; // its member variables) are allocated in non-purgeable TC-malloc'd memory so we would see slightly // more memory use due to this. -class MemoryCache : public Noncopyable { +class MemoryCache { + WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED; public: friend MemoryCache* memoryCache(); diff --git a/Source/WebCore/loader/icon/IconDatabase.h b/Source/WebCore/loader/icon/IconDatabase.h index 6146aa6..e08dcd4 100644 --- a/Source/WebCore/loader/icon/IconDatabase.h +++ b/Source/WebCore/loader/icon/IconDatabase.h @@ -62,8 +62,8 @@ enum IconLoadDecision { IconLoadUnknown }; -class IconDatabase : public Noncopyable { - +class IconDatabase { + WTF_MAKE_NONCOPYABLE(IconDatabase); WTF_MAKE_FAST_ALLOCATED; // *** Main Thread Only *** public: void setClient(IconDatabaseClient*); diff --git a/Source/WebCore/loader/icon/IconDatabaseClient.h b/Source/WebCore/loader/icon/IconDatabaseClient.h index c210d7d..f97a2a8 100644 --- a/Source/WebCore/loader/icon/IconDatabaseClient.h +++ b/Source/WebCore/loader/icon/IconDatabaseClient.h @@ -29,6 +29,7 @@ #ifndef IconDatabaseClient_h #define IconDatabaseClient_h +#include <wtf/FastAllocBase.h> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -37,8 +38,10 @@ namespace WebCore { -class IconDatabaseClient : public Noncopyable { +class IconDatabaseClient { + WTF_MAKE_NONCOPYABLE(IconDatabaseClient); WTF_MAKE_FAST_ALLOCATED; public: + IconDatabaseClient() { } virtual ~IconDatabaseClient() { } virtual bool performImport() { return true; } virtual void dispatchDidRemoveAllIcons() { } diff --git a/Source/WebCore/loader/icon/IconLoader.h b/Source/WebCore/loader/icon/IconLoader.h index 1ebac48..2985393 100644 --- a/Source/WebCore/loader/icon/IconLoader.h +++ b/Source/WebCore/loader/icon/IconLoader.h @@ -37,7 +37,8 @@ class Frame; class KURL; class SharedBuffer; -class IconLoader : private SubresourceLoaderClient, public Noncopyable { +class IconLoader : private SubresourceLoaderClient { + WTF_MAKE_NONCOPYABLE(IconLoader); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<IconLoader> create(Frame*); ~IconLoader(); diff --git a/Source/WebCore/loader/icon/PageURLRecord.h b/Source/WebCore/loader/icon/PageURLRecord.h index f7ccb8f..7935dc9 100644 --- a/Source/WebCore/loader/icon/PageURLRecord.h +++ b/Source/WebCore/loader/icon/PageURLRecord.h @@ -51,7 +51,8 @@ public: String iconURL; }; -class PageURLRecord : public Noncopyable { +class PageURLRecord { + WTF_MAKE_NONCOPYABLE(PageURLRecord); WTF_MAKE_FAST_ALLOCATED; public: PageURLRecord(const String& pageURL); ~PageURLRecord(); |