RESOLVED FIXED 44116
Move BlobRegistry interface and implementation to platform/network
https://bugs.webkit.org/show_bug.cgi?id=44116
Summary Move BlobRegistry interface and implementation to platform/network
Jian Li
Reported 2010-08-17 10:04:47 PDT
This is to address fishd's feedback at bug 43871. We want to move BlobRegistry interface and implementation to a better place: platform/network. We also need to move BlobData and BlobStorageData.
Attachments
Proposed Patch (72.21 KB, patch)
2010-08-17 10:08 PDT, Jian Li
fishd: review+
jianli: commit-queue-
Jian Li
Comment 1 2010-08-17 10:08:32 PDT
Created attachment 64603 [details] Proposed Patch
Darin Fisher (:fishd, Google)
Comment 2 2010-08-17 10:21:38 PDT
Comment on attachment 64603 [details] Proposed Patch WebCore/platform/network/BlobData.h:65 + BlobDataItem(const String& path) explicit? WebCore/platform/network/BlobData.h:55 + BlobDataItem(const CString& data) explicit? WebCore/platform/network/BlobRegistry.h:59 + virtual ~BlobRegistry() { } can this destructor be protected? WebCore/platform/network/BlobRegistry.h:53 + virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0; i think it would be helpful to document these methods. it is at least not entirely obvious what the second form of registerBlobURL means. WebCore/platform/network/BlobRegistry.h:51 + static BlobRegistry& instance(); i think a global WebCore::blobRegistry() method would be more conventional for WebCore. WebCore/platform/network/BlobStorageData.h:41 + struct BlobStorageDataItem { there seems to be unfortunate repetition between BlobDataItem and BlobStorageDataItem. have you considered reusing BlobDataItem here? WebCore/platform/network/BlobRegistryImpl.h:62 + PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const; why not just reuse BlobData here? you can say that getBlobDataFromURL returns a "canonical" BlobData that has all Blob references resolved to either Data or File references. it just seems like it would be simpler to have fewer classes.
Darin Fisher (:fishd, Google)
Comment 3 2010-08-17 10:22:51 PDT
Comment on attachment 64603 [details] Proposed Patch Since this bug is really just about moving the files, I'm going to R+. The other suggested changes can certainly happen separately if you prefer.
Jian Li
Comment 4 2010-08-17 10:27:07 PDT
(In reply to comment #3) > (From update of attachment 64603 [details]) > Since this bug is really just about moving the files, I'm going to R+. The > other suggested changes can certainly happen separately if you prefer. I originally plan to change to use blobRegistry() in another patch. Since you have more feedbacks, I will address all of them in another patch.
Kinuko Yasuda
Comment 5 2010-08-17 16:19:00 PDT
I assume this move implies that we'll have BlobResourceHandle in platform/network too and consequently we'll want to move FileStream and related stuff under platform. Is that the case? (We have a reference to blob in unimplemented FileStream::write but it can be replaced with a file path or blob ID) (By the way I thought it'd be good to have separate classes for BlobStorageData and BlobData - but ok they look VERY similar so it'd be better to unify them. Sorry Jian if I contributed to the decision.)
Jian Li
Comment 6 2010-08-17 16:33:19 PDT
(In reply to comment #5) > I assume this move implies that we'll have BlobResourceHandle in platform/network too and consequently we'll want to move FileStream and related stuff under platform. Is that the case? > (We have a reference to blob in unimplemented FileStream::write but it can be replaced with a file path or blob ID) > > (By the way I thought it'd be good to have separate classes for BlobStorageData and BlobData - but ok they look VERY similar so it'd be better to unify them. Sorry Jian if I contributed to the decision.) Ideally BlobResourceHandle should be put in platform/network and FileStream and FileStreamProxy should be moved to platform/network. However, there're some kind of dependency violations we need to resolve. The first one is reference to blob in FileStream::write. This can be resolved as you suggest. In addition, we cannot pass Blob object between thread. The other one is reference to ScriptExecutionContext (and CrossThreadTask) in FileStreamProxy and BlobResourceHandle. This is needed to post task to different thread. I am not sure if there is a good way to fix this. We could add something like postTask to ResourceHandleClient. However, Task is defined in dom/ScriptExecutionContext.
Kinuko Yasuda
Comment 7 2010-08-17 16:49:44 PDT
(In reply to comment #6) > Ideally BlobResourceHandle should be put in platform/network and FileStream and FileStreamProxy should be moved to platform/network. However, there're some kind of dependency violations we need to resolve. > > The first one is reference to blob in FileStream::write. This can be resolved as you suggest. In addition, we cannot pass Blob object between thread. > > The other one is reference to ScriptExecutionContext (and CrossThreadTask) in FileStreamProxy and BlobResourceHandle. This is needed to post task to different thread. I am not sure if there is a good way to fix this. We could add something like postTask to ResourceHandleClient. However, Task is defined in dom/ScriptExecutionContext. Ah, you're right there're more dependencies. ...I see so it needs more consideration to move BlobResourceHandle.
Jian Li
Comment 8 2010-08-18 12:05:44 PDT
Note You need to log in before you can comment on or make changes to this bug.