OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 23 matching lines...) Expand all Loading... |
34 #include "bindings/v8/ExceptionState.h" | 34 #include "bindings/v8/ExceptionState.h" |
35 #include "bindings/v8/ScriptPromiseResolver.h" | 35 #include "bindings/v8/ScriptPromiseResolver.h" |
36 #include "bindings/v8/ScriptPromiseResolverWithContext.h" | 36 #include "bindings/v8/ScriptPromiseResolverWithContext.h" |
37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
38 #include "core/fileapi/Blob.h" | 38 #include "core/fileapi/Blob.h" |
39 #include "core/html/HTMLCanvasElement.h" | 39 #include "core/html/HTMLCanvasElement.h" |
40 #include "core/html/HTMLImageElement.h" | 40 #include "core/html/HTMLImageElement.h" |
41 #include "core/html/HTMLVideoElement.h" | 41 #include "core/html/HTMLVideoElement.h" |
42 #include "core/html/ImageData.h" | 42 #include "core/html/ImageData.h" |
43 #include "core/html/canvas/CanvasRenderingContext2D.h" | 43 #include "core/html/canvas/CanvasRenderingContext2D.h" |
44 #include "core/frame/DOMWindow.h" | 44 #include "core/frame/LocalDOMWindow.h" |
45 #include "core/frame/ImageBitmap.h" | 45 #include "core/frame/ImageBitmap.h" |
46 #include "core/workers/WorkerGlobalScope.h" | 46 #include "core/workers/WorkerGlobalScope.h" |
47 #include "platform/SharedBuffer.h" | 47 #include "platform/SharedBuffer.h" |
48 #include "platform/graphics/BitmapImage.h" | 48 #include "platform/graphics/BitmapImage.h" |
49 #include "platform/graphics/ImageSource.h" | 49 #include "platform/graphics/ImageSource.h" |
50 #include "platform/graphics/skia/NativeImageSkia.h" | 50 #include "platform/graphics/skia/NativeImageSkia.h" |
51 #include <v8.h> | 51 #include <v8.h> |
52 | 52 |
53 namespace WebCore { | 53 namespace WebCore { |
54 | 54 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return fulfillImageBitmap(scriptState, ImageBitmap::create(bitmap, IntRect(s
x, sy, sw, sh))); | 235 return fulfillImageBitmap(scriptState, ImageBitmap::create(bitmap, IntRect(s
x, sy, sw, sh))); |
236 } | 236 } |
237 | 237 |
238 const char* ImageBitmapFactories::supplementName() | 238 const char* ImageBitmapFactories::supplementName() |
239 { | 239 { |
240 return "ImageBitmapFactories"; | 240 return "ImageBitmapFactories"; |
241 } | 241 } |
242 | 242 |
243 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget) | 243 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget) |
244 { | 244 { |
245 if (DOMWindow* window = eventTarget.toDOMWindow()) | 245 if (LocalDOMWindow* window = eventTarget.toDOMWindow()) |
246 return fromInternal(*window); | 246 return fromInternal(*window); |
247 | 247 |
248 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope()); | 248 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope()); |
249 return ImageBitmapFactories::fromInternal(*toWorkerGlobalScope(eventTarget.e
xecutionContext())); | 249 return ImageBitmapFactories::fromInternal(*toWorkerGlobalScope(eventTarget.e
xecutionContext())); |
250 } | 250 } |
251 | 251 |
252 template<class GlobalObject> | 252 template<class GlobalObject> |
253 ImageBitmapFactories& ImageBitmapFactories::fromInternal(GlobalObject& object) | 253 ImageBitmapFactories& ImageBitmapFactories::fromInternal(GlobalObject& object) |
254 { | 254 { |
255 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe
HeapSupplement<GlobalObject>::from(object, supplementName())); | 255 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe
HeapSupplement<GlobalObject>::from(object, supplementName())); |
(...skipping 24 matching lines...) Expand all Loading... |
280 } | 280 } |
281 | 281 |
282 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co
ntext, Blob* blob) | 282 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co
ntext, Blob* blob) |
283 { | 283 { |
284 m_loader.start(context, blob->blobDataHandle()); | 284 m_loader.start(context, blob->blobDataHandle()); |
285 } | 285 } |
286 | 286 |
287 void ImageBitmapFactories::trace(Visitor* visitor) | 287 void ImageBitmapFactories::trace(Visitor* visitor) |
288 { | 288 { |
289 visitor->trace(m_pendingLoaders); | 289 visitor->trace(m_pendingLoaders); |
290 WillBeHeapSupplement<DOMWindow>::trace(visitor); | 290 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); |
291 WillBeHeapSupplement<WorkerGlobalScope>::trace(visitor); | 291 WillBeHeapSupplement<WorkerGlobalScope>::trace(visitor); |
292 } | 292 } |
293 | 293 |
294 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() | 294 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() |
295 { | 295 { |
296 m_resolver->reject(ScriptValue(m_resolver->scriptState(), v8::Null(m_resolve
r->scriptState()->isolate()))); | 296 m_resolver->reject(ScriptValue(m_resolver->scriptState(), v8::Null(m_resolve
r->scriptState()->isolate()))); |
297 m_factory->didFinishLoading(this); | 297 m_factory->didFinishLoading(this); |
298 } | 298 } |
299 | 299 |
300 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() | 300 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 { | 332 { |
333 rejectPromise(); | 333 rejectPromise(); |
334 } | 334 } |
335 | 335 |
336 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) | 336 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) |
337 { | 337 { |
338 visitor->trace(m_factory); | 338 visitor->trace(m_factory); |
339 } | 339 } |
340 | 340 |
341 } // namespace WebCore | 341 } // namespace WebCore |
OLD | NEW |