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

Side by Side Diff: WebCore/html/DOMURL.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/fileapi/WebKitBlobBuilder.cpp ('k') | WebCore/html/PublicURLManager.h » ('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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Motorola Mobility Inc. 3 * Copyright (C) 2012 Motorola Mobility Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, B lob* blob) 97 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, B lob* blob)
98 { 98 {
99 if (!scriptExecutionContext || !blob) 99 if (!scriptExecutionContext || !blob)
100 return String(); 100 return String();
101 101
102 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr igin()); 102 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr igin());
103 if (publicURL.isEmpty()) 103 if (publicURL.isEmpty())
104 return String(); 104 return String();
105 105
106 ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrig in(), publicURL, blob->url()); 106 blobRegistry().registerPublicBlobURL(scriptExecutionContext->securityOrigin( ), publicURL, blob->blobDataHandle());
107 scriptExecutionContext->publicURLManager().blobURLs().add(publicURL.string() ); 107 scriptExecutionContext->publicURLManager().blobURLs().add(publicURL.string() );
108 108
109 return publicURL.string(); 109 return publicURL.string();
110 } 110 }
111 111
112 void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, con st String& urlString) 112 void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, con st String& urlString)
113 { 113 {
114 if (!scriptExecutionContext) 114 if (!scriptExecutionContext)
115 return; 115 return;
116 116
117 MemoryCache::removeUrlFromCache(scriptExecutionContext, urlString); 117 MemoryCache::removeUrlFromCache(scriptExecutionContext, urlString);
118 118
119 KURL url(KURL(), urlString); 119 KURL url(KURL(), urlString);
120 HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobU RLs(); 120 HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobU RLs();
121 if (blobURLs.contains(url.string())) { 121 if (blobURLs.contains(url.string())) {
122 ThreadableBlobRegistry::unregisterBlobURL(url); 122 blobRegistry().revokePublicBlobURL(url);
123 blobURLs.remove(url.string()); 123 blobURLs.remove(url.string());
124 } 124 }
125 125
126 #if ENABLE(MEDIA_SOURCE) 126 #if ENABLE(MEDIA_SOURCE)
127 HashSet<String>& sourceURLs = scriptExecutionContext->publicURLManager().sou rceURLs(); 127 HashSet<String>& sourceURLs = scriptExecutionContext->publicURLManager().sou rceURLs();
128 if (sourceURLs.contains(url.string())) { 128 if (sourceURLs.contains(url.string())) {
129 MediaSourceRegistry::registry().unregisterMediaSourceURL(url); 129 MediaSourceRegistry::registry().unregisterMediaSourceURL(url);
130 sourceURLs.remove(url.string()); 130 sourceURLs.remove(url.string());
131 } 131 }
132 #endif 132 #endif
133 #if ENABLE(MEDIA_STREAM) 133 #if ENABLE(MEDIA_STREAM)
134 HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().str eamURLs(); 134 HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().str eamURLs();
135 if (streamURLs.contains(url.string())) { 135 if (streamURLs.contains(url.string())) {
136 // FIXME: make sure of this assertion below. Raise a spec question if re quired. 136 // FIXME: make sure of this assertion below. Raise a spec question if re quired.
137 // Since WebWorkers cannot obtain Stream objects, we should be on the ma in thread. 137 // Since WebWorkers cannot obtain Stream objects, we should be on the ma in thread.
138 ASSERT(isMainThread()); 138 ASSERT(isMainThread());
139 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); 139 MediaStreamRegistry::registry().unregisterMediaStreamURL(url);
140 streamURLs.remove(url.string()); 140 streamURLs.remove(url.string());
141 } 141 }
142 #endif 142 #endif
143 } 143 }
144 144
145 } // namespace WebCore 145 } // namespace WebCore
146 146
147 #endif // ENABLE(BLOB) 147 #endif // ENABLE(BLOB)
OLDNEW
« no previous file with comments | « WebCore/fileapi/WebKitBlobBuilder.cpp ('k') | WebCore/html/PublicURLManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698