Changeset 58380 in webkit


Ignore:
Timestamp:
Apr 27, 2010 10:40:23 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-27 Michael Nordman <Michael Nordman>

Reviewed by Dmitry Titov.

[Chromium] Add two things to the webkit API to support appcaches in workers.
1) WebURLRequest TargetTypes for worker and shared worker main resources.
2) Factory method on class WebCommonWorkerClient to

createApplicationCacheHost() for the associated worker.

https://bugs.webkit.org/show_bug.cgi?id=38147

  • public/WebCommonWorkerClient.h: add the factory method
  • public/WebURLRequest.h: add the TargetTypes
  • src/WebWorkerBase.cpp: call the embedder's factory when needed (WebKit::WebWorkerBase::didCreateDataSource) (WebKit::WebWorkerBase::createApplicationCacheHost)
  • src/WebWorkerBase.h: ditto
  • src/WebWorkerClientImpl.h: add a stub impl of the factory method (WebKit::WebWorkerClientImpl::createApplicationCacheHost):

2010-04-27 Michael Nordman <Michael Nordman>

Reviewed by Dmitry Titov.

[Chromium] Add two things to the webkit API to support appcaches in workers.
1) WebURLRequest TargetTypes for worker and shared worker main resources.
2) Factory method on class WebCommonWorkerClient to

createApplicationCacheHost() for the associated worker.

https://bugs.webkit.org/show_bug.cgi?id=38147

  • DumpRenderTree/chromium/TestWebWorker.h add a stub impl of the factory method (TestWebWorker::createApplicationCacheHost):
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r58377 r58380  
     12010-04-27  Michael Nordman  <michaeln@google.com>
     2
     3        Reviewed by Dmitry Titov.
     4
     5        [Chromium] Add two things to the webkit API to support appcaches in workers.
     6        1) WebURLRequest TargetTypes for worker and shared worker main resources.
     7        2) Factory method on class WebCommonWorkerClient to
     8           createApplicationCacheHost() for the associated worker.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=38147
     11
     12        * public/WebCommonWorkerClient.h: add the factory method
     13        * public/WebURLRequest.h: add the TargetTypes
     14        * src/WebWorkerBase.cpp: call the embedder's factory when needed
     15        (WebKit::WebWorkerBase::didCreateDataSource)
     16        (WebKit::WebWorkerBase::createApplicationCacheHost)
     17        * src/WebWorkerBase.h: ditto
     18        * src/WebWorkerClientImpl.h: add a stub impl of the factory method
     19        (WebKit::WebWorkerClientImpl::createApplicationCacheHost):
     20
    1212010-04-27  Kent Tamura  <tkent@chromium.org>
    222
  • trunk/WebKit/chromium/public/WebCommonWorkerClient.h

    r57210 r58380  
    3434namespace WebKit {
    3535
     36class WebApplicationCacheHost;
     37class WebApplicationCacheHostClient;
    3638class WebNotificationPresenter;
    3739class WebString;
     
    7577    virtual WebWorker* createWorker(WebWorkerClient* client) = 0;
    7678
     79    // Called on the main webkit thread in the worker process during initialization.
     80    virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0;
     81
    7782protected:
    7883    ~WebCommonWorkerClient() { }
  • trunk/WebKit/chromium/public/WebURLRequest.h

    r51967 r58380  
    6868        TargetIsImage = 6,
    6969        TargetIsObject = 7,
    70         TargetIsMedia = 8
     70        TargetIsMedia = 8,
     71        TargetIsWorker = 9,
     72        TargetIsSharedWorker = 10
    7173    };
    7274
  • trunk/WebKit/chromium/src/WebWorkerBase.cpp

    r57210 r58380  
    5252#if ENABLE(WORKERS)
    5353
    54 // Dummy WebViewDelegate - we only need it in Worker process to load a
    55 // 'shadow page' which will initialize WebCore loader.
    56 class WorkerWebFrameClient : public WebFrameClient {
    57 public:
    58     // Tell the loader to load the data into the 'shadow page' synchronously,
    59     // so we can grab the resulting Document right after load.
    60     virtual void didCreateDataSource(WebFrame* frame, WebDataSource* ds)
    61     {
    62         static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false);
    63     }
    64 
    65     // Lazy allocate and leak this instance.
    66     static WorkerWebFrameClient* sharedInstance()
    67     {
    68         static WorkerWebFrameClient client;
    69         return &client;
    70     }
    71 
    72 private:
    73     WorkerWebFrameClient()
    74     {
    75     }
    76 };
    77 
    7854// This function is called on the main thread to force to initialize some static
    7955// values used in WebKit before any worker thread is started. This is because in
     
    10480{
    10581    ASSERT(m_webView);
     82    WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     83    if (webFrame)
     84        webFrame->setClient(0);
    10685    m_webView->close();
    10786}
     
    123102    ASSERT(!m_webView);
    124103    m_webView = WebView::create(0);
    125     m_webView->initializeMainFrame(WorkerWebFrameClient::sharedInstance());
     104    m_webView->initializeMainFrame(this);
    126105
    127106    WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     
    152131}
    153132
     133void WebWorkerBase::didCreateDataSource(WebFrame*, WebDataSource* ds)
     134{
     135    // Tell the loader to load the data into the 'shadow page' synchronously,
     136    // so we can grab the resulting Document right after load.
     137    static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false);
     138}
     139
     140WebApplicationCacheHost* WebWorkerBase::createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient* appcacheHostClient)
     141{
     142    if (commonClient())
     143        return commonClient()->createApplicationCacheHost(appcacheHostClient);
     144    return 0;
     145}
     146
    154147// WorkerObjectProxy -----------------------------------------------------------
    155148
  • trunk/WebKit/chromium/src/WebWorkerBase.h

    r57210 r58380  
    3535
    3636#include "ScriptExecutionContext.h"
     37#include "WebFrameClient.h"
    3738#include "WorkerLoaderProxy.h"
    3839#include "WorkerObjectProxy.h"
     
    4546
    4647namespace WebKit {
     48class WebApplicationCacheHost;
     49class WebApplicationCacheHostClient;
    4750class WebCommonWorkerClient;
    4851class WebSecurityOrigin;
     
    5760// WorkerObjectProxy and WorkerLoaderProxy interfaces.
    5861class WebWorkerBase : public WebCore::WorkerObjectProxy
    59                     , public WebCore::WorkerLoaderProxy {
     62                    , public WebCore::WorkerLoaderProxy
     63                    , public WebFrameClient {
    6064public:
    6165    WebWorkerBase();
     
    8084    virtual void postTaskForModeToWorkerContext(
    8185        PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode);
     86
     87    // WebFrameClient methods to support resource loading thru the 'shadow page'.
     88    virtual void didCreateDataSource(WebFrame*, WebDataSource*);
     89    virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*);
    8290
    8391    // Executes the given task on the main thread.
  • trunk/WebKit/chromium/src/WebWorkerClientImpl.h

    r57210 r58380  
    9595        return 0;
    9696    }
     97    virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; }
    9798
    9899private:
  • trunk/WebKitTools/ChangeLog

    r58376 r58380  
     12010-04-27  Michael Nordman  <michaeln@google.com>
     2
     3        Reviewed by Dmitry Titov.
     4
     5        [Chromium] Add two things to the webkit API to support appcaches in workers.
     6        1) WebURLRequest TargetTypes for worker and shared worker main resources.
     7        2) Factory method on class WebCommonWorkerClient to
     8           createApplicationCacheHost() for the associated worker.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=38147
     11
     12        * DumpRenderTree/chromium/TestWebWorker.h add a stub impl of the factory method
     13        (TestWebWorker::createApplicationCacheHost):
     14
    1152010-04-27  Adam Barth  <abarth@webkit.org>
    216
  • trunk/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h

    r57648 r58380  
    8080    virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient*) { return 0; }
    8181    virtual WebKit::WebNotificationPresenter* notificationPresenter() { return 0; }
     82    virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebApplicationCacheHostClient*) { return 0; }
    8283
    8384private:
Note: See TracChangeset for help on using the changeset viewer.