Skip to content
Permalink
Browse files
WebCore: Add SecurityOrigin::threadsafeCopy() to the list of exported…
… symbols.

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

Reviewed by David Levin.

* WebCore.exp.in:

WebKit/mac: Repost the DatabaseTracker notifications to the main thread, if needed.
https://bugs.webkit.org/show_bug.cgi?id=40655

Reviewed by David Levin.

* Storage/WebDatabaseTrackerClient.mm:
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::DidModifyOriginData):
(DidModifyOriginData::dispatchDidModifyOriginOnMainThread):
(WebDatabaseTrackerClient::dispatchDidModifyOrigin):
(WebDatabaseTrackerClient::dispatchDidModifyDatabase):

WebKit/win: Repost the DatabaseTracker notifications to the main thread, if needed.
https://bugs.webkit.org/show_bug.cgi?id=40655

Reviewed by David Levin.

* WebDatabaseManager.cpp:
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::DidModifyOriginData):
(DidModifyOriginData::dispatchDidModifyOriginOnMainThread):
(WebDatabaseManager::dispatchDidModifyOrigin):
(WebDatabaseManager::dispatchDidModifyDatabase):



Canonical link: https://commits.webkit.org/60746@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Dumitru Daniliuc committed Oct 21, 2010
1 parent a2a45b4 commit c59d2db17a52fda97863b496082b5e2f95f39894
Showing 6 changed files with 116 additions and 2 deletions.
@@ -1,3 +1,12 @@
2010-10-20 Dumitru Daniliuc <dumi@chromium.org>

Reviewed by David Levin.

Add SecurityOrigin::threadsafeCopy() to the list of exported symbols.
https://bugs.webkit.org/show_bug.cgi?id=40655

* WebCore.exp.in:

2010-10-20 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r70165.
@@ -318,6 +318,7 @@ __ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
__ZN7WebCore14SchemeRegistry24registerURLSchemeAsLocalERKN3WTF6StringE
__ZN7WebCore14SchemeRegistry25registerURLSchemeAsSecureERKN3WTF6StringE
__ZN7WebCore14SchemeRegistry32registerURLSchemeAsEmptyDocumentERKN3WTF6StringE
__ZN7WebCore14SecurityOrigin14threadsafeCopyEv
__ZN7WebCore14SecurityOrigin16createFromStringERKN3WTF6StringE
__ZN7WebCore14SecurityOrigin18setLocalLoadPolicyENS0_15LocalLoadPolicyE
__ZN7WebCore14SecurityOrigin18shouldHideReferrerERKNS_4KURLERKN3WTF6StringE
@@ -1,3 +1,17 @@
2010-10-20 Dumitru Daniliuc <dumi@chromium.org>

Reviewed by David Levin.

Repost the DatabaseTracker notifications to the main thread, if needed.
https://bugs.webkit.org/show_bug.cgi?id=40655

* Storage/WebDatabaseTrackerClient.mm:
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::DidModifyOriginData):
(DidModifyOriginData::dispatchDidModifyOriginOnMainThread):
(WebDatabaseTrackerClient::dispatchDidModifyOrigin):
(WebDatabaseTrackerClient::dispatchDidModifyDatabase):

2010-10-20 Simon Fraser <simon.fraser@apple.com>

Reviewed by Darin Adler.
@@ -32,6 +32,7 @@

#import "WebDatabaseManagerPrivate.h"
#import "WebSecurityOriginInternal.h"
#import <wtf/MainThread.h>
#import <wtf/RetainPtr.h>
#import <WebCore/SecurityOrigin.h>

@@ -50,17 +51,54 @@
WebDatabaseTrackerClient::~WebDatabaseTrackerClient()
{
}


class DidModifyOriginData : public Noncopyable {
public:
static void dispatchToMainThread(WebDatabaseTrackerClient* client, SecurityOrigin* origin)
{
DidModifyOriginData* context = new DidModifyOriginData(client, origin->threadsafeCopy());
callOnMainThread(&DidModifyOriginData::dispatchDidModifyOriginOnMainThread, context);
}

private:
DidModifyOriginData(WebDatabaseTrackerClient* client, PassRefPtr<SecurityOrigin> origin)
: client(client)
, origin(origin)
{
}

static void dispatchDidModifyOriginOnMainThread(void* context)
{
ASSERT(isMainThread());
DidModifyOriginData* info = static_cast<DidModifyOriginData*>(context);
info->client->dispatchDidModifyOrigin(info->origin.get());
delete info;
}

WebDatabaseTrackerClient* client;
RefPtr<SecurityOrigin> origin;
};

void WebDatabaseTrackerClient::dispatchDidModifyOrigin(SecurityOrigin* origin)
{
RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
if (!isMainThread()) {
DidModifyOriginData::dispatchToMainThread(this, origin);
return;
}

RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);

[[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyOriginNotification
object:webSecurityOrigin.get()];
}

void WebDatabaseTrackerClient::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseIdentifier)
{
if (!isMainThread()) {
DidModifyOriginData::dispatchToMainThread(this, origin);
return;
}

RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
RetainPtr<NSDictionary> userInfo(AdoptNS, [[NSDictionary alloc]
initWithObjectsAndKeys:(NSString *)databaseIdentifier, WebDatabaseIdentifierKey, nil]);
@@ -1,3 +1,17 @@
2010-10-20 Dumitru Daniliuc <dumi@chromium.org>

Reviewed by David Levin.

Repost the DatabaseTracker notifications to the main thread, if needed.
https://bugs.webkit.org/show_bug.cgi?id=40655

* WebDatabaseManager.cpp:
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::DidModifyOriginData):
(DidModifyOriginData::dispatchDidModifyOriginOnMainThread):
(WebDatabaseManager::dispatchDidModifyOrigin):
(WebDatabaseManager::dispatchDidModifyDatabase):

2010-10-20 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.
@@ -38,6 +38,7 @@
#include "WebNotificationCenter.h"
#include "WebSecurityOrigin.h"

#include <JavaScriptCore/MainThread.h>
#include <WebCore/BString.h>
#include <WebCore/COMPtr.h>
#include <WebCore/DatabaseTracker.h>
@@ -327,8 +328,40 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabase(
return S_OK;
}

class DidModifyOriginData : public Noncopyable {
public:
static void dispatchToMainThread(WebDatabaseManager* databaseManager, SecurityOrigin* origin)
{
DidModifyOriginData* context = new DidModifyOriginData(databaseManager, origin->threadsafeCopy());
callOnMainThread(&DidModifyOriginData::dispatchDidModifyOriginOnMainThread, context);
}

private:
DidModifyOriginData(WebDatabaseManager* databaseManager, PassRefPtr<SecurityOrigin> origin)
: databaseManager(databaseManager)
, origin(origin)
{
}

static void dispatchDidModifyOriginOnMainThread(void* context)
{
ASSERT(isMainThread());
DidModifyOriginData* info = static_cast<DidModifyOriginData*>(context);
info->databaseManager->dispatchDidModifyOrigin(info->origin.get());
delete info;
}

WebDatabaseManager* databaseManager;
RefPtr<SecurityOrigin> origin;
};

void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
{
if (!isMainThread()) {
DidModifyOriginData::dispatchToMainThread(this, origin);
return;
}

static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyOriginNotification);
IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();

@@ -353,6 +386,11 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::setQuota(

void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseName)
{
if (!isMainThread()) {
DidModifyOriginData::dispatchToMainThread(this, origin);
return;
}

static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyDatabaseNotification);
IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();

0 comments on commit c59d2db

Please sign in to comment.