| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "platform/geometry/IntRect.h" | 42 #include "platform/geometry/IntRect.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class Blob; | 46 class Blob; |
| 47 class EventTarget; | 47 class EventTarget; |
| 48 class ExceptionState; | 48 class ExceptionState; |
| 49 class ExecutionContext; | 49 class ExecutionContext; |
| 50 class ImageBitmapSource; | 50 class ImageBitmapSource; |
| 51 class ImageBitmapOptions; | 51 class ImageBitmapOptions; |
| 52 class ImageSource; | 52 class ImageDecoder; |
| 53 class WebTaskRunner; | 53 class WebTaskRunner; |
| 54 | 54 |
| 55 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOr
ImageBitmap ImageBitmapSourceUnion; | 55 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOr
ImageBitmap ImageBitmapSourceUnion; |
| 56 | 56 |
| 57 class ImageBitmapFactories final : public NoBaseWillBeGarbageCollectedFinalized<
ImageBitmapFactories>, public WillBeHeapSupplement<LocalDOMWindow>, public WillB
eHeapSupplement<WorkerGlobalScope> { | 57 class ImageBitmapFactories final : public NoBaseWillBeGarbageCollectedFinalized<
ImageBitmapFactories>, public WillBeHeapSupplement<LocalDOMWindow>, public WillB
eHeapSupplement<WorkerGlobalScope> { |
| 58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmapFactories); | 58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmapFactories); |
| 59 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageBitmapFactories); | 59 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageBitmapFactories); |
| 60 | 60 |
| 61 public: | 61 public: |
| 62 static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, const Ima
geBitmapSourceUnion&, ExceptionState&); | 62 static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, const Ima
geBitmapSourceUnion&, ExceptionState&); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 ~ImageBitmapLoader() override { } | 88 ~ImageBitmapLoader() override { } |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 ImageBitmapLoader(ImageBitmapFactories&, const IntRect&, ScriptState*, c
onst ImageBitmapOptions&); | 91 ImageBitmapLoader(ImageBitmapFactories&, const IntRect&, ScriptState*, c
onst ImageBitmapOptions&); |
| 92 | 92 |
| 93 void rejectPromise(); | 93 void rejectPromise(); |
| 94 | 94 |
| 95 void scheduleAsyncImageBitmapDecoding(); | 95 void scheduleAsyncImageBitmapDecoding(); |
| 96 void decodeImageOnDecoderThread(WebTaskRunner*); | 96 void decodeImageOnDecoderThread(WebTaskRunner*); |
| 97 void resolvePromiseOnOriginalThread(PassOwnPtr<ImageSource>); | 97 void resolvePromiseOnOriginalThread(PassOwnPtr<ImageDecoder>); |
| 98 | 98 |
| 99 // FileReaderLoaderClient | 99 // FileReaderLoaderClient |
| 100 void didStartLoading() override { } | 100 void didStartLoading() override { } |
| 101 void didReceiveData() override { } | 101 void didReceiveData() override { } |
| 102 void didFinishLoading() override; | 102 void didFinishLoading() override; |
| 103 void didFail(FileError::ErrorCode) override; | 103 void didFail(FileError::ErrorCode) override; |
| 104 | 104 |
| 105 FileReaderLoader m_loader; | 105 FileReaderLoader m_loader; |
| 106 RawPtrWillBeMember<ImageBitmapFactories> m_factory; | 106 RawPtrWillBeMember<ImageBitmapFactories> m_factory; |
| 107 Member<ScriptPromiseResolver> m_resolver; | 107 Member<ScriptPromiseResolver> m_resolver; |
| 108 IntRect m_cropRect; | 108 IntRect m_cropRect; |
| 109 ImageBitmapOptions m_options; | 109 ImageBitmapOptions m_options; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 static ImageBitmapFactories& from(EventTarget&); | 112 static ImageBitmapFactories& from(EventTarget&); |
| 113 | 113 |
| 114 template<class GlobalObject> | 114 template<class GlobalObject> |
| 115 static ImageBitmapFactories& fromInternal(GlobalObject&); | 115 static ImageBitmapFactories& fromInternal(GlobalObject&); |
| 116 | 116 |
| 117 void addLoader(ImageBitmapLoader*); | 117 void addLoader(ImageBitmapLoader*); |
| 118 void didFinishLoading(ImageBitmapLoader*); | 118 void didFinishLoading(ImageBitmapLoader*); |
| 119 | 119 |
| 120 PersistentHeapHashSetWillBeHeapHashSet<Member<ImageBitmapLoader>> m_pendingL
oaders; | 120 PersistentHeapHashSetWillBeHeapHashSet<Member<ImageBitmapLoader>> m_pendingL
oaders; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| 124 | 124 |
| 125 #endif // ImageBitmapFactories_h | 125 #endif // ImageBitmapFactories_h |
| OLD | NEW |