| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47 class CanvasRenderingContext2D; | 47 class CanvasRenderingContext2D; | 
| 48 class EventTarget; | 48 class EventTarget; | 
| 49 class ExceptionState; | 49 class ExceptionState; | 
| 50 class HTMLCanvasElement; | 50 class HTMLCanvasElement; | 
| 51 class HTMLImageElement; | 51 class HTMLImageElement; | 
| 52 class HTMLVideoElement; | 52 class HTMLVideoElement; | 
| 53 class ImageBitmap; | 53 class ImageBitmap; | 
| 54 class ImageData; | 54 class ImageData; | 
| 55 class ExecutionContext; | 55 class ExecutionContext; | 
| 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 | 59 | 
| 60 public: | 60 public: | 
| 61     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLImage
     Element*, ExceptionState&); | 61     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLImage
     Element*, ExceptionState&); | 
| 62     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLImage
     Element*, int sx, int sy, int sw, int sh, ExceptionState&); | 62     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLImage
     Element*, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 63     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLVideo
     Element*, ExceptionState&); | 63     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLVideo
     Element*, ExceptionState&); | 
| 64     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLVideo
     Element*, int sx, int sy, int sw, int sh, ExceptionState&); | 64     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLVideo
     Element*, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 65     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, CanvasRen
     deringContext2D*, ExceptionState&); | 65     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, CanvasRen
     deringContext2D*, ExceptionState&); | 
| 66     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, CanvasRen
     deringContext2D*, int sx, int sy, int sw, int sh, ExceptionState&); | 66     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, CanvasRen
     deringContext2D*, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 67     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLCanva
     sElement*, ExceptionState&); | 67     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLCanva
     sElement*, ExceptionState&); | 
| 68     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLCanva
     sElement*, int sx, int sy, int sw, int sh, ExceptionState&); | 68     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, HTMLCanva
     sElement*, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 69     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, Blob*, Ex
     ceptionState&); | 69     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, Blob*, Ex
     ceptionState&); | 
| 70     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, Blob*, in
     t sx, int sy, int sw, int sh, ExceptionState&); | 70     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, Blob*, in
     t sx, int sy, int sw, int sh, ExceptionState&); | 
| 71     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageData
     *, ExceptionState&); | 71     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageData
     *, ExceptionState&); | 
| 72     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageData
     *, int sx, int sy, int sw, int sh, ExceptionState&); | 72     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageData
     *, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 73     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageBitm
     ap*, ExceptionState&); | 73     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageBitm
     ap*, ExceptionState&); | 
| 74     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageBitm
     ap*, int sx, int sy, int sw, int sh, ExceptionState&); | 74     static ScriptPromise createImageBitmap(ScriptState*, EventTarget&, ImageBitm
     ap*, int sx, int sy, int sw, int sh, ExceptionState&); | 
| 75 | 75 | 
| 76     virtual ~ImageBitmapFactories() { } | 76     virtual ~ImageBitmapFactories() { } | 
| 77 | 77 | 
| 78     void trace(Visitor*); | 78     void trace(Visitor*); | 
| 79 | 79 | 
| 80 protected: | 80 protected: | 
| 81     static const char* supplementName(); | 81     static const char* supplementName(); | 
| 82 | 82 | 
| 83 private: | 83 private: | 
| 84     class ImageBitmapLoader FINAL : public GarbageCollectedFinalized<ImageBitmap
     Loader>, public FileReaderLoaderClient { | 84     class ImageBitmapLoader final : public GarbageCollectedFinalized<ImageBitmap
     Loader>, public FileReaderLoaderClient { | 
| 85     public: | 85     public: | 
| 86         static ImageBitmapLoader* create(ImageBitmapFactories& factory, const In
     tRect& cropRect, ScriptState* scriptState) | 86         static ImageBitmapLoader* create(ImageBitmapFactories& factory, const In
     tRect& cropRect, ScriptState* scriptState) | 
| 87         { | 87         { | 
| 88             return new ImageBitmapLoader(factory, cropRect, scriptState); | 88             return new ImageBitmapLoader(factory, cropRect, scriptState); | 
| 89         } | 89         } | 
| 90 | 90 | 
| 91         void loadBlobAsync(ExecutionContext*, Blob*); | 91         void loadBlobAsync(ExecutionContext*, Blob*); | 
| 92         ScriptPromise promise() { return m_resolver->promise(); } | 92         ScriptPromise promise() { return m_resolver->promise(); } | 
| 93 | 93 | 
| 94         void trace(Visitor*); | 94         void trace(Visitor*); | 
| 95 | 95 | 
| 96         virtual ~ImageBitmapLoader() { } | 96         virtual ~ImageBitmapLoader() { } | 
| 97 | 97 | 
| 98     private: | 98     private: | 
| 99         ImageBitmapLoader(ImageBitmapFactories&, const IntRect&, ScriptState*); | 99         ImageBitmapLoader(ImageBitmapFactories&, const IntRect&, ScriptState*); | 
| 100 | 100 | 
| 101         void rejectPromise(); | 101         void rejectPromise(); | 
| 102 | 102 | 
| 103         // FileReaderLoaderClient | 103         // FileReaderLoaderClient | 
| 104         virtual void didStartLoading() OVERRIDE { } | 104         virtual void didStartLoading() override { } | 
| 105         virtual void didReceiveData() OVERRIDE { } | 105         virtual void didReceiveData() override { } | 
| 106         virtual void didFinishLoading() OVERRIDE; | 106         virtual void didFinishLoading() override; | 
| 107         virtual void didFail(FileError::ErrorCode) OVERRIDE; | 107         virtual void didFail(FileError::ErrorCode) override; | 
| 108 | 108 | 
| 109         FileReaderLoader m_loader; | 109         FileReaderLoader m_loader; | 
| 110         RawPtrWillBeMember<ImageBitmapFactories> m_factory; | 110         RawPtrWillBeMember<ImageBitmapFactories> m_factory; | 
| 111         RefPtr<ScriptPromiseResolver> m_resolver; | 111         RefPtr<ScriptPromiseResolver> m_resolver; | 
| 112         IntRect m_cropRect; | 112         IntRect m_cropRect; | 
| 113     }; | 113     }; | 
| 114 | 114 | 
| 115     static ImageBitmapFactories& from(EventTarget&); | 115     static ImageBitmapFactories& from(EventTarget&); | 
| 116 | 116 | 
| 117     template<class GlobalObject> | 117     template<class GlobalObject> | 
| 118     static ImageBitmapFactories& fromInternal(GlobalObject&); | 118     static ImageBitmapFactories& fromInternal(GlobalObject&); | 
| 119 | 119 | 
| 120     void addLoader(ImageBitmapLoader*); | 120     void addLoader(ImageBitmapLoader*); | 
| 121     void didFinishLoading(ImageBitmapLoader*); | 121     void didFinishLoading(ImageBitmapLoader*); | 
| 122 | 122 | 
| 123     PersistentHeapHashSetWillBeHeapHashSet<Member<ImageBitmapLoader> > m_pending
     Loaders; | 123     PersistentHeapHashSetWillBeHeapHashSet<Member<ImageBitmapLoader> > m_pending
     Loaders; | 
| 124 }; | 124 }; | 
| 125 | 125 | 
| 126 } // namespace blink | 126 } // namespace blink | 
| 127 | 127 | 
| 128 #endif // ImageBitmapFactories_h | 128 #endif // ImageBitmapFactories_h | 
| OLD | NEW | 
|---|