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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 m_resolver->reject(ScriptValue(m_resolver->scriptState(), v8::Null(m_resolve
r->scriptState()->isolate()))); | 164 m_resolver->reject(ScriptValue(m_resolver->scriptState(), v8::Null(m_resolve
r->scriptState()->isolate()))); |
165 m_factory->didFinishLoading(this); | 165 m_factory->didFinishLoading(this); |
166 } | 166 } |
167 | 167 |
168 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() | 168 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() |
169 { | 169 { |
170 if (!m_loader.arrayBufferResult()) { | 170 if (!m_loader.arrayBufferResult()) { |
171 rejectPromise(); | 171 rejectPromise(); |
172 return; | 172 return; |
173 } | 173 } |
174 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr
ayBufferResult()->data(), m_loader.arrayBufferResult()->byteLength()); | 174 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr
ayBufferResult()->data(), static_cast<size_t>(m_loader.arrayBufferResult()->byte
Length())); |
175 | 175 |
176 OwnPtr<ImageSource> source = adoptPtr(new ImageSource()); | 176 OwnPtr<ImageSource> source = adoptPtr(new ImageSource()); |
177 source->setData(*sharedBuffer, true); | 177 source->setData(*sharedBuffer, true); |
178 | 178 |
179 RefPtr<SkImage> frame = source->createFrameAtIndex(0); | 179 RefPtr<SkImage> frame = source->createFrameAtIndex(0); |
180 ASSERT(!frame || (frame->width() && frame->height())); | 180 ASSERT(!frame || (frame->width() && frame->height())); |
181 if (!frame) { | 181 if (!frame) { |
182 rejectPromise(); | 182 rejectPromise(); |
183 return; | 183 return; |
184 } | 184 } |
(...skipping 14 matching lines...) Expand all Loading... |
199 rejectPromise(); | 199 rejectPromise(); |
200 } | 200 } |
201 | 201 |
202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) | 202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) |
203 { | 203 { |
204 visitor->trace(m_factory); | 204 visitor->trace(m_factory); |
205 visitor->trace(m_resolver); | 205 visitor->trace(m_resolver); |
206 } | 206 } |
207 | 207 |
208 } // namespace blink | 208 } // namespace blink |
OLD | NEW |