| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef AesKeyAlgorithm_h | 31 #ifndef ColorSpaceTransform_h |
| 32 #define AesKeyAlgorithm_h | 32 #define ColorSpaceTransform_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "wtf/PassRefPtr.h" |
| 35 #include "modules/crypto/KeyAlgorithm.h" | |
| 36 #include "platform/heap/Handle.h" | |
| 37 #include "wtf/Forward.h" | |
| 38 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
| 39 | 36 |
| 37 #if USE(QCMSLIB) |
| 38 #include "qcms.h" |
| 39 #include "wtf/ThreadSafeRefCounted.h" |
| 40 #endif |
| 41 |
| 40 namespace WebCore { | 42 namespace WebCore { |
| 41 | 43 |
| 42 class AesKeyAlgorithm : public KeyAlgorithm { | 44 #if USE(QCMSLIB) |
| 45 |
| 46 class ColorSpaceTransform : public ThreadSafeRefCounted<ColorSpaceTransform> { |
| 43 public: | 47 public: |
| 44 static AesKeyAlgorithm* create(const blink::WebCryptoKeyAlgorithm&); | 48 static PassRefPtr<ColorSpaceTransform> create(qcms_transform* transform) |
| 49 { |
| 50 return adoptRef(new ColorSpaceTransform(transform)); |
| 51 } |
| 45 | 52 |
| 46 unsigned short length(); | 53 qcms_transform* transform() { return m_transform; } |
| 47 | 54 |
| 48 virtual void trace(Visitor*) OVERRIDE; | 55 ~ColorSpaceTransform() |
| 56 { |
| 57 if (m_transform) |
| 58 qcms_transform_release(m_transform); |
| 59 |
| 60 m_transform = 0; |
| 61 } |
| 49 | 62 |
| 50 private: | 63 private: |
| 51 explicit AesKeyAlgorithm(const blink::WebCryptoKeyAlgorithm&); | 64 explicit ColorSpaceTransform(qcms_transform* transform) |
| 65 : m_transform(transform) |
| 66 { |
| 67 } |
| 68 |
| 69 qcms_transform* m_transform; |
| 52 }; | 70 }; |
| 53 | 71 |
| 54 DEFINE_KEY_ALGORITHM_TYPE_CASTS(AesKeyAlgorithm); | 72 #else |
| 73 |
| 74 class ColorSpaceTransform : public RefCounted<ColorSpaceTransform> { |
| 75 public: |
| 76 static PassRefPtr<ColorSpaceTransform> create(void*) |
| 77 { |
| 78 return nullptr; |
| 79 } |
| 80 |
| 81 private: |
| 82 ColorSpaceTransform() |
| 83 { |
| 84 } |
| 85 }; |
| 86 |
| 87 #endif |
| 55 | 88 |
| 56 } // namespace WebCore | 89 } // namespace WebCore |
| 57 | 90 |
| 58 #endif | 91 #endif // ColorSpaceTransform_h |
| OLD | NEW |