Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: WebCore/platform/network/BlobRegistryImpl.h

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 class KURL; 44 class KURL;
45 class ResourceError; 45 class ResourceError;
46 class ResourceHandle; 46 class ResourceHandle;
47 class ResourceHandleClient; 47 class ResourceHandleClient;
48 class ResourceRequest; 48 class ResourceRequest;
49 class ResourceResponse; 49 class ResourceResponse;
50 50
51 // BlobRegistryImpl is not thread-safe. It should only be called from main threa d.
52 class BlobRegistryImpl : public BlobRegistry { 51 class BlobRegistryImpl : public BlobRegistry {
53 WTF_MAKE_FAST_ALLOCATED; 52 WTF_MAKE_FAST_ALLOCATED;
54 public: 53 public:
55 virtual ~BlobRegistryImpl() { } 54 virtual ~BlobRegistryImpl() { }
56 55
57 virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>); 56 // BlobRegistry interface methods.
58 virtual void registerBlobURL(const KURL&, const KURL& srcURL); 57 virtual void registerBlobData(const String& uuid, PassOwnPtr<BlobData>);
59 virtual void unregisterBlobURL(const KURL&); 58 virtual void addBlobDataRef(const String& uuid);
60 virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError &, ResourceResponse&, Vector<char>& data); 59 virtual void removeBlobDataRef(const String& uuid);
60 virtual void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr< BlobDataHandle>);
61 virtual void revokePublicBlobURL(const KURL&);
62 virtual PassRefPtr<SecurityOrigin> cachedUniqueOrigin(const KURL&);
61 63
64 // Extra methods that are not defined in the base class to support BlobURL r esource loading
65 // and Form uploads that include blobs as file input elements. In-process im plementations need
66 // direct access to the underlying data for these functions, but not all por ts need this.
67 // Chromium ports perform these functions out-of-process.
68 // TODO: fix up callsites that currently use FromURL that need to use FromUU ID in other ports.
69 PassRefPtr<BlobStorageData> getBlobDataFromUUID(const String&) const;
62 PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const; 70 PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const;
63 71 bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, Resou rceResponse&, Vector<char>& data);
64 PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, Reso urceHandleClient*); 72 PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, Reso urceHandleClient*);
65 73
66 private: 74 private:
75 class URLRegistrationHelper;
76 typedef HashMap<String, RefPtr<BlobDataHandle> > BlobURLMap;
77 typedef HashMap<String, std::pair<int, RefPtr<BlobStorageData> > > BlobMap;
78
67 bool shouldLoadResource(const ResourceRequest& request) const; 79 bool shouldLoadResource(const ResourceRequest& request) const;
68 void appendStorageItems(BlobStorageData*, const BlobDataItemList&); 80 void appendStorageItems(BlobStorageData*, const BlobDataItemList&);
69 void appendStorageItems(BlobStorageData*, const BlobDataItemList&, long long offset, long long length); 81 void appendStorageItems(BlobStorageData*, const BlobDataItemList&, long long offset, long long length);
70 82
71 HashMap<String, RefPtr<BlobStorageData> > m_blobs; 83 // The url map is only accessed on the main thread.
84 BlobURLMap m_publicURLs;
85
86 // The blob map is accessed on multiple threads, the mutex protects it from concurrent access.
87 mutable Mutex m_mutex;
88 BlobMap m_blobs;
72 }; 89 };
73 90
74 } // namespace WebCore 91 } // namespace WebCore
75 92
93 #if PLATFORM(CHROMIUM)
94 error error error
95 just putting junk here for now to see that we're not trying to include this anyw here
96 might be worth leaving in for real since it documents that fact that this is n/a for chromium
97 #endif
98
76 #endif // BlobRegistryImpl_h 99 #endif // BlobRegistryImpl_h
OLDNEW
« no previous file with comments | « WebCore/platform/network/BlobRegistry.cpp ('k') | WebCore/platform/network/BlobRegistryImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698