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 21 matching lines...) Expand all Loading... |
32 #include "platform/blob/BlobRegistry.h" | 32 #include "platform/blob/BlobRegistry.h" |
33 | 33 |
34 #include "platform/blob/BlobData.h" | 34 #include "platform/blob/BlobData.h" |
35 #include "platform/blob/BlobURL.h" | 35 #include "platform/blob/BlobURL.h" |
36 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
37 #include "platform/weborigin/SecurityOriginCache.h" | 37 #include "platform/weborigin/SecurityOriginCache.h" |
38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
39 #include "public/platform/WebBlobData.h" | 39 #include "public/platform/WebBlobData.h" |
40 #include "public/platform/WebBlobRegistry.h" | 40 #include "public/platform/WebBlobRegistry.h" |
41 #include "public/platform/WebString.h" | 41 #include "public/platform/WebString.h" |
42 #include "public/platform/WebThreadSafeData.h" | |
43 #include "wtf/Assertions.h" | 42 #include "wtf/Assertions.h" |
44 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
45 #include "wtf/MainThread.h" | 44 #include "wtf/MainThread.h" |
46 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
47 #include "wtf/ThreadSpecific.h" | 46 #include "wtf/ThreadSpecific.h" |
48 #include "wtf/Threading.h" | 47 #include "wtf/Threading.h" |
49 #include "wtf/text/StringHash.h" | 48 #include "wtf/text/StringHash.h" |
50 #include "wtf/text/WTFString.h" | 49 #include "wtf/text/WTFString.h" |
51 | 50 |
52 namespace blink { | 51 namespace blink { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } else { | 189 } else { |
191 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, srcURL)); | 190 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, srcURL)); |
192 callOnMainThread(®isterStreamURLFromTask, context.leakPtr()); | 191 callOnMainThread(®isterStreamURLFromTask, context.leakPtr()); |
193 } | 192 } |
194 } | 193 } |
195 | 194 |
196 static void addDataToStreamTask(void* context) | 195 static void addDataToStreamTask(void* context) |
197 { | 196 { |
198 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); | 197 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); |
199 if (WebBlobRegistry* registry = blobRegistry()) { | 198 if (WebBlobRegistry* registry = blobRegistry()) { |
200 WebThreadSafeData webThreadSafeData(blobRegistryContext->streamData); | 199 RefPtr<RawData> data(blobRegistryContext->streamData); |
201 registry->addDataToStream(blobRegistryContext->url, webThreadSafeData); | 200 registry->addDataToStream(blobRegistryContext->url, data->data(), data->
length()); |
202 } | 201 } |
203 } | 202 } |
204 | 203 |
205 void BlobRegistry::addDataToStream(const KURL& url, PassRefPtr<RawData> streamDa
ta) | 204 void BlobRegistry::addDataToStream(const KURL& url, PassRefPtr<RawData> streamDa
ta) |
206 { | 205 { |
207 if (isMainThread()) { | 206 if (isMainThread()) { |
208 if (WebBlobRegistry* registry = blobRegistry()) { | 207 if (WebBlobRegistry* registry = blobRegistry()) |
209 WebThreadSafeData webThreadSafeData(streamData); | 208 registry->addDataToStream(url, streamData->data(), streamData->lengt
h()); |
210 registry->addDataToStream(url, webThreadSafeData); | |
211 } | |
212 } else { | 209 } else { |
213 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, streamData)); | 210 OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(u
rl, streamData)); |
214 callOnMainThread(&addDataToStreamTask, context.leakPtr()); | 211 callOnMainThread(&addDataToStreamTask, context.leakPtr()); |
215 } | 212 } |
216 } | 213 } |
217 | 214 |
218 static void finalizeStreamTask(void* context) | 215 static void finalizeStreamTask(void* context) |
219 { | 216 { |
220 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); | 217 OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobR
egistryContext*>(context)); |
221 if (WebBlobRegistry* registry = blobRegistry()) | 218 if (WebBlobRegistry* registry = blobRegistry()) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 274 } |
278 | 275 |
279 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) | 276 SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) |
280 { | 277 { |
281 if (url.protocolIs("blob")) | 278 if (url.protocolIs("blob")) |
282 return originMap()->get(url.string()); | 279 return originMap()->get(url.string()); |
283 return 0; | 280 return 0; |
284 } | 281 } |
285 | 282 |
286 } // namespace blink | 283 } // namespace blink |
OLD | NEW |