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

Side by Side Diff: WebCore/platform/network/chromium/BlobRegistryProxy.cpp

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
« no previous file with comments | « WebCore/platform/network/chromium/BlobRegistryProxy.h ('k') | WebCore/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #if ENABLE(BLOB) 33 #if ENABLE(BLOB)
34 34
35 #include "BlobRegistryProxy.h" 35 #include "BlobRegistryProxy.h"
36 36
37 #include "BlobData.h" 37 #include "BlobData.h"
38 #include "KURL.h" 38 #include "KURL.h"
39 #include "ResourceHandle.h" 39 #include "ResourceHandle.h"
40 #include "SecurityOrigin.h"
40 #include <public/Platform.h> 41 #include <public/Platform.h>
41 #include <public/WebBlobData.h> 42 #include <public/WebBlobData.h>
42 #include <public/WebBlobRegistry.h> 43 #include <public/WebBlobRegistry.h>
43 #include <public/WebURL.h> 44 #include <public/WebURL.h>
44 #include <wtf/MainThread.h> 45 #include <wtf/MainThread.h>
45 #include <wtf/StdLibExtras.h> 46 #include <wtf/StdLibExtras.h>
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
50 // FIXME: ensure webkit::init causes this to be initalized.
51 // Alternatively, remove the blobRegistry() accessor from WebKit::Platform and i nstead
52 // define a WebBlobRegistry::setBlobRegistry(WebBlobRegistry*) for embedders to inject
53 // and instance pointer into. Injecting these things is frustratingly messy?
49 BlobRegistry& blobRegistry() 54 BlobRegistry& blobRegistry()
50 { 55 {
51 ASSERT(isMainThread()); 56 // AtomicallyInitializedStatic(BlobRegistryProxy&, intance = *new BlobRegist ryProxy); ??
52 DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ()); 57 DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ());
53 return instance; 58 return instance;
54 } 59 }
55 60
56 BlobRegistryProxy::BlobRegistryProxy() 61 BlobRegistryProxy::BlobRegistryProxy()
57 : m_webBlobRegistry(WebKit::Platform::current()->blobRegistry()) 62 : m_webBlobRegistry(WebKit::Platform::current()->blobRegistry())
58 { 63 {
64 //ASSERT(isMainThread()); // FIXME: restore this assertion or claim this is ok.
59 } 65 }
60 66
61 void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> bl obData) 67 void BlobRegistryProxy::registerBlobData(const String& uuid, PassOwnPtr<BlobData > blobData)
62 { 68 {
63 if (m_webBlobRegistry) { 69 if (m_webBlobRegistry) {
64 WebKit::WebBlobData webBlobData(blobData); 70 WebKit::WebBlobData webBlobData(blobData);
65 m_webBlobRegistry->registerBlobURL(url, webBlobData); 71 m_webBlobRegistry->registerBlobData(uuid, webBlobData);
66 } 72 }
67 } 73 }
68 74
69 void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL) 75 void BlobRegistryProxy::addBlobDataRef(const String& uuid)
70 { 76 {
71 if (m_webBlobRegistry) 77 if (m_webBlobRegistry)
72 m_webBlobRegistry->registerBlobURL(url, srcURL); 78 m_webBlobRegistry->addBlobDataRef(uuid);
73 } 79 }
74 80
75 void BlobRegistryProxy::unregisterBlobURL(const KURL& url) 81 void BlobRegistryProxy::removeBlobDataRef(const String& uuid)
76 { 82 {
77 if (m_webBlobRegistry) 83 if (m_webBlobRegistry)
78 m_webBlobRegistry->unregisterBlobURL(url); 84 m_webBlobRegistry->removeBlobDataRef(uuid);
85 }
86
87 void BlobRegistryProxy::registerPublicBlobURL(SecurityOrigin* origin, const KURL & url, PassRefPtr<BlobDataHandle> blobDataHandle)
88 {
89 BlobRegistry::setCachedUniqueOrigin(url, origin);
90 if (m_webBlobRegistry)
91 m_webBlobRegistry->registerPublicBlobURL(url, blobDataHandle->uuid());
92 }
93
94 void BlobRegistryProxy::revokePublicBlobURL(const KURL& url)
95 {
96 BlobRegistry::clearCachedUniqueOrigin(url);
97 if (m_webBlobRegistry)
98 m_webBlobRegistry->revokePublicBlobURL(url);
99 }
100
101 PassRefPtr<SecurityOrigin> BlobRegistryProxy::cachedUniqueOrigin(const KURL& url )
102 {
103 return BlobRegistry::getCachedUniqueOrigin(url);
79 } 104 }
80 105
81 } // namespace WebCore 106 } // namespace WebCore
82 107
83 #endif 108 #endif
OLDNEW
« no previous file with comments | « WebCore/platform/network/chromium/BlobRegistryProxy.h ('k') | WebCore/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698