Changeset 145516 in webkit


Ignore:
Timestamp:
Mar 12, 2013 4:14:42 AM (11 years ago)
Author:
jocelyn.turcotte@digia.com
Message:

[Qt] Properly layer QtWebContext on top of the C API
https://bugs.webkit.org/show_bug.cgi?id=108475

Reviewed by Simon Hausmann.
Signed off for WebKit2 by Benjamin Poulain.

  • UIProcess/API/qt/qquickwebview.cpp:

(QQuickWebViewPrivate::initialize):

  • UIProcess/qt/QtWebContext.cpp:

(WebKit::initializeContextInjectedBundleClient):
(WebKit::QtWebContext::QtWebContext):
(WebKit::QtWebContext::create):
(WebKit::QtWebContext::defaultContext):

  • UIProcess/qt/QtWebContext.h:

(WebKit):
(QtWebContext):
(WebKit::QtWebContext::context):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r145515 r145516  
     12013-02-14  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
     2
     3        [Qt] Properly layer QtWebContext on top of the C API
     4        https://bugs.webkit.org/show_bug.cgi?id=108475
     5
     6        Reviewed by Simon Hausmann.
     7        Signed off for WebKit2 by Benjamin Poulain.
     8
     9        * UIProcess/API/qt/qquickwebview.cpp:
     10        (QQuickWebViewPrivate::initialize):
     11        * UIProcess/qt/QtWebContext.cpp:
     12        (WebKit::initializeContextInjectedBundleClient):
     13        (WebKit::QtWebContext::QtWebContext):
     14        (WebKit::QtWebContext::create):
     15        (WebKit::QtWebContext::defaultContext):
     16        * UIProcess/qt/QtWebContext.h:
     17        (WebKit):
     18        (QtWebContext):
     19        (WebKit::QtWebContext::context):
     20
    1212013-02-14  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
    222
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r145515 r145516  
    3535#include "QtWebPagePolicyClient.h"
    3636#include "WebBackForwardList.h"
     37#include "WebContext.h"
    3738#include "WebFindOptions.h"
    3839#if ENABLE(INSPECTOR_SERVER)
     
    322323        pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(0));
    323324
    324     context = contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext();
    325     webPageProxy = context->createWebPage(&pageClient, toImpl(pageGroup.get()));
     325    context = contextRef ? QtWebContext::create(contextRef) : QtWebContext::defaultContext();
     326    webPageProxy = toImpl(context->context())->createWebPage(&pageClient, toImpl(pageGroup.get()));
    326327    webPage = toAPI(webPageProxy.get());
    327328    pageToView()->insert(webPage.get(), this);
  • trunk/Source/WebKit2/UIProcess/qt/QtWebContext.cpp

    r145515 r145516  
    2424#include "QtDownloadManager.h"
    2525#include "QtWebIconDatabaseClient.h"
    26 #include "WKAPICast.h"
    27 #include "WebContext.h"
    2826#include "WebInspectorServer.h"
    2927#include "qquickwebview_p_p.h"
     28#include <WKAPICast.h>
    3029#include <WKArray.h>
    3130#include <WKPage.h>
     
    103102}
    104103
    105 static void initializeContextInjectedBundleClient(WebContext* context)
     104static void initializeContextInjectedBundleClient(WKContextRef context)
    106105{
    107106    WKContextInjectedBundleClient injectedBundleClient;
     
    109108    injectedBundleClient.version = kWKContextInjectedBundleClientCurrentVersion;
    110109    injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
    111     WKContextSetInjectedBundleClient(toAPI(context), &injectedBundleClient);
     110    WKContextSetInjectedBundleClient(context, &injectedBundleClient);
    112111}
    113112
    114 QtWebContext::QtWebContext(PassRefPtr<WebContext> context)
     113QtWebContext::QtWebContext(WKContextRef context)
    115114    : m_context(context)
    116     , m_downloadManager(new QtDownloadManager(m_context.get()))
    117     , m_iconDatabase(new QtWebIconDatabaseClient(m_context.get()))
     115    , m_downloadManager(new QtDownloadManager(toImpl(context)))
     116    , m_iconDatabase(new QtWebIconDatabaseClient(toImpl(context)))
    118117{
    119118}
     
    124123
    125124// Used directly only by WebKitTestRunner.
    126 QtWebContext* QtWebContext::create(PassRefPtr<WebContext> context)
     125QtWebContext* QtWebContext::create(WKContextRef context)
    127126{
    128127    globalInitialization();
     
    133132{
    134133    if (!s_defaultQtWebContext) {
    135         RefPtr<WebContext> webContext = WebContext::create(String());
     134        WKRetainPtr<WKContextRef> wkContext = adoptWK(WKContextCreate());
    136135        // Make sure for WebKitTestRunner that the injected bundle client isn't initialized
    137136        // and that the page cache isn't enabled (defaultContext() isn't used there).
    138         initializeContextInjectedBundleClient(webContext.get());
     137        initializeContextInjectedBundleClient(wkContext.get());
    139138        // A good all-around default.
    140         webContext->setCacheModel(CacheModelDocumentBrowser);
     139        WKContextSetCacheModel(wkContext.get(), kWKCacheModelDocumentBrowser);
    141140
    142         s_defaultQtWebContext = QtWebContext::create(webContext.release());
     141        s_defaultQtWebContext = QtWebContext::create(wkContext.get());
    143142    }
    144143
     
    146145}
    147146
    148 PassRefPtr<WebPageProxy> QtWebContext::createWebPage(PageClient* client, WebPageGroup* pageGroup)
    149 {
    150     return m_context->createWebPage(client, pageGroup);
    151 }
    152 
    153147} // namespace WebKit
    154148
  • trunk/Source/WebKit2/UIProcess/qt/QtWebContext.h

    r145513 r145516  
    2525#include <QtGlobal>
    2626#include <WKContext.h>
    27 #include <wtf/OwnPtr.h>
    28 #include <wtf/PassRefPtr.h>
    29 #include <wtf/RefCounted.h>
    30 #include <wtf/RefPtr.h>
     27#include <WKRetainPtr.h>
    3128
    3229namespace WebKit {
    3330
    34 class PageClient;
    3531class QtDownloadManager;
    3632class QtWebIconDatabaseClient;
    37 class WebContext;
    38 class WebPageGroup;
    39 class WebPageProxy;
    4033
    4134class QtWebContext {
     
    4336    ~QtWebContext();
    4437
    45     static QtWebContext* create(PassRefPtr<WebContext>);
     38    static QtWebContext* create(WKContextRef);
    4639    static QtWebContext* defaultContext();
    4740
    48     PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebPageGroup*);
    49 
    50     WebContext* context() { return m_context.get(); }
     41    WKContextRef context() { return m_context.get(); }
    5142
    5243    QtDownloadManager* downloadManager() { return m_downloadManager.data(); }
     
    5445
    5546private:
    56     explicit QtWebContext(PassRefPtr<WebContext>);
     47    explicit QtWebContext(WKContextRef);
    5748
    58     RefPtr<WebContext> m_context;
     49    WKRetainPtr<WKContextRef> m_context;
    5950    QScopedPointer<QtDownloadManager> m_downloadManager;
    6051    QScopedPointer<QtWebIconDatabaseClient> m_iconDatabase;
Note: See TracChangeset for help on using the changeset viewer.