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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 { | 205 { |
206 if (isMainThread()) { | 206 if (isMainThread()) { |
207 if (WebBlobRegistry* registry = blobRegistry()) | 207 if (WebBlobRegistry* registry = blobRegistry()) |
208 registry->addDataToStream(url, streamData->data(), streamData->lengt
h()); | 208 registry->addDataToStream(url, streamData->data(), streamData->lengt
h()); |
209 } else { | 209 } else { |
210 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, streamData)); | 210 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, streamData)); |
211 callOnMainThread(&addDataToStreamTask, context.leakPtr()); | 211 callOnMainThread(&addDataToStreamTask, context.leakPtr()); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
| 215 static void flushStreamTask(void* context) |
| 216 { |
| 217 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); |
| 218 if (WebBlobRegistry* registry = blobRegistry()) |
| 219 registry->flushStream(blobRegistryContext->url); |
| 220 } |
| 221 |
| 222 void BlobRegistry::flushStream(const KURL& url) |
| 223 { |
| 224 if (isMainThread()) { |
| 225 if (WebBlobRegistry* registry = blobRegistry()) |
| 226 registry->flushStream(url); |
| 227 } else { |
| 228 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl)); |
| 229 callOnMainThread(&flushStreamTask, context.leakPtr()); |
| 230 } |
| 231 } |
| 232 |
215 static void finalizeStreamTask(void* context) | 233 static void finalizeStreamTask(void* context) |
216 { | 234 { |
217 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); | 235 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); |
218 if (WebBlobRegistry* registry = blobRegistry()) | 236 if (WebBlobRegistry* registry = blobRegistry()) |
219 registry->finalizeStream(blobRegistryContext->url); | 237 registry->finalizeStream(blobRegistryContext->url); |
220 } | 238 } |
221 | 239 |
222 void BlobRegistry::finalizeStream(const KURL& url) | 240 void BlobRegistry::finalizeStream(const KURL& url) |
223 { | 241 { |
224 if (isMainThread()) { | 242 if (isMainThread()) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 292 } |
275 | 293 |
276 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) | 294 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) |
277 { | 295 { |
278 if (url.protocolIs("blob")) | 296 if (url.protocolIs("blob")) |
279 return originMap()->get(url.string()); | 297 return originMap()->get(url.string()); |
280 return 0; | 298 return 0; |
281 } | 299 } |
282 | 300 |
283 } // namespace blink | 301 } // namespace blink |
OLD | NEW |