OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 bool firstFrameForcedToBeEmpty() const { return m_firstFrameForcedToBeEmpty; } | 55 bool firstFrameForcedToBeEmpty() const { return m_firstFrameForcedToBeEmpty; } |
56 | 56 |
57 private: | 57 private: |
58 bool m_firstFrameForcedToBeEmpty; | 58 bool m_firstFrameForcedToBeEmpty; |
59 }; | 59 }; |
60 | 60 |
61 class MockImageDecoder : public ImageDecoder { | 61 class MockImageDecoder : public ImageDecoder { |
62 public: | 62 public: |
63 static std::unique_ptr<MockImageDecoder> create( | 63 static std::unique_ptr<MockImageDecoder> create( |
64 MockImageDecoderClient* client) { | 64 MockImageDecoderClient* client) { |
65 return makeUnique<MockImageDecoder>(client); | 65 return WTF::makeUnique<MockImageDecoder>(client); |
66 } | 66 } |
67 | 67 |
68 MockImageDecoder(MockImageDecoderClient* client) | 68 MockImageDecoder(MockImageDecoderClient* client) |
69 : ImageDecoder(AlphaPremultiplied, | 69 : ImageDecoder(AlphaPremultiplied, |
70 ColorBehavior::transformToTargetForTesting(), | 70 ColorBehavior::transformToTargetForTesting(), |
71 noDecodedImageByteLimit), | 71 noDecodedImageByteLimit), |
72 m_client(client) {} | 72 m_client(client) {} |
73 | 73 |
74 ~MockImageDecoder() { m_client->decoderBeingDestroyed(); } | 74 ~MockImageDecoder() { m_client->decoderBeingDestroyed(); } |
75 | 75 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 MockImageDecoderClient* m_client; | 119 MockImageDecoderClient* m_client; |
120 }; | 120 }; |
121 | 121 |
122 class MockImageDecoderFactory : public ImageDecoderFactory { | 122 class MockImageDecoderFactory : public ImageDecoderFactory { |
123 public: | 123 public: |
124 static std::unique_ptr<MockImageDecoderFactory> create( | 124 static std::unique_ptr<MockImageDecoderFactory> create( |
125 MockImageDecoderClient* client, | 125 MockImageDecoderClient* client, |
126 const SkISize& decodedSize) { | 126 const SkISize& decodedSize) { |
127 return wrapUnique(new MockImageDecoderFactory( | 127 return WTF::wrapUnique(new MockImageDecoderFactory( |
128 client, IntSize(decodedSize.width(), decodedSize.height()))); | 128 client, IntSize(decodedSize.width(), decodedSize.height()))); |
129 } | 129 } |
130 | 130 |
131 static std::unique_ptr<MockImageDecoderFactory> create( | 131 static std::unique_ptr<MockImageDecoderFactory> create( |
132 MockImageDecoderClient* client, | 132 MockImageDecoderClient* client, |
133 const IntSize& decodedSize) { | 133 const IntSize& decodedSize) { |
134 return wrapUnique(new MockImageDecoderFactory(client, decodedSize)); | 134 return WTF::wrapUnique(new MockImageDecoderFactory(client, decodedSize)); |
135 } | 135 } |
136 | 136 |
137 std::unique_ptr<ImageDecoder> create() override { | 137 std::unique_ptr<ImageDecoder> create() override { |
138 std::unique_ptr<MockImageDecoder> decoder = | 138 std::unique_ptr<MockImageDecoder> decoder = |
139 MockImageDecoder::create(m_client); | 139 MockImageDecoder::create(m_client); |
140 decoder->setSize(m_decodedSize.width(), m_decodedSize.height()); | 140 decoder->setSize(m_decodedSize.width(), m_decodedSize.height()); |
141 return std::move(decoder); | 141 return std::move(decoder); |
142 } | 142 } |
143 | 143 |
144 private: | 144 private: |
145 MockImageDecoderFactory(MockImageDecoderClient* client, | 145 MockImageDecoderFactory(MockImageDecoderClient* client, |
146 const IntSize& decodedSize) | 146 const IntSize& decodedSize) |
147 : m_client(client), m_decodedSize(decodedSize) {} | 147 : m_client(client), m_decodedSize(decodedSize) {} |
148 | 148 |
149 MockImageDecoderClient* m_client; | 149 MockImageDecoderClient* m_client; |
150 IntSize m_decodedSize; | 150 IntSize m_decodedSize; |
151 }; | 151 }; |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
154 | 154 |
155 #endif // MockImageDecoder_h | 155 #endif // MockImageDecoder_h |
OLD | NEW |