1. 30 Sep, 2013 1 commit
    • weinig@apple.com's avatar
      Cleanup PageThrottler and PageConsole a bit · f2ead0f7
      weinig@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=122085
      
      Reviewed by Anders Carlsson.
      
      * html/HTMLMediaElement.h:
      * loader/FrameLoader.cpp:
      (WebCore::FrameLoader::completed):
      * loader/FrameLoader.h:
      * loader/SubresourceLoader.cpp:
      (WebCore::SubresourceLoader::checkForHTTPStatusCodeError):
      (WebCore::SubresourceLoader::didFinishLoading):
      (WebCore::SubresourceLoader::didFail):
      (WebCore::SubresourceLoader::willCancel):
      * loader/SubresourceLoader.h:
      Store the PageActivityAssertionToken as a std::unique_ptr.
      
      * page/Page.cpp:
      (WebCore::Page::Page):
      Use createOwned and pass this by reference for the PageThrottler and PageConsole.
      (WebCore::Page::~Page):
      Remove unnecessary clearing of an OwnPtr that is about to be destroyed.
      * page/Page.h:
      Make m_pageThrottler const and return it as a reference.
      
      * page/PageActivityAssertionToken.cpp:
      (WebCore::PageActivityAssertionToken::PageActivityAssertionToken):
      (WebCore::PageActivityAssertionToken::~PageActivityAssertionToken):
      * page/PageActivityAssertionToken.h:
      Take the PageThrottler by reference in the constructor. It is never null.
      
      * page/PageConsole.cpp:
      (WebCore::PageConsole::PageConsole):
      (WebCore::PageConsole::~PageConsole):
      (WebCore::PageConsole::addMessage):
      * page/PageConsole.h:
      Pass and store the Page as a reference and remove an extraneous null check. Remove
      the create function.
      
      * page/PageThrottler.cpp:
      (WebCore::PageThrottler::PageThrottler):
      (WebCore::PageThrottler::~PageThrottler):
      (WebCore::PageThrottler::createActivityToken):
      (WebCore::PageThrottler::throttlePage):
      (WebCore::PageThrottler::unthrottlePage):
      (WebCore::PageThrottler::addActivityToken):
      (WebCore::PageThrottler::removeActivityToken):
      * page/PageThrottler.h:
      Pass and store the Page as a reference. Move the creation of PageActivityAssertionToken here
      to aid encapsulation.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f2ead0f7
  2. 30 May, 2013 1 commit
    • jer.noble@apple.com's avatar
      HTMLMediaElement will not unthrottle page when playback stops for nreasons... · 5d7d9775
      jer.noble@apple.com authored
      HTMLMediaElement will not unthrottle page when playback stops for nreasons other than user-initiated pause.
      https://bugs.webkit.org/show_bug.cgi?id=117016
      
      Reviewed by Oliver Hunt.
      
      Add a new class PageActivityAssertionToken to allow HTMLMediaElement to decouple
      knowledge of and control over the lifetime of PageThrottler. The new class will
      have weak references to and from the PageThrottler so that holders of the token
      will not need to care if the Page or PageThrottler has been destroyed.
      
      HTMLMediaElement will create one of these PageActivityAssertionTokens when playback
      begins and destroy it when playback stops for any reason, or when the element is
      destroyed.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::~HTMLMediaElement):
      (WebCore::HTMLMediaElement::playInternal):
      (WebCore::HTMLMediaElement::pauseInternal):
      (WebCore::HTMLMediaElement::playbackProgressTimerFired):
      (WebCore::HTMLMediaElement::updatePlayState):
      * html/HTMLMediaElement.h:
      * page/Page.cpp:
      (WebCore::createActivityToken): Added simple factory method.
      * page/Page.h:
      * page/PageActivityAssertionToken.cpp:
      (WebCore::PageActivityAssertionToken::PageActivityAssertionToken): Call addActivityToken();
      (WebCore::PageActivityAssertionToken::~PageActivityAssertionToken): Call removeActivityToken();
      (WebCore::PageActivityAssertionToken::invalidate): Clear m_throttler.
      * page/PageActivityAssertionToken.h:
      * page/PageThrottler.cpp:
      (WebCore::PageThrottler::~PageThrottler): Invalidate all outstanding tokens.
      (WebCore::PageThrottler::addActivityToken): Bump the activity count.
      (WebCore::PageThrottler::removeActivityToken): Lower the activity count.
      * page/PageThrottler.h:
      
      Add the new files to the various build systems:
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * Target.pri:
      * WebCore.vcproj/WebCore.vcproj:
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * WebCore.xcodeproj/project.pbxproj:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5d7d9775
  3. 24 Apr, 2013 1 commit
    • jer.noble@apple.com's avatar
      WWDC session videos don’t play at developer.apple.com · 41d7ffb6
      jer.noble@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=114858
      
      Reviewed by Eric Carlson. Rubber stamped by Brady Eidson.
      
      AVFoundation uses CFNetwork to store and retrieve cookies from the global store.
      However, in the case where network access happens in the NetworkProcess, session
      cookies are stored in-memory, and are not accessable in the WebProcess. Until such
      a time as AVFoundation can provide an API which would allow us to provide cookies
      for a specific request, we will interpose the CFNetwork method which they use to
      retrieve the cookie string from the cookie store for their pending request.
      
      Duplicate the previous SecItemShim target to a new, WebProcessShim target. This
      target includes the SecItemShim functionality, but will add a new shim for cookie
      retrieval:
      * Shared/mac/CookieStorageShimLibrary.h: Added
      (CookieStorageShimCallbacks):
      * Shared/mac/CookieStorageShimLibrary.cpp: Added.
      (WebKit::ShimProtector::ShimProtector): A simple stack-based counter class.
      (WebKit::ShimProtector::~ShimProtector):
      (WebKit::ShimProtector::count):
      (WebKit::shimCFHTTPCookieStorageCopyRequestHeaderFieldsForURL): Interpose
          the CFNetwork call, and pass to the registered callback.
      (WebKit::WebKitCookieStorageShimInitialize): Register the callbacks.
      
      Add a helper singleton class which will talk to the shim through the
      registered callbacks:
      * Shared/mac/CookieStorageShim.h: Added
      (WebKit::CookieStorageShim::CookieStorageShim):
      * Shared/mac/CookieStorageShim.cpp: Added.
      (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Pass the request
          over to the NetworkProcess.
      (WebKit::CookieStorageShim::shared): Simple singleton.
      (WebKit::CookieStorageShim::initialize): Call the library initializer.
      
      Initialize the shim only when the WebProcess is delegating network loading
      to the NetworkProcess:
      * WebProcess/WebProcess.cpp:
      (WebKit::WebProcess::initializeWebProcess):
      
      Rename the WebProcess's shim from SecItemShim -> WebProcessShim:
      * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
      (WebKit::addDYLDEnvironmentAdditions):
      * WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:
      (WebKit::WebContentProcessMainDelegate::doPreInitializationWork):
      * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info.plist:
      * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
      (WebContentServiceInitializer):
      
      As the DYLD_INTERPOSE macro is used in multiple files now, put it in its
      own header:
      * Shared/mac/DyldInterpose.h: Added.
      * PluginProcess/mac/PluginProcessShim.mm:
      * WebProcess/mac/SecItemShimLibrary.mm:
      
      Add new files to the project:
      * WebKit2.xcodeproj/project.pbxproj:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      41d7ffb6
  4. 05 Jan, 2013 2 commits
    • weinig@apple.com's avatar
      Consolidate all the one time initialization functions into a single... · f15e3c10
      weinig@apple.com authored
      Consolidate all the one time initialization functions into a single InitializeWebKit2() super function
      https://bugs.webkit.org/show_bug.cgi?id=106161
      
      Reviewed by Simon Fraser.
      
      Adds InitializeWebKit2 and uses it.
      
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * NetworkProcess/NetworkProcess.cpp:
      (WebKit::NetworkProcess::initializeNetworkProcess):
      * NetworkProcess/mac/NetworkProcessInitialization.mm:
      (WebKit::initializeNetworkProcess):
      * PluginProcess/mac/PluginProcessMainMac.mm:
      (WebKit::PluginProcessMain):
      * Shared/WebKit2Initialize.cpp: Copied from Source/WebKit2/NetworkProcess/mac/NetworkProcessInitialization.mm.
      (WebKit::InitializeWebKit2):
      * Shared/WebKit2Initialize.h: Copied from Source/WebKit2/NetworkProcess/mac/NetworkProcessInitialization.mm.
      (WebKit):
      * SharedWorkerProcess/mac/SharedWorkerProcessMainMac.mm:
      (WebKit::SharedWorkerProcessMain):
      * Target.pri:
      * WebKit2.xcodeproj/project.pbxproj:
      * WebProcess/WebProcess.cpp:
      (WebKit::WebProcess::WebProcess):
      * WebProcess/mac/WebProcessInitialization.mm:
      (WebKit::initializeWebProcess):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f15e3c10
    • weinig@apple.com's avatar
      Consolidate process initialization in ChildProcess · 77f0002c
      weinig@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=106144
      
      Reviewed by Alexey Proskuryakov.
      
      Consolidate more functionality down into ChildProcess.
      
      * NetworkProcess/NetworkProcess.cpp:
      (WebKit::NetworkProcess::didReceiveMessage):
      (WebKit::NetworkProcess::didReceiveSyncMessage):
      (WebKit::NetworkProcess::downloadProxyConnection):
      (WebKit::NetworkProcess::initializeNetworkProcess):
      (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
      (WebKit::NetworkProcess::initializeSandbox):
      * NetworkProcess/NetworkProcess.h:
      * NetworkProcess/mac/NetworkProcessInitialization.h:
      * NetworkProcess/mac/NetworkProcessInitialization.mm:
      (WebKit::initializeNetworkProcess):
      * NetworkProcess/mac/NetworkProcessMac.mm:
      (WebKit::NetworkProcess::platformInitializeNetworkProcess):
      * NetworkProcess/mac/NetworkProcessMainMac.mm:
      (WebKit::NetworkProcessMain):
      * PluginProcess/PluginProcess.cpp:
      (WebKit::PluginProcess::PluginProcess):
      (WebKit::PluginProcess::initializePluginProcess):
      (WebKit::PluginProcess::createWebProcessConnection):
      (WebKit::PluginProcess::getSitesWithData):
      (WebKit::PluginProcess::clearSiteData):
      * PluginProcess/PluginProcess.h:
      (PluginProcess):
      * PluginProcess/mac/PluginProcessMac.mm:
      (WebKit::initializeShim):
      (WebKit::initializeCocoaOverrides):
      (WebKit::PluginProcess::platformInitialize):
      (WebKit::PluginProcess::platformInitializePluginProcess):
      * PluginProcess/mac/PluginProcessMainMac.mm:
      (WebKit::PluginProcessMain):
      * PluginProcess/qt/PluginProcessMainQt.cpp:
      (WebKit::PluginProcessMain):
      * PluginProcess/qt/PluginProcessQt.cpp:
      (WebKit::PluginProcess::platformInitializePluginProcess):
      * PluginProcess/unix/PluginProcessMainUnix.cpp:
      (WebKit::PluginProcessMainUnix):
      * PluginProcess/unix/PluginProcessUnix.cpp:
      (WebKit::PluginProcess::platformInitializePluginProcess):
      * Shared/ChildProcess.cpp:
      (WebKit::ChildProcess::ChildProcess):
      (WebKit::watchdogCallback):
      (WebKit::didCloseOnConnectionWorkQueue):
      (WebKit::ChildProcess::initialize):
      (WebKit::ChildProcess::initializeConnection):
      (WebKit::ChildProcess::initializeSandbox):
      (WebKit::ChildProcess::terminate):
      * Shared/ChildProcess.h:
      (ChildProcessInitializationParameters):
      (ChildProcess):
      (WebKit::ChildProcess::connection):
      (WebKit::ChildProcess::destinationID):
      (WebKit::ChildProcess::messageReceiverMap):
      * SharedWorkerProcess/SharedWorkerProcess.cpp:
      (WebKit::SharedWorkerProcess::initializeSharedWorkerProcess):
      * SharedWorkerProcess/SharedWorkerProcess.h:
      (SharedWorkerProcess):
      * SharedWorkerProcess/mac/SharedWorkerProcessMac.mm:
      (WebKit::SharedWorkerProcess::platformInitializeSharedWorkerProcess):
      * SharedWorkerProcess/mac/SharedWorkerProcessMainMac.mm:
      (WebKit::SharedWorkerProcessMain):
      * WebProcess/WebProcess.cpp:
      (WebKit::WebProcess::initializeConnection):
      (WebKit::WebProcess::downloadProxyConnection):
      (WebKit::WebProcess::initializeWebProcess):
      (WebKit::WebProcess::terminate):
      (WebKit::WebProcess::didReceiveSyncMessage):
      (WebKit::WebProcess::didReceiveMessage):
      (WebKit::WebProcess::removeWebFrame):
      (WebKit::WebProcess::initializeSandbox):
      * WebProcess/WebProcess.h:
      * WebProcess/efl/WebProcessMainEfl.cpp:
      (WebKit::WebProcessMainEfl):
      * WebProcess/gtk/WebProcessMainGtk.cpp:
      (WebKit::WebProcessMainGtk):
      * WebProcess/mac/WebProcessInitialization.h:
      * WebProcess/mac/WebProcessInitialization.mm:
      (WebKit::initializeWebProcess):
      * WebProcess/mac/WebProcessMac.mm:
      (WebKit::WebProcess::platformInitialize):
      * WebProcess/mac/WebProcessMainMac.mm:
      (WebKit::WebProcessMain):
      * WebProcess/mac/WebProcessServiceEntryPoints.mm:
      (WebKit::WebProcessServiceEventHandler):
      (initializeWebProcessForWebProcessServiceForWebKitDevelopment):
      * WebProcess/qt/WebProcessMainQt.cpp:
      (WebKit::WebProcessMainQt):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138868 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      77f0002c
  5. 04 Jan, 2013 1 commit
    • weinig@apple.com's avatar
      Make process initialization more uniform by renaming initialization methods... · d195069f
      weinig@apple.com authored
      Make process initialization more uniform by renaming initialization methods and removing extraneous parameters
      https://bugs.webkit.org/show_bug.cgi?id=106120
      
      Reviewed by Brady Eidson.
      
      Rename FooProcess::initialize() -> FooProcess::initializeConnection() and removes
      the RunLoop parameter since it is always the same the as RunLoop::main().
      
      * NetworkProcess/NetworkProcess.cpp:
      (WebKit::NetworkProcess::initializeConnection):
      * NetworkProcess/NetworkProcess.h:
      (NetworkProcess):
      * NetworkProcess/mac/NetworkProcessInitialization.mm:
      (WebKit::initializeNetworkProcess):
      * PluginProcess/PluginProcess.cpp:
      (WebKit::PluginProcess::initializeConnection):
      * PluginProcess/PluginProcess.h:
      * PluginProcess/mac/PluginProcessMainMac.mm:
      (WebKit::PluginProcessMain):
      * PluginProcess/qt/PluginProcessMainQt.cpp:
      (WebKit::PluginProcessMain):
      * PluginProcess/unix/PluginProcessMainUnix.cpp:
      (WebKit::PluginProcessMainUnix):
      * SharedWorkerProcess/SharedWorkerProcess.cpp:
      (WebKit::SharedWorkerProcess::initializeConnection):
      * SharedWorkerProcess/SharedWorkerProcess.h:
      (SharedWorkerProcess):
      * SharedWorkerProcess/mac/SharedWorkerProcessMainMac.mm:
      (WebKit::SharedWorkerProcessMain):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d195069f
  6. 02 Jan, 2013 1 commit