Changeset 160245 in webkit


Ignore:
Timestamp:
Dec 6, 2013 1:40:34 PM (10 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/15606872> REGRESSION (r160148): Mail throws an exception during launch
https://bugs.webkit.org/show_bug.cgi?id=125362

Reviewed by Sam Weinig.

There were two problems in how WKConnection was made to work with WKObject: first,
API::Object::newObject() was not updated to allocate the correct wrapper class, and second,
WebConnection has subclasses with additional data members, which don’t fit in the object
storage ivar.

  • Shared/Cocoa/APIObject.mm:

(API::Object::newObject): Changed to allocate a WKConnection of the required size.

  • UIProcess/API/Cocoa/WKConnection.mm:

Removed _connection ivar.
(-[WKConnection dealloc]): Changed to use -_connection accessor instead of ivar.
(-[WKConnection setDelegate:]): Ditto.
(-[WKConnection sendMessageWithName:body:]): Ditto.
(-[WKConnection remoteObjectRegistry]): Ditto.
(-[WKConnection _connection]): Added.
(-[WKConnection _apiObject]): Changed to return the object in the instance extra storage.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r160227 r160245  
     12013-12-06  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/15606872> REGRESSION (r160148): Mail throws an exception during launch
     4        https://bugs.webkit.org/show_bug.cgi?id=125362
     5
     6        Reviewed by Sam Weinig.
     7
     8        There were two problems in how WKConnection was made to work with WKObject: first,
     9        API::Object::newObject() was not updated to allocate the correct wrapper class, and second,
     10        WebConnection has subclasses with additional data members, which don’t fit in the object
     11        storage ivar.
     12
     13        * Shared/Cocoa/APIObject.mm:
     14        (API::Object::newObject): Changed to allocate a WKConnection of the required size.
     15        * UIProcess/API/Cocoa/WKConnection.mm:
     16        Removed _connection ivar.
     17        (-[WKConnection dealloc]): Changed to use -_connection accessor instead of ivar.
     18        (-[WKConnection setDelegate:]): Ditto.
     19        (-[WKConnection sendMessageWithName:body:]): Ditto.
     20        (-[WKConnection remoteObjectRegistry]): Ditto.
     21        (-[WKConnection _connection]): Added.
     22        (-[WKConnection _apiObject]): Changed to return the object in the instance extra storage.
     23
    1242013-12-06  Dan Bernstein  <mitz@apple.com>
    225
  • trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm

    r160227 r160245  
    3434#import "WKBrowsingContextGroupInternal.h"
    3535#import "WKNSArray.h"
     36#import "WKConnectionInternal.h"
    3637#import "WKNSDictionary.h"
    3738#import "WKNSError.h"
     
    7879    case Type::BackForwardListItem:
    7980        wrapper = [WKBackForwardListItem alloc];
     81        break;
     82
     83    case Type::Connection:
     84        wrapper = NSAllocateObject([WKConnection self], size, nullptr);
    8085        break;
    8186
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKConnection.mm

    r160191 r160245  
    4141
    4242@implementation WKConnection {
    43     API::ObjectStorage<WebConnection> _connection;
    4443    RetainPtr<WKRemoteObjectRegistry> _remoteObjectRegistry;
    45 
    4644    WeakObjCPtr<id <WKConnectionDelegate>> _delegate;
    4745}
     
    4947- (void)dealloc
    5048{
    51     _connection->~WebConnection();
     49    self._connection.~WebConnection();
    5250
    5351    [super dealloc];
     
    9997    _delegate = delegate;
    10098    if (delegate)
    101         setUpClient(self, *_connection);
     99        setUpClient(self, self._connection);
    102100    else
    103         _connection->initializeConnectionClient(nullptr);
     101        self._connection.initializeConnectionClient(nullptr);
    104102}
    105103
     
    107105{
    108106    RefPtr<ObjCObjectGraph> wkMessageBody = ObjCObjectGraph::create(messageBody);
    109     _connection->postMessage(messageName, wkMessageBody.get());
     107    self._connection.postMessage(messageName, wkMessageBody.get());
    110108}
    111109
     
    113111{
    114112    if (!_remoteObjectRegistry)
    115         _remoteObjectRegistry = adoptNS([[WKRemoteObjectRegistry alloc] _initWithConnectionRef:toAPI(_connection.get())]);
     113        _remoteObjectRegistry = adoptNS([[WKRemoteObjectRegistry alloc] _initWithConnectionRef:toAPI(&self._connection)]);
    116114
    117115    return _remoteObjectRegistry.get();
     116}
     117
     118- (WebConnection&)_connection
     119{
     120    return *static_cast<WebConnection*>(object_getIndexedIvars(self));
    118121}
    119122
     
    122125- (API::Object&)_apiObject
    123126{
    124     return *_connection;
     127    return *static_cast<API::Object*>(object_getIndexedIvars(self));
    125128}
    126129
Note: See TracChangeset for help on using the changeset viewer.