OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 { | 121 { |
122 if (WebBlobRegistry* registry = blobRegistry()) | 122 if (WebBlobRegistry* registry = blobRegistry()) |
123 registry->registerStreamURL(url, type); | 123 registry->registerStreamURL(url, type); |
124 } | 124 } |
125 | 125 |
126 void BlobRegistry::registerStreamURL(const KURL& url, const String& type) | 126 void BlobRegistry::registerStreamURL(const KURL& url, const String& type) |
127 { | 127 { |
128 if (isMainThread()) | 128 if (isMainThread()) |
129 registerStreamURLTask(url, type); | 129 registerStreamURLTask(url, type); |
130 else | 130 else |
131 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(®isterStreamURLTask, url, type)); | 131 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(®isterStreamURLTask, url, type)); |
132 } | 132 } |
133 | 133 |
134 static void registerStreamURLFromTask(const KURL& url, const KURL& srcURL) | 134 static void registerStreamURLFromTask(const KURL& url, const KURL& srcURL) |
135 { | 135 { |
136 if (WebBlobRegistry* registry = blobRegistry()) | 136 if (WebBlobRegistry* registry = blobRegistry()) |
137 registry->registerStreamURL(url, srcURL); | 137 registry->registerStreamURL(url, srcURL); |
138 } | 138 } |
139 | 139 |
140 void BlobRegistry::registerStreamURL(SecurityOrigin* origin, const KURL& url, co
nst KURL& srcURL) | 140 void BlobRegistry::registerStreamURL(SecurityOrigin* origin, const KURL& url, co
nst KURL& srcURL) |
141 { | 141 { |
142 saveToOriginMap(origin, url); | 142 saveToOriginMap(origin, url); |
143 | 143 |
144 if (isMainThread()) | 144 if (isMainThread()) |
145 registerStreamURLFromTask(url, srcURL); | 145 registerStreamURLFromTask(url, srcURL); |
146 else | 146 else |
147 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(®isterStreamURLFromTask, url, srcURL)); | 147 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(®isterStreamURLFromTask, url, srcURL)); |
148 } | 148 } |
149 | 149 |
150 static void addDataToStreamTask(const KURL& url, PassRefPtr<RawData> streamData) | 150 static void addDataToStreamTask(const KURL& url, PassRefPtr<RawData> streamData) |
151 { | 151 { |
152 if (WebBlobRegistry* registry = blobRegistry()) | 152 if (WebBlobRegistry* registry = blobRegistry()) |
153 registry->addDataToStream(url, streamData->data(), streamData->length())
; | 153 registry->addDataToStream(url, streamData->data(), streamData->length())
; |
154 } | 154 } |
155 | 155 |
156 void BlobRegistry::addDataToStream(const KURL& url, PassRefPtr<RawData> streamDa
ta) | 156 void BlobRegistry::addDataToStream(const KURL& url, PassRefPtr<RawData> streamDa
ta) |
157 { | 157 { |
158 if (isMainThread()) | 158 if (isMainThread()) |
159 addDataToStreamTask(url, streamData); | 159 addDataToStreamTask(url, streamData); |
160 else | 160 else |
161 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(&addDataToStreamTask, url, streamData)); | 161 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(&addDataToStreamTask, url, streamData)); |
162 } | 162 } |
163 | 163 |
164 static void flushStreamTask(const KURL& url) | 164 static void flushStreamTask(const KURL& url) |
165 { | 165 { |
166 if (WebBlobRegistry* registry = blobRegistry()) | 166 if (WebBlobRegistry* registry = blobRegistry()) |
167 registry->flushStream(url); | 167 registry->flushStream(url); |
168 } | 168 } |
169 | 169 |
170 void BlobRegistry::flushStream(const KURL& url) | 170 void BlobRegistry::flushStream(const KURL& url) |
171 { | 171 { |
172 if (isMainThread()) | 172 if (isMainThread()) |
173 flushStreamTask(url); | 173 flushStreamTask(url); |
174 else | 174 else |
175 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(&flushStreamTask, url)); | 175 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(&flushStreamTask, url)); |
176 } | 176 } |
177 | 177 |
178 static void finalizeStreamTask(const KURL& url) | 178 static void finalizeStreamTask(const KURL& url) |
179 { | 179 { |
180 if (WebBlobRegistry* registry = blobRegistry()) | 180 if (WebBlobRegistry* registry = blobRegistry()) |
181 registry->finalizeStream(url); | 181 registry->finalizeStream(url); |
182 } | 182 } |
183 | 183 |
184 void BlobRegistry::finalizeStream(const KURL& url) | 184 void BlobRegistry::finalizeStream(const KURL& url) |
185 { | 185 { |
186 if (isMainThread()) | 186 if (isMainThread()) |
187 finalizeStreamTask(url); | 187 finalizeStreamTask(url); |
188 else | 188 else |
189 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(&finalizeStreamTask, url)); | 189 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(&finalizeStreamTask, url)); |
190 } | 190 } |
191 | 191 |
192 static void abortStreamTask(const KURL& url) | 192 static void abortStreamTask(const KURL& url) |
193 { | 193 { |
194 if (WebBlobRegistry* registry = blobRegistry()) | 194 if (WebBlobRegistry* registry = blobRegistry()) |
195 registry->abortStream(url); | 195 registry->abortStream(url); |
196 } | 196 } |
197 | 197 |
198 void BlobRegistry::abortStream(const KURL& url) | 198 void BlobRegistry::abortStream(const KURL& url) |
199 { | 199 { |
200 if (isMainThread()) | 200 if (isMainThread()) |
201 abortStreamTask(url); | 201 abortStreamTask(url); |
202 else | 202 else |
203 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(&abortStreamTask, url)); | 203 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(&abortStreamTask, url)); |
204 } | 204 } |
205 | 205 |
206 static void unregisterStreamURLTask(const KURL& url) | 206 static void unregisterStreamURLTask(const KURL& url) |
207 { | 207 { |
208 if (WebBlobRegistry* registry = blobRegistry()) | 208 if (WebBlobRegistry* registry = blobRegistry()) |
209 registry->unregisterStreamURL(url); | 209 registry->unregisterStreamURL(url); |
210 } | 210 } |
211 | 211 |
212 void BlobRegistry::unregisterStreamURL(const KURL& url) | 212 void BlobRegistry::unregisterStreamURL(const KURL& url) |
213 { | 213 { |
214 removeFromOriginMap(url); | 214 removeFromOriginMap(url); |
215 | 215 |
216 if (isMainThread()) | 216 if (isMainThread()) |
217 unregisterStreamURLTask(url); | 217 unregisterStreamURLTask(url); |
218 else | 218 else |
219 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, thr
eadSafeBind(&unregisterStreamURLTask, url)); | 219 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER
E, threadSafeBind(&unregisterStreamURLTask, url)); |
220 } | 220 } |
221 | 221 |
222 BlobOriginCache::BlobOriginCache() | 222 BlobOriginCache::BlobOriginCache() |
223 { | 223 { |
224 SecurityOrigin::setCache(this); | 224 SecurityOrigin::setCache(this); |
225 } | 225 } |
226 | 226 |
227 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) | 227 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) |
228 { | 228 { |
229 if (url.protocolIs("blob")) | 229 if (url.protocolIs("blob")) |
230 return originMap()->get(url.string()); | 230 return originMap()->get(url.string()); |
231 return 0; | 231 return 0; |
232 } | 232 } |
233 | 233 |
234 } // namespace blink | 234 } // namespace blink |
OLD | NEW |