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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "bindings/core/v8/HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElement
OrBlobOrImageDataOrImageBitmap.h" | 34 #include "bindings/core/v8/HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElement
OrBlobOrImageDataOrImageBitmap.h" |
35 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
36 #include "bindings/core/v8/ScriptPromiseResolver.h" | 36 #include "bindings/core/v8/ScriptPromiseResolver.h" |
37 #include "bindings/core/v8/ScriptState.h" | 37 #include "bindings/core/v8/ScriptState.h" |
38 #include "core/fileapi/FileReaderLoader.h" | 38 #include "core/fileapi/FileReaderLoader.h" |
39 #include "core/fileapi/FileReaderLoaderClient.h" | 39 #include "core/fileapi/FileReaderLoaderClient.h" |
40 #include "core/imagebitmap/ImageBitmapOptions.h" | 40 #include "core/imagebitmap/ImageBitmapOptions.h" |
41 #include "platform/Supplementable.h" | 41 #include "platform/Supplementable.h" |
42 #include "platform/geometry/IntRect.h" | 42 #include "platform/geometry/IntRect.h" |
| 43 #include "third_party/skia/include/core/SkRefCnt.h" |
43 #include <memory> | 44 #include <memory> |
44 | 45 |
45 class SkImage; | 46 class SkImage; |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 class Blob; | 50 class Blob; |
50 class EventTarget; | 51 class EventTarget; |
51 class ExceptionState; | 52 class ExceptionState; |
52 class ExecutionContext; | 53 class ExecutionContext; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 88 |
88 ~ImageBitmapLoader() override { } | 89 ~ImageBitmapLoader() override { } |
89 | 90 |
90 private: | 91 private: |
91 ImageBitmapLoader(ImageBitmapFactories&, Optional<IntRect> cropRect, Scr
iptState*, const ImageBitmapOptions&); | 92 ImageBitmapLoader(ImageBitmapFactories&, Optional<IntRect> cropRect, Scr
iptState*, const ImageBitmapOptions&); |
92 | 93 |
93 void rejectPromise(); | 94 void rejectPromise(); |
94 | 95 |
95 void scheduleAsyncImageBitmapDecoding(DOMArrayBuffer*); | 96 void scheduleAsyncImageBitmapDecoding(DOMArrayBuffer*); |
96 void decodeImageOnDecoderThread(WebTaskRunner*, DOMArrayBuffer*, const S
tring& premultiplyAlphaOption, const String& colorSpaceConversionOption); | 97 void decodeImageOnDecoderThread(WebTaskRunner*, DOMArrayBuffer*, const S
tring& premultiplyAlphaOption, const String& colorSpaceConversionOption); |
97 void resolvePromiseOnOriginalThread(PassRefPtr<SkImage>); | 98 void resolvePromiseOnOriginalThread(sk_sp<SkImage>); |
98 | 99 |
99 // FileReaderLoaderClient | 100 // FileReaderLoaderClient |
100 void didStartLoading() override { } | 101 void didStartLoading() override { } |
101 void didReceiveData() override { } | 102 void didReceiveData() override { } |
102 void didFinishLoading() override; | 103 void didFinishLoading() override; |
103 void didFail(FileError::ErrorCode) override; | 104 void didFail(FileError::ErrorCode) override; |
104 | 105 |
105 std::unique_ptr<FileReaderLoader> m_loader; | 106 std::unique_ptr<FileReaderLoader> m_loader; |
106 Member<ImageBitmapFactories> m_factory; | 107 Member<ImageBitmapFactories> m_factory; |
107 Member<ScriptPromiseResolver> m_resolver; | 108 Member<ScriptPromiseResolver> m_resolver; |
108 Optional<IntRect> m_cropRect; | 109 Optional<IntRect> m_cropRect; |
109 ImageBitmapOptions m_options; | 110 ImageBitmapOptions m_options; |
110 }; | 111 }; |
111 | 112 |
112 static ImageBitmapFactories& from(EventTarget&); | 113 static ImageBitmapFactories& from(EventTarget&); |
113 | 114 |
114 template<class GlobalObject> | 115 template<class GlobalObject> |
115 static ImageBitmapFactories& fromInternal(GlobalObject&); | 116 static ImageBitmapFactories& fromInternal(GlobalObject&); |
116 | 117 |
117 void addLoader(ImageBitmapLoader*); | 118 void addLoader(ImageBitmapLoader*); |
118 void didFinishLoading(ImageBitmapLoader*); | 119 void didFinishLoading(ImageBitmapLoader*); |
119 | 120 |
120 HeapHashSet<Member<ImageBitmapLoader>> m_pendingLoaders; | 121 HeapHashSet<Member<ImageBitmapLoader>> m_pendingLoaders; |
121 }; | 122 }; |
122 | 123 |
123 } // namespace blink | 124 } // namespace blink |
124 | 125 |
125 #endif // ImageBitmapFactories_h | 126 #endif // ImageBitmapFactories_h |
OLD | NEW |