diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 44d9a10ab..458b1c169 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -28,7 +28,6 @@ #include "Arguments.h" #include "ImmutableArray.h" -#include "InjectedBundleMessageKinds.h" #include "InjectedBundleScriptWorld.h" #include "InjectedBundleUserMessageCoders.h" #include "LayerTreeHost.h" @@ -61,6 +60,7 @@ #include <WebCore/PageVisibilityState.h> #include <WebCore/PrintContext.h> #include <WebCore/ResourceHandle.h> +#include <WebCore/ResourceLoadScheduler.h> #include <WebCore/ScriptController.h> #include <WebCore/SecurityOrigin.h> #include <WebCore/SecurityPolicy.h> @@ -426,23 +426,24 @@ bool InjectedBundle::isProcessingUserGesture() return ScriptController::processingUserGesture(); } -static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns) +static Vector<String> toStringVector(ImmutableArray* patterns) { + Vector<String> patternsVector; + if (!patterns) - return nullptr; + return patternsVector; - size_t size = patterns->size(); + size_t size = patterns->size(); if (!size) - return nullptr; + return patternsVector; - OwnPtr<Vector<String> > patternsVector = adoptPtr(new Vector<String>); - patternsVector->reserveInitialCapacity(size); + patternsVector.reserveInitialCapacity(size); for (size_t i = 0; i < size; ++i) { WebString* entry = patterns->at<WebString>(i); if (entry) - patternsVector->uncheckedAppend(entry->string()); + patternsVector.uncheckedAppend(entry->string()); } - return patternsVector.release(); + return patternsVector; } void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames) @@ -540,46 +541,9 @@ void InjectedBundle::didReceiveMessageToPage(WebPage* page, const String& messag m_client.didReceiveMessageToPage(this, page, messageName, messageBody); } -void InjectedBundle::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) -{ - switch (messageID.get<InjectedBundleMessage::Kind>()) { - case InjectedBundleMessage::PostMessage: { - String messageName; - RefPtr<APIObject> messageBody; - InjectedBundleUserMessageDecoder messageDecoder(messageBody); - if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) - return; - - didReceiveMessage(messageName, messageBody.get()); - return; - } - - case InjectedBundleMessage::PostMessageToPage: { - uint64_t pageID = arguments->destinationID(); - if (!pageID) - return; - - WebPage* page = WebProcess::shared().webPage(pageID); - if (!page) - return; - - String messageName; - RefPtr<APIObject> messageBody; - InjectedBundleUserMessageDecoder messageDecoder(messageBody); - if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) - return; - - didReceiveMessageToPage(page, messageName, messageBody.get()); - return; - } - } - - ASSERT_NOT_REACHED(); -} - void InjectedBundle::setPageVisibilityState(WebPage* page, int state, bool isInitialState) { -#if ENABLE(PAGE_VISIBILITY_API) +#if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) page->corePage()->setVisibilityState(static_cast<PageVisibilityState>(state), isInitialState); #endif } @@ -646,4 +610,14 @@ void InjectedBundle::setTabKeyCyclesThroughElements(WebPage* page, bool enabled) page->corePage()->setTabKeyCyclesThroughElements(enabled); } +void InjectedBundle::setSerialLoadingEnabled(bool enabled) +{ + resourceLoadScheduler()->setSerialLoadingEnabled(enabled); +} + +void InjectedBundle::dispatchPendingLoadRequests() +{ + resourceLoadScheduler()->servePendingRequests(); +} + } // namespace WebKit |