RESOLVED FIXED Bug 43874
Add ThreadableBlobRegistry to support calling BlobRegistry methods in main thread
https://bugs.webkit.org/show_bug.cgi?id=43874
Summary Add ThreadableBlobRegistry to support calling BlobRegistry methods in main th...
Jian Li
Reported 2010-08-11 13:33:34 PDT
Add ThreadableBlobRegistry to support calling BlobRegistry methods in main thread. This is needed to support blobs in workers.
Attachments
Proposed Patch (24.05 KB, patch)
2010-08-11 15:16 PDT, Jian Li
levin: review-
jianli: commit-queue-
Proposed Patch (26.46 KB, patch)
2010-08-12 11:56 PDT, Jian Li
levin: review+
jianli: commit-queue-
Jian Li
Comment 1 2010-08-11 15:16:11 PDT
Created attachment 64168 [details] Proposed Patch
David Levin
Comment 2 2010-08-11 17:50:55 PDT
Comment on attachment 64168 [details] Proposed Patch Just a few things. I think you're missing the Android build file. > diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp I think there are a lot of items in here which should be guarded with if ENABLE(BLOB) (even some which don't have it from the previous checkin). FUTURE (maybe next checkin): trackBlobURL and revokeBlobURL feel very asymetric. revoke (and ~ScriptExecutionContext) calls unregisterBlobURL but track doesn't call registerBlobURL. (It feels like one class doing the ref and another doing the deref.) I'd recommend that at least registerBlobURL be moved into trackBlobURL and perhaps the name changed to createPublicURL. (Maybe most of the guts of Blob::createPublicURL should move into the ScriptExecutionContext function.) > diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp > Blob::Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>& item) > - : m_size(0) > + : m_scriptExecutionContext(0) > + , m_size(0) Why isn't m_type initialized for this constructor? > diff --git a/WebCore/html/BlobRegistryImpl.cpp b/WebCore/html/BlobRegistryImpl.cpp > void BlobRegistryImpl::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData) > { > + ASSERT(isMainThread()); I like the assert. Can this assert be added to instance() (even if it needs to move into the cpp file)? > diff --git a/WebCore/html/ThreadableBlobRegistry.cpp b/WebCore/html/ThreadableBlobRegistry.cpp > +void postTaskToMainThread(ScriptExecutionContext*, PassOwnPtr<ScriptExecutionContext::Task>); > +void registerBlobURLTask(ScriptExecutionContext*, const KURL&, PassOwnPtr<BlobData>); > +void registerBlobURLFromTask(ScriptExecutionContext*, const KURL& url, const KURL& srcURL); > +void unregisterBlobURLTask(ScriptExecutionContext*, const KURL&); I think these prototypes should be removed, and the functions declared as "static" instead. > diff --git a/WebCore/html/ThreadableBlobRegistry.h b/WebCore/html/ThreadableBlobRegistry.h > +public: > + static void registerBlobURL(ScriptExecutionContext*, const KURL&, PassOwnPtr<BlobData>); > + static void registerBlobURL(ScriptExecutionContext*, const KURL& url, const KURL& srcURL); |url| param name.
Jian Li
Comment 3 2010-08-12 11:56:18 PDT
Created attachment 64246 [details] Proposed Patch
Jian Li
Comment 4 2010-08-12 12:00:36 PDT
All fixed except commented ones. (In reply to comment #2) > (From update of attachment 64168 [details]) > Just a few things. > > I think you're missing the Android build file. > > > > diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp > > I think there are a lot of items in here which should be guarded with if ENABLE(BLOB) (even some which don't have it from the previous checkin). > I am trying to figure out the boundary of using guards or not in order to be compatible with the existing file feature. I will fix this in my next checkin altogether. > > > FUTURE (maybe next checkin): trackBlobURL and revokeBlobURL feel very asymetric. revoke (and ~ScriptExecutionContext) calls unregisterBlobURL but track doesn't call registerBlobURL. (It feels like one class doing the ref and another doing the deref.) > > I'd recommend that at least registerBlobURL be moved into trackBlobURL and perhaps the name changed to createPublicURL. (Maybe most of the guts of Blob::createPublicURL should move into the ScriptExecutionContext function.) > I fixed this in this patch since your suggestion really makes thing much clear. > > > > diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp > > Blob::Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>& item) > > - : m_size(0) > > + : m_scriptExecutionContext(0) > > + , m_size(0) > > Why isn't m_type initialized for this constructor? > This is legacy constructor that is going to be removed when we switch to new BlobData structure. The type string is simply empty for this constructor.
WebKit Review Bot
Comment 5 2010-08-12 15:24:40 PDT
http://trac.webkit.org/changeset/65271 might have broken Qt Linux Release minimal
Jian Li
Comment 6 2010-08-12 15:51:57 PDT
Note You need to log in before you can comment on or make changes to this bug.