| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/imagebitmap/ImageBitmapFactories.h" | 32 #include "modules/imagebitmap/ImageBitmapFactories.h" |
| 33 | 33 |
| 34 #include "RuntimeEnabledFeatures.h" | 34 #include "RuntimeEnabledFeatures.h" |
| 35 #include "V8ImageBitmap.h" | 35 #include "V8ImageBitmap.h" |
| 36 #include "bindings/v8/ExceptionMessages.h" | 36 #include "bindings/v8/ExceptionMessages.h" |
| 37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "bindings/v8/ScriptScope.h" | 38 #include "bindings/v8/ScriptScope.h" |
| 39 #include "bindings/v8/ScriptState.h" | 39 #include "bindings/v8/ScriptState.h" |
| 40 #include "core/fileapi/Blob.h" |
| 40 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
| 41 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
| 42 #include "core/html/HTMLVideoElement.h" | 43 #include "core/html/HTMLVideoElement.h" |
| 43 #include "core/html/ImageData.h" | 44 #include "core/html/ImageData.h" |
| 44 #include "core/html/canvas/CanvasRenderingContext2D.h" | 45 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 45 #include "core/page/DOMWindow.h" | 46 #include "core/page/DOMWindow.h" |
| 46 #include "core/page/ImageBitmap.h" | 47 #include "core/page/ImageBitmap.h" |
| 47 #include "platform/SharedBuffer.h" | 48 #include "platform/SharedBuffer.h" |
| 48 #include "core/platform/graphics/BitmapImage.h" | 49 #include "core/platform/graphics/BitmapImage.h" |
| 49 #include "core/platform/graphics/ImageSource.h" | 50 #include "core/platform/graphics/ImageSource.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 : m_loader(FileReaderLoader::ReadAsArrayBuffer, this) | 308 : m_loader(FileReaderLoader::ReadAsArrayBuffer, this) |
| 308 , m_scriptState(ScriptState::current()) | 309 , m_scriptState(ScriptState::current()) |
| 309 , m_factory(factory) | 310 , m_factory(factory) |
| 310 , m_resolver(resolver) | 311 , m_resolver(resolver) |
| 311 , m_cropRect(cropRect) | 312 , m_cropRect(cropRect) |
| 312 { | 313 { |
| 313 } | 314 } |
| 314 | 315 |
| 315 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ScriptExecutionConte
xt* context, Blob* blob) | 316 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ScriptExecutionConte
xt* context, Blob* blob) |
| 316 { | 317 { |
| 317 m_loader.start(context, *blob); | 318 m_loader.start(context, blob->blobDataHandle()); |
| 318 } | 319 } |
| 319 | 320 |
| 320 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() | 321 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() |
| 321 { | 322 { |
| 322 v8::Isolate* isolate = m_scriptState->isolate(); | 323 v8::Isolate* isolate = m_scriptState->isolate(); |
| 323 ScriptScope scope(m_scriptState); | 324 ScriptScope scope(m_scriptState); |
| 324 m_resolver->reject(ScriptValue(v8::Null(isolate), isolate)); | 325 m_resolver->reject(ScriptValue(v8::Null(isolate), isolate)); |
| 325 m_factory->didFinishLoading(this); | 326 m_factory->didFinishLoading(this); |
| 326 } | 327 } |
| 327 | 328 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 356 m_resolver->fulfill(imageBitmap.release()); | 357 m_resolver->fulfill(imageBitmap.release()); |
| 357 m_factory->didFinishLoading(this); | 358 m_factory->didFinishLoading(this); |
| 358 } | 359 } |
| 359 | 360 |
| 360 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) | 361 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) |
| 361 { | 362 { |
| 362 rejectPromise(); | 363 rejectPromise(); |
| 363 } | 364 } |
| 364 | 365 |
| 365 } // namespace WebCore | 366 } // namespace WebCore |
| OLD | NEW |