Skip to content
Permalink
Browse files
WebCore:
        Reviewed by Sam.

        - remove all bridge-related things from WebCore except the bridge itself

        * WebCore.base.exp: Removed the bridge and setBridge functions.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::detachFromParent): Removed call to the bridge's
        close method.

        * page/Frame.cpp:
        (WebCore::Frame::~Frame): Removed call to setBridge(0).
        (WebCore::FramePrivate::FramePrivate): Removed initialization of m_bridge.
        * page/Frame.h: Removed setBridge and bridge functions.
        * page/FramePrivate.h: Removed m_bridge pointer.
        * page/mac/FrameMac.mm: Removed setBridge and bridge functions.

        * page/mac/WebCoreFrameBridge.h: Added setWebCoreFrame: method.
        Removed bridgeForDOMDocument: and clearFrame methods.
        * page/mac/WebCoreFrameBridge.mm: Ditto.
        (-[WebCoreFrameBridge close]): Changed to set m_frame to 0 directly.
        (-[WebCoreFrameBridge setWebCoreFrame:]): Added.

WebKit/mac:

        Reviewed by Sam.

        - remove all bridge-related things from WebCore except the bridge itself

        * DOM/WebDOMOperations.mm:
        (-[DOMNode _bridge]): Reimplemented to not use the bridgeForDOMDocument: method.

        * DefaultDelegates/WebDefaultContextMenuDelegate.mm: Removed unneeded include.

        * Plugins/WebPluginController.mm: Ditto.

        * WebCoreSupport/WebFrameBridge.h: Removed unneeded things, including the
        init and close methods. Added a setWebFrame: method.

        * WebCoreSupport/WebFrameBridge.mm:
        (-[WebFrameBridge setWebFrame:]): Added.

        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::frameLoaderDestroyed): Added an assertion.
        (WebFrameLoaderClient::detachedFromParent4): Moved the call to close on the
        bridge here. Soon we will be able to remove this entirely!
        (WebFrameLoaderClient::createFrame): Rewrote this to use the method moved
        into WebFrame from the bridge.

        * WebView/WebFrame.mm:
        (-[WebFramePrivate dealloc]): Added code to release the bridge, because it's
        now owned by the frame.
        (-[WebFramePrivate finalize]): Added this missing method. We'd leak the script
        debugger under GC without this!
        (kit): Rewrote the function that maps from a WebCore::Frame to a WebFrame to
        use WebFrameLoaderClient instead of the bridge.
        (+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Added.
        This is code that used to live in the bridge's init function.
        (+[WebFrame _createMainFrameWithPage:frameName:frameView:]): Ditto.
        (+[WebFrame WebCore::_createSubframeWithOwnerElement:frameName:frameView:]): Ditto.
        (-[WebFrame _initWithWebFrameView:webView:bridge:]): Retain the bridge, since
        the WebView is now the bridge's owner.
        (-[WebFrame _updateBackground]): Changed this one call site that was calling the
        WebCore::Frame::bridge function directly to use the kit function instead.
        (-[WebFrame dealloc]): Added code to clear the WebFrame pointer in the bridge.
        This code won't last long -- we're eliminating the bridge soon.
        (-[WebFrame finalize]): Ditto.

        * WebView/WebFrameInternal.h: Added a coreFrame backpointer and two new methods
        for creating frames.

        * WebView/WebView.mm:
        (-[WebView _commonInitializationWithFrameName:groupName:]): Rewrote this to use
        the method moved into WebFrame from the bridge. Gets rid of the unpleasant idiom
        where we have to allocate a WebFrameBridge and then immediately release it.



Canonical link: https://commits.webkit.org/24664@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
darinadler committed Mar 12, 2008
1 parent 74148a3 commit 1cd61ab34dca766b7df8c3079004aaed67adce80
Showing 19 changed files with 172 additions and 157 deletions.
@@ -1,3 +1,28 @@
2008-03-11 Darin Adler <darin@apple.com>

Reviewed by Sam.

- remove all bridge-related things from WebCore except the bridge itself

* WebCore.base.exp: Removed the bridge and setBridge functions.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::detachFromParent): Removed call to the bridge's
close method.

* page/Frame.cpp:
(WebCore::Frame::~Frame): Removed call to setBridge(0).
(WebCore::FramePrivate::FramePrivate): Removed initialization of m_bridge.
* page/Frame.h: Removed setBridge and bridge functions.
* page/FramePrivate.h: Removed m_bridge pointer.
* page/mac/FrameMac.mm: Removed setBridge and bridge functions.

* page/mac/WebCoreFrameBridge.h: Added setWebCoreFrame: method.
Removed bridgeForDOMDocument: and clearFrame methods.
* page/mac/WebCoreFrameBridge.mm: Ditto.
(-[WebCoreFrameBridge close]): Changed to set m_frame to 0 directly.
(-[WebCoreFrameBridge setWebCoreFrame:]): Added.

2008-03-11 Darin Adler <darin@apple.com>

- restored some code I removed in the Range change; this code can't go
@@ -406,7 +406,6 @@ __ZN7WebCore5Frame21setProhibitsScrollingEb
__ZN7WebCore5Frame26dashboardRegionsDictionaryEv
__ZN7WebCore5Frame29cleanupScriptObjectsForPluginEPv
__ZN7WebCore5Frame4initEv
__ZN7WebCore5Frame9setBridgeEP18WebCoreFrameBridge
__ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
__ZN7WebCore5Image10getNSImageEv
__ZN7WebCore5Image20loadPlatformResourceEPKc
@@ -668,7 +667,6 @@ __ZNK7WebCore5Frame37baseWritingDirectionForSelectionStartEv
__ZNK7WebCore5Frame4pageEv
__ZNK7WebCore5Frame4treeEv
__ZNK7WebCore5Frame4viewEv
__ZNK7WebCore5Frame6bridgeEv
__ZNK7WebCore5Frame6editorEv
__ZNK7WebCore5Frame6loaderEv
__ZNK7WebCore5Frame8documentEv
@@ -3200,9 +3200,6 @@ void FrameLoader::detachFromParent()
m_frame->setView(0);
m_frame->pageDestroyed();
}
#if PLATFORM(MAC)
[m_frame->bridge() close];
#endif
m_client->detachedFromParent4();
}

@@ -155,11 +155,6 @@ Frame::~Frame()
{
setView(0);
loader()->clearRecordedFormValues();

#if PLATFORM(MAC)
setBridge(0);
#endif

loader()->cancelAndClear();

// FIXME: We should not be doing all this work inside the destructor
@@ -1887,7 +1882,6 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, HTMLFram
#endif
#if PLATFORM(MAC)
, m_windowScriptObject(nil)
, m_bridge(nil)
#endif
{
}
@@ -48,14 +48,12 @@ namespace KJS {

#if PLATFORM(MAC)
#ifdef __OBJC__
@class WebCoreFrameBridge;
@class WebScriptObject;
#else
class NSArray;
class NSDictionary;
class NSMutableDictionary;
class NSString;
class WebCoreFrameBridge;
class WebScriptObject;
typedef int NSWritingDirection;
#endif
@@ -87,11 +85,6 @@ class Frame : public RefCounted<Frame> {

void init();

#if PLATFORM(MAC)
void setBridge(WebCoreFrameBridge*);
WebCoreFrameBridge* bridge() const;
#endif

Page* page() const;
HTMLFrameOwnerElement* ownerElement() const;

@@ -45,10 +45,8 @@ namespace KJS {

#if PLATFORM(MAC)
#ifdef __OBJC__
@class WebCoreFrameBridge;
@class WebScriptObject;
#else
class WebCoreFrameBridge;
class WebScriptObject;
#endif
#endif
@@ -129,7 +127,6 @@ namespace WebCore {
#endif
#if PLATFORM(MAC)
RetainPtr<WebScriptObject> m_windowScriptObject;
WebCoreFrameBridge* m_bridge;
#endif
};
}
@@ -82,7 +82,6 @@
#import "SystemTime.h"
#import "TextResourceDecoder.h"
#import "UserStyleSheetLoader.h"
#import "WebCoreFrameBridge.h"
#import "WebCoreViewFactory.h"
#import "WebDashboardRegion.h"
#import "WebScriptObjectPrivate.h"
@@ -114,27 +113,6 @@ - (void)drawSingleRect:(NSRect)rect;
using namespace EventNames;
using namespace HTMLNames;

void Frame::setBridge(WebCoreFrameBridge* bridge)
{
if (d->m_bridge == bridge)
return;

if (!bridge) {
[d->m_bridge clearFrame];
HardRelease(d->m_bridge);
d->m_bridge = nil;
return;
}
HardRetain(bridge);
HardRelease(d->m_bridge);
d->m_bridge = bridge;
}

WebCoreFrameBridge* Frame::bridge() const
{
return d->m_bridge;
}

// Either get cached regexp or build one that matches any of the labels.
// The regexp we build is of the form: (STR1|STR2|STRN)
RegularExpression* regExpForLabels(NSArray* labels)
@@ -54,15 +54,12 @@
BOOL _closed;
}

- (void)setWebCoreFrame:(WebCore::Frame*)webCoreFrame;
- (WebCore::Frame*)_frame; // underscore to prevent conflict with -[NSView frame]

+ (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document;

- (id)init;
- (void)close;

- (void)clearFrame;

- (NSURL *)baseURL;

- (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
@@ -215,13 +215,6 @@ static void updateRenderingForBindings(ExecState* exec, JSObject* rootObject)

@implementation WebCoreFrameBridge

static inline WebCoreFrameBridge *bridge(Frame *frame)
{
if (!frame)
return nil;
return frame->bridge();
}

- (NSString *)domain
{
Document *doc = m_frame->document();
@@ -230,11 +223,6 @@ - (NSString *)domain
return nil;
}

+ (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document
{
return bridge([document _document]->frame());
}

- (id)init
{
static bool initializedKJS;
@@ -267,7 +255,7 @@ - (void)finalize

- (void)close
{
[self clearFrame];
m_frame = 0;
_closed = YES;
}

@@ -285,11 +273,6 @@ - (void)addData:(NSData *)data
}
}

- (void)clearFrame
{
m_frame = 0;
}

- (NSString *)_stringWithDocumentTypeStringAndMarkupString:(NSString *)markupString
{
return m_frame->documentTypeString() + markupString;
@@ -1179,6 +1162,11 @@ - (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingNam

// -------------------

- (void)setWebCoreFrame:(Frame*)webCoreFrame
{
m_frame = webCoreFrame;
}

- (Frame*)_frame
{
return m_frame;
@@ -1,3 +1,56 @@
2008-03-11 Darin Adler <darin@apple.com>

Reviewed by Sam.

- remove all bridge-related things from WebCore except the bridge itself

* DOM/WebDOMOperations.mm:
(-[DOMNode _bridge]): Reimplemented to not use the bridgeForDOMDocument: method.

* DefaultDelegates/WebDefaultContextMenuDelegate.mm: Removed unneeded include.

* Plugins/WebPluginController.mm: Ditto.

* WebCoreSupport/WebFrameBridge.h: Removed unneeded things, including the
init and close methods. Added a setWebFrame: method.

* WebCoreSupport/WebFrameBridge.mm:
(-[WebFrameBridge setWebFrame:]): Added.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::frameLoaderDestroyed): Added an assertion.
(WebFrameLoaderClient::detachedFromParent4): Moved the call to close on the
bridge here. Soon we will be able to remove this entirely!
(WebFrameLoaderClient::createFrame): Rewrote this to use the method moved
into WebFrame from the bridge.

* WebView/WebFrame.mm:
(-[WebFramePrivate dealloc]): Added code to release the bridge, because it's
now owned by the frame.
(-[WebFramePrivate finalize]): Added this missing method. We'd leak the script
debugger under GC without this!
(kit): Rewrote the function that maps from a WebCore::Frame to a WebFrame to
use WebFrameLoaderClient instead of the bridge.
(+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Added.
This is code that used to live in the bridge's init function.
(+[WebFrame _createMainFrameWithPage:frameName:frameView:]): Ditto.
(+[WebFrame WebCore::_createSubframeWithOwnerElement:frameName:frameView:]): Ditto.
(-[WebFrame _initWithWebFrameView:webView:bridge:]): Retain the bridge, since
the WebView is now the bridge's owner.
(-[WebFrame _updateBackground]): Changed this one call site that was calling the
WebCore::Frame::bridge function directly to use the kit function instead.
(-[WebFrame dealloc]): Added code to clear the WebFrame pointer in the bridge.
This code won't last long -- we're eliminating the bridge soon.
(-[WebFrame finalize]): Ditto.

* WebView/WebFrameInternal.h: Added a coreFrame backpointer and two new methods
for creating frames.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Rewrote this to use
the method moved into WebFrame from the bridge. Gets rid of the unpleasant idiom
where we have to allocate a WebFrameBridge and then immediately release it.

2008-03-11 Darin Adler <darin@apple.com>

Reviewed by Anders.
@@ -26,26 +26,36 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import <WebKit/WebDOMOperationsPrivate.h>

#import "WebDOMOperationsPrivate.h"

#import "WebArchiver.h"
#import "WebDataSourcePrivate.h"
#import "WebFrameBridge.h"
#import "WebFrameInternal.h"
#import "WebFramePrivate.h"
#import "WebKitNSStringExtras.h"
#import <JavaScriptCore/Assertions.h>
#import <WebCore/Document.h>
#import <WebKit/DOMExtensions.h>
#import <WebKit/DOMHTML.h>
#import <JavaScriptCore/Assertions.h>
#import <WebKit/WebFrameBridge.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebKitNSStringExtras.h>
#import <WebKit/WebArchiver.h>

#if ENABLE(SVG)
#import <WebKit/DOMSVG.h>
#endif

using namespace WebCore;

@implementation DOMNode (WebDOMNodeOperations)

- (WebFrameBridge *)_bridge
{
return (WebFrameBridge *)[WebFrameBridge bridgeForDOMDocument:[self ownerDocument]];
Document* document = core(self)->document();
if (!document)
return nil;
Frame* frame = document->frame();
if (!frame)
return nil;
return [kit(frame) _bridge];
}

- (WebArchive *)webArchive
@@ -49,7 +49,6 @@
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/KURL.h>
#import <WebCore/WebCoreFrameBridge.h>
#import <WebKit/DOM.h>
#import <WebKit/DOMPrivate.h>

@@ -34,7 +34,6 @@
#import <WebCore/FrameLoader.h>
#import <WebCore/ResourceRequest.h>
#import <WebCore/PlatformString.h>
#import <WebCore/WebCoreFrameBridge.h>
#import <WebCore/DocumentLoader.h>
#import <WebKit/WebDataSourceInternal.h>
#import <WebKit/WebFrameBridge.h>
@@ -28,20 +28,12 @@

#import <WebCore/WebCoreFrameBridge.h>

namespace WebCore {
class HTMLFrameOwnerElement;
class Page;
}

@class WebFrame;
@class WebFrameView;

@interface WebFrameBridge : WebCoreFrameBridge {
@public
WebFrame *_frame;
WebFrame *_webFrame;
}
- (id)initMainFrameWithPage:(WebCore::Page*)page frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
- (id)initSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
- (void)close;
- (void)setWebFrame:(WebFrame *)webFrame;
- (WebFrame *)webFrame;
@end

0 comments on commit 1cd61ab

Please sign in to comment.