Changeset 73965 in webkit


Ignore:
Timestamp:
Dec 13, 2010 2:38:27 PM (13 years ago)
Author:
weinig@apple.com
Message:

Change the WebKit2 public API so there is no explicit WKPageNamespace object
https://bugs.webkit.org/show_bug.cgi?id=50898

Reviewed by Anders Carlsson.

WebKit2:

  • Shared/API/c/WKBase.h: Remove definition of WKPageNamespaceRef.
  • UIProcess/API/C/WKAPICast.h: Remove toAPI/toImpl for WKPageNamespaceRef.
  • UIProcess/API/C/WKPage.cpp:
  • UIProcess/API/C/WKPage.h:

Replace WKPageGetPageNamespace with WKPageGetContext.

  • UIProcess/API/C/WKPageNamespace.cpp: Removed.
  • UIProcess/API/C/WKPageNamespace.h: Removed.
  • UIProcess/API/C/WebKit2.h: Remove #include of WKPageNamespace.h.
  • UIProcess/API/C/win/WKView.cpp:

(WKViewCreate): Changed to take a WKContextRef instead of a WKPageNamespaceRef.
(WKViewCreateUsingSharedProcess): Added. Similar to WKViewCreate except that
all callers of it will have their views end up in the same shared process, whereas
with WKViewCreate, a new internal page namespace will be created and could place
the view's WebPage into a new process.
(WKViewCreateForAssociatedPage): Added. Creates a view that is forced to use the
same process as the passed in page.

  • UIProcess/win/WebView.cpp:

(WebKit::WebView::WebView):
(WebKit::WebView::initialize):

  • UIProcess/win/WebView.h:

(WebKit::WebView::create):
(WebKit::WebView::createUsingSharedProcess):
(WebKit::WebView::createForAssociatedPage):
Implementation of the WKView create functions.

  • UIProcess/API/C/win/WKView.h:
  • UIProcess/API/mac/WKView.h:
  • UIProcess/API/mac/WKView.mm:

(-[WKView initWithFrame:]):
(-[WKView initWithFrame:contextRef:]):
(-[WKView initWithFrame:contextRef:pageGroupRef:]):
(-[WKView initWithFrame:contextRef:usingSharedProcess:]):
(-[WKView initWithFrame:contextRef:pageGroupRef:usingSharedProcess:]):
(-[WKView initWithFrame:forAssociatedPageRef:]):
(-[WKView initWithFrame:forAssociatedPageRef:pageGroupRef:]):
(-[WKView initWithFrame:pageNamespace:pageGroup:]):
Add new initializers for the objective-c WKView. It follows the same
pattern as WKViewRef.

  • UIProcess/API/qt/qwkcontext.cpp:

(QWKContext::QWKContext):

  • UIProcess/API/qt/qwkcontext.h:

Remove uses of WKPageNamespaceRef.

  • UIProcess/WebContext.cpp:

(WebKit::WebContext::sharedPageNamespace): Returns a shared
page namespace used by the view's createUsingSharedProcess constructions.
(WebKit::WebContext::createPageNamespace): Change to return
a PassRefPtr to make things clearer.
(WebKit::WebContext::pageNamespaceWasDestroyed): Clear the shared
namespace if it is cleared.

  • UIProcess/WebContext.h:
  • UIProcess/WebPageNamespace.h: Remove unused "struct WKContextStatistics".
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::context):

  • UIProcess/WebPageProxy.h:

Add context getter.

  • UIProcess/mac/WebInspectorProxyMac.mm:

(WebKit::WebInspectorProxy::platformCreateInspectorPage):

  • UIProcess/win/WebInspectorProxyWin.cpp:

(WebKit::WebInspectorProxy::platformCreateInspectorPage):
Use forAssociatedPageRef constructor for the WebInspector view.

  • WebKit2.pro:
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
  • win/WebKit2Generated.make:

Remove WKPageNamespace.h/cpp.

WebKitTools:

  • MiniBrowser/mac/AppDelegate.h:
  • MiniBrowser/mac/AppDelegate.m:
  • MiniBrowser/mac/BrowserWindowController.h:
  • MiniBrowser/mac/BrowserWindowController.m:
  • MiniBrowser/win/BrowserView.cpp:

Convert MiniBrowser to not use PageNamespaces.

  • TestWebKitAPI/PlatformWebView.h:
  • TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp:
  • TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp:
  • TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp:
  • TestWebKitAPI/Tests/WebKit2/Find.cpp:
  • TestWebKitAPI/Tests/WebKit2/FrameMIMETypeHTML.cpp:
  • TestWebKitAPI/Tests/WebKit2/FrameMIMETypePNG.cpp:
  • TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp:
  • TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
  • TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp:
  • TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp:
  • TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
  • TestWebKitAPI/Tests/WebKit2/win/AltKeyGeneratesWMSysCommand.cpp:
  • TestWebKitAPI/Tests/WebKit2/win/WMCloseCallsUIClientClose.cpp:
  • TestWebKitAPI/mac/PlatformWebViewMac.mm:
  • TestWebKitAPI/win/PlatformWebViewWin.cpp:

Convert TestWebKitAPI to not use PageNamespaces.

  • WebKitTestRunner/PlatformWebView.h:
  • WebKitTestRunner/TestController.cpp:
  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/mac/PlatformWebViewMac.mm:
  • WebKitTestRunner/qt/PlatformWebViewQt.cpp:
  • WebKitTestRunner/win/PlatformWebViewWin.cpp:

Convert WebKitTestRunner to not use PageNamespaces.

Location:
trunk
Files:
2 deleted
54 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r73963 r73965  
     12010-12-13  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Change the WebKit2 public API so there is no explicit WKPageNamespace object
     6        https://bugs.webkit.org/show_bug.cgi?id=50898
     7
     8        * Shared/API/c/WKBase.h: Remove definition of WKPageNamespaceRef.
     9        * UIProcess/API/C/WKAPICast.h: Remove toAPI/toImpl for WKPageNamespaceRef.
     10
     11        * UIProcess/API/C/WKPage.cpp:
     12        * UIProcess/API/C/WKPage.h:
     13        Replace WKPageGetPageNamespace with WKPageGetContext.
     14
     15        * UIProcess/API/C/WKPageNamespace.cpp: Removed.
     16        * UIProcess/API/C/WKPageNamespace.h: Removed.
     17
     18        * UIProcess/API/C/WebKit2.h: Remove #include of WKPageNamespace.h.
     19
     20        * UIProcess/API/C/win/WKView.cpp:
     21        (WKViewCreate): Changed to take a WKContextRef instead of a WKPageNamespaceRef.
     22        (WKViewCreateUsingSharedProcess): Added. Similar to WKViewCreate except that
     23        all callers of it will have their views end up in the same shared process, whereas
     24        with WKViewCreate, a new internal page namespace will be created and could place
     25        the view's WebPage into a new process.
     26        (WKViewCreateForAssociatedPage): Added. Creates a view that is forced to use the
     27        same process as the passed in page.
     28
     29        * UIProcess/win/WebView.cpp:
     30        (WebKit::WebView::WebView):
     31        (WebKit::WebView::initialize):
     32        * UIProcess/win/WebView.h:
     33        (WebKit::WebView::create):
     34        (WebKit::WebView::createUsingSharedProcess):
     35        (WebKit::WebView::createForAssociatedPage):
     36        Implementation of the WKView create functions.
     37
     38        * UIProcess/API/C/win/WKView.h:
     39        * UIProcess/API/mac/WKView.h:
     40        * UIProcess/API/mac/WKView.mm:
     41        (-[WKView initWithFrame:]):
     42        (-[WKView initWithFrame:contextRef:]):
     43        (-[WKView initWithFrame:contextRef:pageGroupRef:]):
     44        (-[WKView initWithFrame:contextRef:usingSharedProcess:]):
     45        (-[WKView initWithFrame:contextRef:pageGroupRef:usingSharedProcess:]):
     46        (-[WKView initWithFrame:forAssociatedPageRef:]):
     47        (-[WKView initWithFrame:forAssociatedPageRef:pageGroupRef:]):
     48        (-[WKView initWithFrame:pageNamespace:pageGroup:]):
     49        Add new initializers for the objective-c WKView. It follows the same
     50        pattern as WKViewRef.
     51
     52        * UIProcess/API/qt/qwkcontext.cpp:
     53        (QWKContext::QWKContext):
     54        * UIProcess/API/qt/qwkcontext.h:
     55        Remove uses of WKPageNamespaceRef.
     56
     57        * UIProcess/WebContext.cpp:
     58        (WebKit::WebContext::sharedPageNamespace): Returns a shared
     59        page namespace used by the view's createUsingSharedProcess constructions.
     60        (WebKit::WebContext::createPageNamespace): Change to return
     61        a PassRefPtr to make things clearer.
     62        (WebKit::WebContext::pageNamespaceWasDestroyed): Clear the shared
     63        namespace if it is cleared.
     64        * UIProcess/WebContext.h:
     65
     66        * UIProcess/WebPageNamespace.h: Remove unused "struct WKContextStatistics".
     67
     68        * UIProcess/WebPageProxy.cpp:
     69        (WebKit::WebPageProxy::context):
     70        * UIProcess/WebPageProxy.h:
     71        Add context getter.
     72
     73        * UIProcess/mac/WebInspectorProxyMac.mm:
     74        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     75        * UIProcess/win/WebInspectorProxyWin.cpp:
     76        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     77        Use forAssociatedPageRef constructor for the WebInspector view.
     78
     79        * WebKit2.pro:
     80        * WebKit2.xcodeproj/project.pbxproj:
     81        * win/WebKit2.vcproj:
     82        * win/WebKit2Generated.make:
     83        Remove WKPageNamespace.h/cpp.
     84
    1852010-12-13  Brent Fulgham  <bfulgham@webkit.org>
    286
  • trunk/WebKit2/Shared/API/c/WKBase.h

    r73808 r73965  
    7676typedef const struct OpaqueWKPage* WKPageRef;
    7777typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
    78 typedef const struct OpaqueWKPageNamespace* WKPageNamespaceRef;
    7978typedef const struct OpaqueWKPreferences* WKPreferencesRef;
    8079typedef const struct OpaqueWKProtectionSpace* WKProtectionSpaceRef;
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r73808 r73965  
    5555class WebNavigationData;
    5656class WebPageGroup;
    57 class WebPageNamespace;
    5857class WebPageProxy;
    5958class WebPreferences;
     
    7170WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
    7271WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
    73 #if ENABLE(INSPECTOR)
    74 WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
    75 #endif
    7672WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
    7773WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
    78 WK_ADD_API_MAPPING(WKPageNamespaceRef, WebPageNamespace)
    7974WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
    8075WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
    8176WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
     77
     78#if ENABLE(INSPECTOR)
     79WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
     80#endif
    8281
    8382/* Enum conversions */
  • trunk/WebKit2/UIProcess/API/C/WKPage.cpp

    r73565 r73965  
    4343}
    4444
    45 WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef pageRef)
    46 {
    47     return toAPI(toImpl(pageRef)->pageNamespace());
     45WKContextRef WKPageGetContext(WKPageRef pageRef)
     46{
     47    return toAPI(toImpl(pageRef)->context());
    4848}
    4949
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r73614 r73965  
    218218WK_EXPORT WKTypeID WKPageGetTypeID();
    219219
    220 WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
     220WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page);
    221221WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page);
    222222
  • trunk/WebKit2/UIProcess/API/C/WebKit2.h

    r73066 r73965  
    4646#include <WebKit2/WKPage.h>
    4747#include <WebKit2/WKPageGroup.h>
    48 #include <WebKit2/WKPageNamespace.h>
    4948#include <WebKit2/WKPreferences.h>
    5049#include <WebKit2/WKString.h>
  • trunk/WebKit2/UIProcess/API/C/win/WKView.cpp

    r73068 r73965  
    3636}
    3737
    38 WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespaceRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
     38WKViewRef WKViewCreate(RECT rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
    3939{
    40     RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), toImpl(pageGroupRef), parentWindow);
     40    RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef), parentWindow);
     41    return toAPI(view.release().releaseRef());
     42}
     43
     44WKViewRef WKViewCreateUsingSharedProcess(RECT rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
     45{
     46    RefPtr<WebView> view = WebView::createUsingSharedProcess(rect, toImpl(contextRef), toImpl(pageGroupRef), parentWindow);
     47    return toAPI(view.release().releaseRef());
     48}
     49
     50WKViewRef WKViewCreateForAssociatedPage(RECT rect, WKPageRef pageRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
     51{
     52    RefPtr<WebView> view = WebView::createForAssociatedPage(rect, toImpl(pageRef), toImpl(pageGroupRef), parentWindow);
    4153    return toAPI(view.release().releaseRef());
    4254}
  • trunk/WebKit2/UIProcess/API/C/win/WKView.h

    r73066 r73965  
    3636WK_EXPORT WKTypeID WKViewGetTypeID();
    3737
    38 WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespace, WKPageGroupRef pageGroup, HWND parentWindow);
     38WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow);
     39WK_EXPORT WKViewRef WKViewCreateUsingSharedProcess(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow);
     40WK_EXPORT WKViewRef WKViewCreateForAssociatedPage(RECT rect, WKPageRef page, WKPageGroupRef pageGroup, HWND parentWindow);
    3941
    4042WK_EXPORT HWND WKViewGetWindow(WKViewRef view);
  • trunk/WebKit2/UIProcess/API/mac/WKView.h

    r73666 r73965  
    3434}
    3535
    36 - (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef;
    37 - (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
     36- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef;
     37- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
    3838
    39 - (WKPageRef)pageRef;
     39- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef usingSharedProcess:(BOOL)usingSharedProcess;
     40- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef usingSharedProcess:(BOOL)usingSharedProcess;;
    4041
    41 - (void)setDrawsBackground:(BOOL)flag;
    42 - (BOOL)drawsBackground;
     42- (id)initWithFrame:(NSRect)frame forAssociatedPageRef:(WKPageRef)pageRef;
     43- (id)initWithFrame:(NSRect)frame forAssociatedPageRef:(WKPageRef)pageRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
    4344
    44 - (void)setDrawsTransparentBackground:(BOOL)flag;
    45 - (BOOL)drawsTransparentBackground;
     45@property(readonly) WKPageRef pageRef;
     46
     47@property BOOL drawsBackground;
     48@property BOOL drawsTransparentBackground;
    4649
    4750@end
  • trunk/WebKit2/UIProcess/API/mac/WKView.mm

    r73816 r73965  
    128128@end
    129129
     130@interface WKView ()
     131- (id)initWithFrame:(NSRect)frame pageNamespace:(WebPageNamespace*)pageNamespace pageGroup:(WebPageGroup*)pageGroup;
     132@end
     133
    130134@implementation WKView
    131135
    132 - (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef pageGroupRef:(WKPageGroupRef)pageGroupRef
     136- (id)initWithFrame:(NSRect)frame
     137{
     138    return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())];
     139}
     140
     141- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef
     142{   
     143    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:nil];
     144}
     145
     146- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
     147{
     148    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef usingSharedProcess:NO];
     149}
     150
     151- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef usingSharedProcess:(BOOL)usingSharedProcess
     152{
     153    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:nil usingSharedProcess:usingSharedProcess];
     154}
     155
     156- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef usingSharedProcess:(BOOL)usingSharedProcess
     157{
     158    RefPtr<WebPageNamespace> pageNamespace;
     159    if (usingSharedProcess)
     160        pageNamespace = toImpl(contextRef)->sharedPageNamespace();
     161    else
     162        pageNamespace = toImpl(contextRef)->createPageNamespace();
     163
     164    return [self initWithFrame:frame pageNamespace:pageNamespace.get() pageGroup:toImpl(pageGroupRef)];
     165}
     166
     167- (id)initWithFrame:(NSRect)frame forAssociatedPageRef:(WKPageRef)pageRef
     168{
     169    return [self initWithFrame:frame forAssociatedPageRef:pageRef pageGroupRef:nil];
     170}
     171
     172- (id)initWithFrame:(NSRect)frame forAssociatedPageRef:(WKPageRef)pageRef pageGroupRef:(WKPageGroupRef)pageGroupRef
     173{
     174    return [self initWithFrame:frame pageNamespace:toImpl(pageRef)->pageNamespace() pageGroup:toImpl(pageGroupRef)];
     175}
     176
     177- (id)initWithFrame:(NSRect)frame pageNamespace:(WebPageNamespace*)pageNamespace pageGroup:(WebPageGroup*)pageGroup
    133178{
    134179    self = [super initWithFrame:frame];
     
    149194
    150195    _data->_pageClient = PageClientImpl::create(self);
    151     _data->_page = toImpl(pageNamespaceRef)->createWebPage(toImpl(pageGroupRef));
     196    _data->_page = pageNamespace->createWebPage(pageGroup);
    152197    _data->_page->setPageClient(_data->_pageClient.get());
    153198    _data->_page->setDrawingArea(ChunkedUpdateDrawingAreaProxy::create(self));
     
    167212
    168213    return self;
    169 }
    170 
    171 - (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef
    172 {
    173     return [self initWithFrame:frame pageNamespaceRef:pageNamespaceRef pageGroupRef:nil];
    174 }
    175 
    176 - (id)initWithFrame:(NSRect)frame
    177 {
    178     WebContext* context = WebContext::sharedProcessContext();
    179     return [self initWithFrame:frame pageNamespaceRef:toAPI(context->createPageNamespace())];
    180214}
    181215
  • trunk/WebKit2/UIProcess/API/qt/qwkcontext.cpp

    r73716 r73965  
    5151{
    5252    d->context = WebContext::create(String());
    53     d->pageNamespace = d->context->createPageNamespace();
     53    d->pageNamespace = d->context->sharedPageNamespace();
    5454}
    5555
    56 QWKContext::QWKContext(WKPageNamespaceRef pageNamespaceRef, QObject* parent)
     56QWKContext::QWKContext(WKContextRef contextRef, QObject* parent)
    5757    : QObject(parent)
    5858    , d(new QWKContextPrivate(this))
    5959{
    60     d->pageNamespace = toImpl(pageNamespaceRef);
    61     d->context = d->pageNamespace->context();
     60    d->context = toImpl(contextRef);
     61    d->pageNamespace = d->context->sharedPageNamespace();
     62}
     63
     64QWKContext::QWKContext(WKPageRef pageRef, QObject* parent)
     65    : QObject(parent)
     66    , d(new QWKContextPrivate(this))
     67{
     68    d->context = toImpl(pageRef)->context();
     69    d->pageNamespace = d->context->sharedPageNamespace();
    6270}
    6371
  • trunk/WebKit2/UIProcess/API/qt/qwkcontext.h

    r73716 r73965  
    2323#include "qwebkitglobal.h"
    2424#include <QObject>
    25 #include <WebKit2/WKPageNamespace.h>
     25#include <WebKit2/WKContext.h>
     26#include <WebKit2/WKPage.h>
    2627
    2728class QWKContextPrivate;
     
    3435
    3536    // Bridge from the C API
    36     QWKContext(WKPageNamespaceRef pageNamespaceRef, QObject* parent = 0);
     37    QWKContext(WKContextRef contextRef, QObject* parent = 0);
     38    QWKContext(WKPageRef pageRef, QObject* parent = 0);
    3739
    3840private:
  • trunk/WebKit2/UIProcess/WebContext.cpp

    r73816 r73965  
    8080WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePath)
    8181    : m_processModel(processModel)
     82    , m_sharedNamespace(0)
    8283    , m_defaultPageGroup(WebPageGroup::create())
    8384    , m_injectedBundlePath(injectedBundlePath)
     
    229230}
    230231
    231 WebPageNamespace* WebContext::createPageNamespace()
     232WebPageNamespace* WebContext::sharedPageNamespace()
     233{
     234    if (!m_sharedNamespace)
     235        m_sharedNamespace = createPageNamespace();
     236    return m_sharedNamespace.get();
     237}
     238
     239PassRefPtr<WebPageNamespace> WebContext::createPageNamespace()
    232240{
    233241    RefPtr<WebPageNamespace> pageNamespace = WebPageNamespace::create(this);
    234242    m_pageNamespaces.add(pageNamespace.get());
    235     return pageNamespace.release().releaseRef();
     243    return pageNamespace.release();
    236244}
    237245
    238246void WebContext::pageNamespaceWasDestroyed(WebPageNamespace* pageNamespace)
    239247{
     248    if (pageNamespace == m_sharedNamespace)
     249        m_sharedNamespace = 0;
     250
    240251    ASSERT(m_pageNamespaces.contains(pageNamespace));
    241252    m_pageNamespaces.remove(pageNamespace);
  • trunk/WebKit2/UIProcess/WebContext.h

    r73816 r73965  
    4343#include <wtf/text/WTFString.h>
    4444
    45 struct WKContextStatistics;
    46 
    4745namespace WebKit {
    4846
     
    7876    void relaunchProcessIfNecessary();
    7977
    80     WebPageNamespace* createPageNamespace();
     78    WebPageNamespace* sharedPageNamespace();
     79    PassRefPtr<WebPageNamespace> createPageNamespace();
    8180    void pageNamespaceWasDestroyed(WebPageNamespace*);
    8281
     
    165164    RefPtr<WebProcessProxy> m_process;
    166165
     166    RefPtr<WebPageNamespace> m_sharedNamespace;
    167167    HashSet<WebPageNamespace*> m_pageNamespaces;
    168168
  • trunk/WebKit2/UIProcess/WebPageNamespace.h

    r73816 r73965  
    3232#include <wtf/RefPtr.h>
    3333
    34 struct WKContextStatistics;
    35 
    3634namespace WebKit {
    3735
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r73828 r73965  
    134134}
    135135
     136WebContext* WebPageProxy::context() const
     137{
     138    return m_pageNamespace->context();
     139}
     140
    136141bool WebPageProxy::isValid()
    137142{
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r73828 r73965  
    7272}
    7373
    74 struct WKContextStatistics;
    75 
    7674namespace WebKit {
    7775
     
    253251    WebProcessProxy* process() const;
    254252    WebPageNamespace* pageNamespace() const { return m_pageNamespace.get(); }
     253    WebContext* context() const;
    255254
    256255    WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
  • trunk/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

    r73671 r73965  
    7979    ASSERT(!m_inspectorView);
    8080
    81     m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect pageNamespaceRef:toAPI(m_page->pageNamespace()) pageGroupRef:toAPI(inspectorPageGroup())]);
     81    m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect forAssociatedPageRef:toAPI(page()) pageGroupRef:toAPI(inspectorPageGroup())]);
    8282    ASSERT(m_inspectorView);
    8383
    84     return toImpl([m_inspectorView.get() pageRef]);
     84    return toImpl(m_inspectorView.get().pageRef);
    8585}
    8686
  • trunk/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp

    r73963 r73965  
    153153
    154154    RECT emptyRect = {0};
    155     m_inspectorView = WebView::create(emptyRect, m_page->pageNamespace(), inspectorPageGroup(), 0).leakRef();
    156    
     155    m_inspectorView = WebView::createForAssociatedPage(emptyRect, m_page, inspectorPageGroup(), 0).leakRef();
     156
    157157    return m_inspectorView->page();
    158158}
  • trunk/WebKit2/UIProcess/win/WebView.cpp

    r73815 r73965  
    183183}
    184184
    185 WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, HWND parentWindow)
     185WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow, bool usingSharedProcess)
    186186    : m_rect(rect)
    187187    , m_topLevelParentWindow(0)
     
    193193    , m_isBeingDestroyed(false)
    194194{
     195    RefPtr<WebPageNamespace> pageNamespace;
     196    if (usingSharedProcess)
     197        pageNamespace = context->sharedPageNamespace();
     198    else
     199        pageNamespace = context->createPageNamespace();
     200
     201    initialize(pageNamespace.get(), pageGroup, parentWindow);
     202}
     203
     204WebView::WebView(RECT rect, WebPageProxy* page, WebPageGroup* pageGroup, HWND parentWindow)
     205    : m_rect(rect)
     206    , m_topLevelParentWindow(0)
     207    , m_toolTipWindow(0)
     208    , m_lastCursorSet(0)
     209    , m_webCoreCursor(0)
     210    , m_overrideCursor(0)
     211    , m_trackingMouseLeave(false)
     212    , m_isBeingDestroyed(false)
     213{
     214    initialize(page->pageNamespace(), pageGroup, parentWindow);
     215}
     216
     217void WebView::initialize(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, HWND parentWindow)
     218{
    195219    registerWebViewWindowClass();
    196220
     
    200224
    201225    m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
    202         rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this);
     226        m_rect.top, m_rect.left, m_rect.right - m_rect.left, m_rect.bottom - m_rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this);
    203227    ASSERT(::IsWindow(m_window));
    204228
    205     m_page->initializeWebPage(IntRect(rect).size());
     229    m_page->initializeWebPage(IntRect(m_rect).size());
    206230
    207231    ::ShowWindow(m_window, SW_SHOW);
  • trunk/WebKit2/UIProcess/win/WebView.h

    r73625 r73965  
    4242class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener {
    4343public:
    44     static PassRefPtr<WebView> create(RECT rect, WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, HWND parentWindow)
     44    static PassRefPtr<WebView> create(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow)
    4545    {
    46         return adoptRef(new WebView(rect, pageNamespace, pageGroup, parentWindow));
     46        return adoptRef(new WebView(rect, context, pageGroup, parentWindow, false));
     47    }
     48    static PassRefPtr<WebView> createUsingSharedProcess(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow)
     49    {
     50        return adoptRef(new WebView(rect, context, pageGroup, parentWindow, true));
     51    }
     52    static PassRefPtr<WebView> createForAssociatedPage(RECT rect, WebPageProxy* page, WebPageGroup* pageGroup, HWND parentWindow)
     53    {
     54        return adoptRef(new WebView(rect, page, pageGroup, parentWindow));
    4755    }
    4856    ~WebView();
     
    5967
    6068private:
    61     WebView(RECT, WebPageNamespace*, WebPageGroup*, HWND parentWindow);
     69    WebView(RECT, WebContext*, WebPageGroup*, HWND parentWindow, bool usingSharedProcess);
     70    WebView(RECT, WebPageProxy*, WebPageGroup*, HWND parentWindow);
     71
     72    void initialize(WebPageNamespace*, WebPageGroup*, HWND parentWindow);
    6273
    6374    virtual Type type() const { return TypeView; }
  • trunk/WebKit2/WebKit2.pro

    r73892 r73965  
    289289    UIProcess/API/C/WKPage.h \
    290290    UIProcess/API/C/WKPageGroup.h \
    291     UIProcess/API/C/WKPageNamespace.h \
    292291    UIProcess/API/C/WKPagePrivate.h \
    293292    UIProcess/API/C/WKPreferences.h \
     
    489488    UIProcess/API/C/WKPage.cpp \
    490489    UIProcess/API/C/WKPageGroup.cpp \
    491     UIProcess/API/C/WKPageNamespace.cpp \
    492490    UIProcess/API/C/WKPreferences.cpp \
    493491    UIProcess/API/C/WKProtectionSpace.cpp \
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r73808 r73965  
    542542                BCEE98C6113314D7006BCC24 /* WebPageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE98C4113314D7006BCC24 /* WebPageNamespace.cpp */; };
    543543                BCEE98C7113314D7006BCC24 /* WebPageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE98C5113314D7006BCC24 /* WebPageNamespace.h */; };
    544                 BCEE98CC1133174C006BCC24 /* WKPageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE98CA1133174C006BCC24 /* WKPageNamespace.cpp */; };
    545                 BCEE98CD1133174C006BCC24 /* WKPageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE98CB1133174C006BCC24 /* WKPageNamespace.h */; settings = {ATTRIBUTES = (Public, ); }; };
    546544                BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    547545                BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    11971195                BCEE98C4113314D7006BCC24 /* WebPageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageNamespace.cpp; sourceTree = "<group>"; };
    11981196                BCEE98C5113314D7006BCC24 /* WebPageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageNamespace.h; sourceTree = "<group>"; };
    1199                 BCEE98CA1133174C006BCC24 /* WKPageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageNamespace.cpp; sourceTree = "<group>"; };
    1200                 BCEE98CB1133174C006BCC24 /* WKPageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageNamespace.h; sourceTree = "<group>"; };
    12011197                BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleFramePrivate.h; sourceTree = "<group>"; };
    12021198                BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePrivate.h; sourceTree = "<group>"; };
     
    19711967                                BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */,
    19721968                                BC7B633512A45ABA00D174A4 /* WKPageGroup.h */,
    1973                                 BCEE98CA1133174C006BCC24 /* WKPageNamespace.cpp */,
    1974                                 BCEE98CB1133174C006BCC24 /* WKPageNamespace.h */,
    19751969                                BC177464118B9FF4007D9E9A /* WKPagePrivate.h */,
    19761970                                BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */,
     
    25112505                                BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */,
    25122506                                BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */,
    2513                                 BCEE98CD1133174C006BCC24 /* WKPageNamespace.h in Headers */,
    25142507                                BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */,
    25152508                                BCD597D0112B56AC00EC8C23 /* WKPreferences.h in Headers */,
     
    29362929                                BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */,
    29372930                                BCD597D6112B56DC00EC8C23 /* WKPage.cpp in Sources */,
    2938                                 BCEE98CC1133174C006BCC24 /* WKPageNamespace.cpp in Sources */,
    29392931                                BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */,
    29402932                                BC8699B6116AADAA002A925B /* WKView.mm in Sources */,
  • trunk/WebKit2/win/WebKit2.vcproj

    r73958 r73965  
    22822282                                        </File>
    22832283                                        <File
    2284                                                 RelativePath="..\UIProcess\API\C\WKPageNamespace.cpp"
    2285                                                 >
    2286                                         </File>
    2287                                         <File
    2288                                                 RelativePath="..\UIProcess\API\C\WKPageNamespace.h"
    2289                                                 >
    2290                                         </File>
    2291                                         <File
    22922284                                                RelativePath="..\UIProcess\API\C\WKPagePrivate.h"
    22932285                                                >
  • trunk/WebKit2/win/WebKit2Generated.make

    r73808 r73965  
    5252    xcopy /y /d "..\UIProcess\API\C\WKPage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5353    xcopy /y /d "..\UIProcess\API\C\WKPageGroup.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    54     xcopy /y /d "..\UIProcess\API\C\WKPageNamespace.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5554    xcopy /y /d "..\UIProcess\API\C\WKPreferences.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5655    xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
  • trunk/WebKitTools/ChangeLog

    r73951 r73965  
     12010-12-13  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Change the WebKit2 public API so there is no explicit WKPageNamespace object
     6        https://bugs.webkit.org/show_bug.cgi?id=50898
     7
     8        * MiniBrowser/mac/AppDelegate.h:
     9        * MiniBrowser/mac/AppDelegate.m:
     10        * MiniBrowser/mac/BrowserWindowController.h:
     11        * MiniBrowser/mac/BrowserWindowController.m:
     12        * MiniBrowser/win/BrowserView.cpp:
     13        Convert MiniBrowser to not use PageNamespaces.
     14
     15        * TestWebKitAPI/PlatformWebView.h:
     16        * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp:
     17        * TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp:
     18        * TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp:
     19        * TestWebKitAPI/Tests/WebKit2/Find.cpp:
     20        * TestWebKitAPI/Tests/WebKit2/FrameMIMETypeHTML.cpp:
     21        * TestWebKitAPI/Tests/WebKit2/FrameMIMETypePNG.cpp:
     22        * TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp:
     23        * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
     24        * TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp:
     25        * TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp:
     26        * TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
     27        * TestWebKitAPI/Tests/WebKit2/win/AltKeyGeneratesWMSysCommand.cpp:
     28        * TestWebKitAPI/Tests/WebKit2/win/WMCloseCallsUIClientClose.cpp:
     29        * TestWebKitAPI/mac/PlatformWebViewMac.mm:
     30        * TestWebKitAPI/win/PlatformWebViewWin.cpp:
     31        Convert TestWebKitAPI to not use PageNamespaces.
     32
     33        * WebKitTestRunner/PlatformWebView.h:
     34        * WebKitTestRunner/TestController.cpp:
     35        * WebKitTestRunner/TestController.h:
     36        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     37        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
     38        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
     39        Convert WebKitTestRunner to not use PageNamespaces.
     40
    1412010-12-13  Gabor Rapcsanyi  <rgabor@inf.u-szeged.hu>
    242
  • trunk/WebKitTools/MiniBrowser/mac/AppDelegate.h

    r61500 r73965  
    3131
    3232@interface BrowserAppDelegate : NSObject <NSApplicationDelegate> {
    33     ProcessModel currentProcessModel;
    34     WKPageNamespaceRef threadPageNamespace;
    35     WKPageNamespaceRef processPageNamespace;
     33    ProcessModel _currentProcessModel;
     34    WKContextRef _threadContext;
     35    WKContextRef _processContext;
    3636}
    3737
    38 - (WKPageNamespaceRef)getCurrentPageNamespace;
     38- (WKContextRef)getCurrentContext;
    3939
    4040- (IBAction)setSharedProcessProcessModel:(id)sender;
  • trunk/WebKitTools/MiniBrowser/mac/AppDelegate.m

    r69020 r73965  
    115115    if (self) {
    116116        if ([NSEvent modifierFlags] & NSShiftKeyMask)
    117             currentProcessModel = kProcessModelSharedSecondaryThread;
     117            _currentProcessModel = kProcessModelSharedSecondaryThread;
    118118        else
    119             currentProcessModel = kProcessModelSharedSecondaryProcess;
     119            _currentProcessModel = kProcessModelSharedSecondaryProcess;
    120120
    121121        WKContextHistoryClient historyClient = {
     
    129129        };
    130130
    131         WKContextRef threadContext = WKContextGetSharedThreadContext();
    132         WKContextSetHistoryClient(threadContext, &historyClient);
    133         WKContextSetCacheModel(threadContext, kWKCacheModelPrimaryWebBrowser);
    134 
    135         threadPageNamespace = WKPageNamespaceCreate(threadContext);
    136         WKRelease(threadContext);
     131        _threadContext = WKContextGetSharedThreadContext();
     132        WKContextSetHistoryClient(_threadContext, &historyClient);
     133        WKContextSetCacheModel(_threadContext, kWKCacheModelPrimaryWebBrowser);
    137134
    138135        CFStringRef bundlePathCF = (CFStringRef)[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"WebBundle.bundle"];
    139136        WKStringRef bundlePath = WKStringCreateWithCFString(bundlePathCF);
    140137
    141         WKContextRef processContext = WKContextCreateWithInjectedBundlePath(bundlePath);
     138        _processContext = WKContextCreateWithInjectedBundlePath(bundlePath);
    142139       
    143140        WKContextInjectedBundleClient bundleClient = {
     
    147144            0
    148145        };
    149         WKContextSetInjectedBundleClient(processContext, &bundleClient);
    150         WKContextSetHistoryClient(processContext, &historyClient);
    151         WKContextSetCacheModel(processContext, kWKCacheModelPrimaryWebBrowser);
    152 
    153         processPageNamespace = WKPageNamespaceCreate(processContext);
    154         WKRelease(processContext);
     146        WKContextSetInjectedBundleClient(_processContext, &bundleClient);
     147        WKContextSetHistoryClient(_processContext, &historyClient);
     148        WKContextSetCacheModel(_processContext, kWKCacheModelPrimaryWebBrowser);
    155149
    156150        WKRelease(bundlePath);
     
    162156- (IBAction)newWindow:(id)sender
    163157{
    164     BrowserWindowController *controller = [[BrowserWindowController alloc] initWithPageNamespace:[self getCurrentPageNamespace]];
     158    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext]];
    165159    [[controller window] makeKeyAndOrderFront:sender];
    166160   
     
    168162}
    169163
    170 - (WKPageNamespaceRef)getCurrentPageNamespace
    171 {
    172     return (currentProcessModel == kProcessModelSharedSecondaryThread) ? threadPageNamespace : processPageNamespace;
     164- (WKContextRef)getCurrentContext
     165{
     166    return (_currentProcessModel == kProcessModelSharedSecondaryThread) ? _threadContext : _processContext;
    173167}
    174168
     
    176170{
    177171    if ([menuItem action] == @selector(setSharedProcessProcessModel:))
    178         [menuItem setState:currentProcessModel == kProcessModelSharedSecondaryProcess ? NSOnState : NSOffState];
     172        [menuItem setState:_currentProcessModel == kProcessModelSharedSecondaryProcess ? NSOnState : NSOffState];
    179173    else if ([menuItem action] == @selector(setSharedThreadProcessModel:))
    180         [menuItem setState:currentProcessModel == kProcessModelSharedSecondaryThread ? NSOnState : NSOffState];
     174        [menuItem setState:_currentProcessModel == kProcessModelSharedSecondaryThread ? NSOnState : NSOffState];
    181175    return YES;
    182176}       
     
    184178- (void)_setProcessModel:(ProcessModel)processModel
    185179{
    186     if (processModel == currentProcessModel)
     180    if (processModel == _currentProcessModel)
    187181        return;
    188182 
    189     currentProcessModel = processModel;
     183    _currentProcessModel = processModel;
    190184}
    191185
     
    204198    static BrowserStatisticsWindowController* windowController;
    205199    if (!windowController)
    206         windowController = [[BrowserStatisticsWindowController alloc] initWithThreadedWKContextRef:WKPageNamespaceGetContext(threadPageNamespace)
    207                                                                                processWKContextRef:WKPageNamespaceGetContext(processPageNamespace)];
     200        windowController = [[BrowserStatisticsWindowController alloc] initWithThreadedWKContextRef:_threadContext
     201                                                                               processWKContextRef:_processContext];
    208202
    209203    [[windowController window] makeKeyAndOrderFront:self];
     
    225219        }
    226220    }
    227    
    228     WKRelease(threadPageNamespace);
    229     threadPageNamespace = 0;
    230 
    231     WKRelease(processPageNamespace);
    232     processPageNamespace = 0;
     221
     222    WKRelease(_processContext);
     223    _processContext = 0;
    233224}
    234225
     
    266257    BrowserWindowController *controller = [self frontmostBrowserWindowController];
    267258    if (!controller) {
    268         controller = [[BrowserWindowController alloc] initWithPageNamespace:[self getCurrentPageNamespace]];
     259        controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext]];
    269260        [[controller window] makeKeyAndOrderFront:self];
    270261    }
  • trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.h

    r69595 r73965  
    3535    IBOutlet NSWindow *findPanelWindow;
    3636   
    37     WKPageNamespaceRef _pageNamespace;
     37    WKContextRef _context;
    3838    WKView *_webView;
    3939    BOOL _zoomTextOnly;
     
    4848- (IBAction)removeReinsertWebView:(id)sender;
    4949
    50 - (id)initWithPageNamespace:(WKPageNamespaceRef)pageNamespace;
     50- (id)initWithContext:(WKContextRef)context;
    5151- (void)loadURLString:(NSString *)urlString;
    5252- (void)applicationTerminating;
  • trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m

    r73533 r73965  
    4444@implementation BrowserWindowController
    4545
    46 - (id)initWithPageNamespace:(WKPageNamespaceRef)pageNamespace
     46- (id)initWithContext:(WKContextRef)context
    4747{
    4848    if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
    49         _pageNamespace = WKRetain(pageNamespace);
     49        _context = WKRetain(context);
    5050        _zoomTextOnly = NO;
    5151    }
     
    5656- (void)dealloc
    5757{
    58     assert(!_pageNamespace);
     58    assert(!_context);
    5959    [super dealloc];
    6060}
     
    158158- (void)windowWillClose:(NSNotification *)notification
    159159{
    160     WKRelease(_pageNamespace);
    161     _pageNamespace = 0;
     160    WKRelease(_context);
     161    _context = 0;
    162162}
    163163
     
    381381{
    382382    LOG(@"createNewPage");
    383     BrowserWindowController *controller = [[BrowserWindowController alloc] initWithPageNamespace:WKPageGetPageNamespace(page)];
     383    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:WKPageGetContext(page)];
    384384    [controller loadWindow];
    385385
     
    538538- (void)awakeFromNib
    539539{
    540     _webView = [[WKView alloc] initWithFrame:[containerView frame] pageNamespaceRef:_pageNamespace];
     540    _webView = [[WKView alloc] initWithFrame:[containerView frame] contextRef:_context];
    541541
    542542    [containerView addSubview:_webView];
  • trunk/WebKitTools/MiniBrowser/qt/BrowserWindow.cpp

    r72295 r73965  
    2828
    2929#include "BrowserWindow.h"
    30 
    31 #include "WKPageNamespace.h"
    3230
    3331BrowserWindow::BrowserWindow(QGraphicsWKView::BackingStoreType type)
  • trunk/WebKitTools/MiniBrowser/win/BrowserView.cpp

    r73533 r73965  
    9191        context = WKContextGetSharedProcessContext();
    9292
    93     WKPageNamespaceRef pageNamespace = WKPageNamespaceCreate(context);
    94 
    95     m_webView = WKViewCreate(webViewRect, pageNamespace, 0, parentWindow->window());
     93    m_webView = WKViewCreate(webViewRect, context, 0, parentWindow->window());
    9694
    9795    WKPageUIClient uiClient = {
  • trunk/WebKitTools/TestWebKitAPI/PlatformWebView.h

    r73066 r73965  
    5252class PlatformWebView {
    5353public:
    54     PlatformWebView(WKPageNamespaceRef, WKPageGroupRef = 0);
     54    PlatformWebView(WKContextRef, WKPageGroupRef = 0);
     55    PlatformWebView(WKPageRef, WKPageGroupRef = 0);
    5556    ~PlatformWebView();
    5657
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp

    r73066 r73965  
    4949
    5050    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest", pageGroup.get()));
    51     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    52     PlatformWebView webView(pageNamespace.get(), pageGroup.get());
     51    PlatformWebView webView(context.get(), pageGroup.get());
    5352
    5453    WKPageUIClient uiClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp

    r70267 r73965  
    5050{
    5151    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    52     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    53     PlatformWebView webView(pageNamespace.get());
     52    PlatformWebView webView(context.get());
    5453
    5554    WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("throw 'Hello'"));
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp

    r71044 r73965  
    5050{
    5151    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    52     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    53     PlatformWebView webView(pageNamespace.get());
     52    PlatformWebView webView(context.get());
    5453
    5554    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/Find.cpp

    r69343 r73965  
    5252{
    5353    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    54     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    55    
    56     PlatformWebView webView(pageNamespace.get());
     54    PlatformWebView webView(context.get());
    5755   
    5856    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypeHTML.cpp

    r69317 r73965  
    5858{
    5959    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    60     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    61     PlatformWebView webView(pageNamespace.get());
     60    PlatformWebView webView(context.get());
    6261
    6362    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/FrameMIMETypePNG.cpp

    r69317 r73965  
    5858{
    5959    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    60     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    61     PlatformWebView webView(pageNamespace.get());
     60    PlatformWebView webView(context.get());
    6261
    6362    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp

    r70194 r73965  
    5454{
    5555    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("InjectedBundleBasicTest"));
    56     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    5756
    5857    WKContextInjectedBundleClient injectedBundleClient;
     
    6362    WKContextSetInjectedBundleClient(context.get(), &injectedBundleClient);
    6463 
    65     PlatformWebView webView(pageNamespace.get());
     64    PlatformWebView webView(context.get());
    6665
    6766    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp

    r70795 r73965  
    114114
    115115    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    116     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    117  
    118     PlatformWebView webView(pageNamespace.get());
     116    PlatformWebView webView(context.get());
    119117
    120118    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp

    r73880 r73965  
    6161{
    6262    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    63     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    64 
    65     PlatformWebView webView(pageNamespace.get());
     63    PlatformWebView webView(context.get());
    6664
    6765    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp

    r70658 r73965  
    4949{
    5050    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    51     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    52     PlatformWebView webView(pageNamespace.get());
     51    PlatformWebView webView(context.get());
    5352
    5453    WKPageSetCustomUserAgent(webView.page(), WKStringCreateWithUTF8CString(""));
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp

    r69671 r73965  
    8080{
    8181    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    82     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    83 
    84     PlatformWebView webView(pageNamespace.get());
     82    PlatformWebView webView(context.get());
    8583
    8684    WKPageLoaderClient loaderClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/win/AltKeyGeneratesWMSysCommand.cpp

    r69788 r73965  
    6262{
    6363    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    64     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    65 
    66     PlatformWebView webView(pageNamespace.get());
     64    PlatformWebView webView(context.get());
    6765
    6866    WKPageUIClient uiClient;
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/win/WMCloseCallsUIClientClose.cpp

    r70247 r73965  
    4242{
    4343    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    44     WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
    45 
    46     PlatformWebView webView(pageNamespace.get());
     44    PlatformWebView webView(context.get());
    4745
    4846    WKPageUIClient uiClient;
  • trunk/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm

    r73066 r73965  
    3030namespace TestWebKitAPI {
    3131
    32 PlatformWebView::PlatformWebView(WKPageNamespaceRef pageNamespaceRef, WKPageGroupRef pageGroupRef)
     32PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    3333{
    3434    NSRect rect = NSMakeRect(0, 0, 800, 600);
    35     m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:pageNamespaceRef pageGroupRef:pageGroupRef];
     35    m_view = [[WKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef];
     36
     37    NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
     38    m_window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
     39    [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]];
     40    [[m_window contentView] addSubview:m_view];
     41    [m_window orderBack:nil];
     42    [m_window setAutodisplay:NO];
     43    [m_window setReleasedWhenClosed:NO];
     44}
     45
     46PlatformWebView::PlatformWebView(WKPageRef pageRef, WKPageGroupRef pageGroupRef)
     47{
     48    NSRect rect = NSMakeRect(0, 0, 800, 600);
     49    m_view = [[WKView alloc] initWithFrame:rect forAssociatedPageRef:pageRef pageGroupRef:pageGroupRef];
    3650
    3751    NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
  • trunk/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp

    r73066 r73965  
    5757}
    5858
    59 PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef pageGroupRef)
     59
     60PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    6061    : m_parentWindowMessageObserver(0)
    6162{
     
    6465    RECT viewRect = {0, 0, 800, 600};
    6566    m_window = CreateWindowExW(0, hostWindowClassName, L"TestWebKitAPI", WS_OVERLAPPEDWINDOW, viewRect.left, viewRect.top, viewRect.right, viewRect.bottom, 0, 0, 0, this);
    66     m_view = WKViewCreate(viewRect, namespaceRef, pageGroupRef, m_window);
     67    m_view = WKViewCreate(viewRect, contextRef, pageGroupRef, m_window);
     68}
     69
     70PlatformWebView::PlatformWebView(WKPageRef pageRef, WKPageGroupRef pageGroupRef)
     71    : m_parentWindowMessageObserver(0)
     72{
     73    registerWindowClass();
     74
     75    RECT viewRect = {0, 0, 800, 600};
     76    m_window = CreateWindowExW(0, hostWindowClassName, L"TestWebKitAPI", WS_OVERLAPPEDWINDOW, viewRect.left, viewRect.top, viewRect.right, viewRect.bottom, 0, 0, 0, this);
     77    m_view = WKViewCreateForAssociatedPage(viewRect, pageRef, pageGroupRef, m_window);
    6778}
    6879
  • trunk/WebKitTools/WebKitTestRunner/PlatformWebView.h

    r73215 r73965  
    5353class PlatformWebView {
    5454public:
    55     PlatformWebView(WKPageNamespaceRef, WKPageGroupRef);
     55    PlatformWebView(WKContextRef, WKPageGroupRef);
     56    PlatformWebView(WKPageRef, WKPageGroupRef);
    5657    ~PlatformWebView();
    5758
  • trunk/WebKitTools/WebKitTestRunner/TestController.cpp

    r73533 r73965  
    107107static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
    108108{
    109     PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage), WKPageGetPageGroup(oldPage));
     109    PlatformWebView* view = new PlatformWebView(oldPage, WKPageGetPageGroup(oldPage));
    110110    WKPageRef newPage = view->page();
    111111
     
    212212    _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
    213213
    214     m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get()));
    215     m_mainWebView = adoptPtr(new PlatformWebView(m_pageNamespace.get(), m_pageGroup.get()));
     214    m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get()));
    216215
    217216    WKPageUIClient pageUIClient = {
  • trunk/WebKitTools/WebKitTestRunner/TestController.h

    r73215 r73965  
    5151
    5252    PlatformWebView* mainWebView() { return m_mainWebView.get(); }
    53     WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); }
    5453    WKContextRef context() { return m_context.get(); }
    5554
     
    9796    OwnPtr<PlatformWebView> m_mainWebView;
    9897    WKRetainPtr<WKContextRef> m_context;
    99     WKRetainPtr<WKPageNamespaceRef> m_pageNamespace;
    10098    WKRetainPtr<WKPageGroupRef> m_pageGroup;
    101    
     99
    102100    enum State {
    103101        Initial,
  • trunk/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r73215 r73965  
    2828namespace WTR {
    2929
    30 PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef pageGroupRef)
     30PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    3131{
    3232    NSRect rect = NSMakeRect(0, 0, 800, 600);
    33     m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:namespaceRef pageGroupRef:pageGroupRef];
     33    m_view = [[WKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef];
     34
     35    NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
     36    m_window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
     37    [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]];
     38    [[m_window contentView] addSubview:m_view];
     39    [m_window orderBack:nil];
     40    [m_window setAutodisplay:NO];
     41    [m_window setReleasedWhenClosed:NO];
     42}
     43
     44PlatformWebView::PlatformWebView(WKPageRef pageRef, WKPageGroupRef pageGroupRef)
     45{
     46    NSRect rect = NSMakeRect(0, 0, 800, 600);
     47    m_view = [[WKView alloc] initWithFrame:rect forAssociatedPageRef:pageRef pageGroupRef:pageGroupRef];
    3448
    3549    NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
  • trunk/WebKitTools/WebKitTestRunner/qt/PlatformWebViewQt.cpp

    r73716 r73965  
    3434class WebView : public QGraphicsView {
    3535public:
    36     WebView(WKPageNamespaceRef);
     36    WebView(WKContextRef);
     37    WebView(WKPageRef);
    3738
    3839    QGraphicsWKView* wkView() const { return m_item; }
     
    4445};
    4546
    46 WebView::WebView(WKPageNamespaceRef namespaceRef)
     47WebView::WebView(WKContextRef contextRef)
    4748    : QGraphicsView()
    48     , m_item(new QGraphicsWKView(new QWKContext(namespaceRef, this)))
     49    , m_item(new QGraphicsWKView(new QWKContext(contextRef, this)))
    4950{
    5051    setScene(new QGraphicsScene(this));
     
    5253}
    5354
    54 PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef)
    55     : m_view(new WebView(namespaceRef))
     55WebView::WebView(WKPageRef pageRef)
     56    : QGraphicsView()
     57    , m_item(new QGraphicsWKView(new QWKContext(pageRef, this)))
     58{
     59    setScene(new QGraphicsScene(this));
     60    scene()->addItem(m_item);
     61}
     62
     63PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef)
     64    : m_view(new WebView(contextRef))
     65    , m_window(new QMainWindow())
     66{
     67    m_view->setParent(m_window);
     68    m_window->setCentralWidget(m_view);
     69    m_window->setGeometry(0, 0, 800, 600);
     70}
     71
     72PlatformWebView::PlatformWebView(WKPageRef pageRef, WKPageGroupRef)
     73    : m_view(new WebView(pageRef))
    5674    , m_window(new QMainWindow())
    5775{
  • trunk/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp

    r73215 r73965  
    4848}
    4949
    50 PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef pageGroupRef)
     50PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    5151{
    5252    registerWindowClass();
     
    5454    RECT viewRect = {0, 0, 800, 600};
    5555    m_window = CreateWindowExW(0, hostWindowClassName, L"WebKitTestRunner", WS_OVERLAPPEDWINDOW, 0 /*XOFFSET*/, 0 /*YOFFSET*/, viewRect.right, viewRect.bottom, 0, 0, GetModuleHandle(0), 0);
    56     m_view = WKViewCreate(viewRect, namespaceRef, pageGroupRef, m_window);
     56    m_view = WKViewCreate(viewRect, contextRef, pageGroupRef, m_window);
     57}
     58
     59PlatformWebView::PlatformWebView(WKPageRef pageRef, WKPageGroupRef pageGroupRef)
     60{
     61    registerWindowClass();
     62
     63    RECT viewRect = {0, 0, 800, 600};
     64    m_window = CreateWindowExW(0, hostWindowClassName, L"WebKitTestRunner", WS_OVERLAPPEDWINDOW, 0 /*XOFFSET*/, 0 /*YOFFSET*/, viewRect.right, viewRect.bottom, 0, 0, GetModuleHandle(0), 0);
     65    m_view = WKViewCreateForAssociatedPage(viewRect, pageRef, pageGroupRef, m_window);
    5766}
    5867
Note: See TracChangeset for help on using the changeset viewer.