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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 ResolvePromiseOnOriginalThread, | 301 ResolvePromiseOnOriginalThread, |
302 WrapCrossThreadPersistent(this), std::move(frame))); | 302 WrapCrossThreadPersistent(this), std::move(frame))); |
303 } | 303 } |
304 | 304 |
305 void ImageBitmapFactories::ImageBitmapLoader::ResolvePromiseOnOriginalThread( | 305 void ImageBitmapFactories::ImageBitmapLoader::ResolvePromiseOnOriginalThread( |
306 sk_sp<SkImage> frame) { | 306 sk_sp<SkImage> frame) { |
307 if (!frame) { | 307 if (!frame) { |
308 RejectPromise(); | 308 RejectPromise(); |
309 return; | 309 return; |
310 } | 310 } |
311 ASSERT(frame->width() && frame->height()); | 311 DCHECK(frame->width()); |
| 312 DCHECK(frame->height()); |
312 | 313 |
313 RefPtr<StaticBitmapImage> image = StaticBitmapImage::Create(std::move(frame)); | 314 RefPtr<StaticBitmapImage> image = StaticBitmapImage::Create(std::move(frame)); |
314 image->SetOriginClean(true); | 315 image->SetOriginClean(true); |
315 ImageBitmap* image_bitmap = ImageBitmap::Create(image, crop_rect_, options_); | 316 ImageBitmap* image_bitmap = ImageBitmap::Create(image, crop_rect_, options_); |
316 if (image_bitmap && image_bitmap->BitmapImage()) { | 317 if (image_bitmap && image_bitmap->BitmapImage()) { |
317 resolver_->Resolve(image_bitmap); | 318 resolver_->Resolve(image_bitmap); |
318 } else { | 319 } else { |
319 RejectPromise(); | 320 RejectPromise(); |
320 return; | 321 return; |
321 } | 322 } |
322 factory_->DidFinishLoading(this); | 323 factory_->DidFinishLoading(this); |
323 } | 324 } |
324 | 325 |
325 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { | 326 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { |
326 visitor->Trace(factory_); | 327 visitor->Trace(factory_); |
327 visitor->Trace(resolver_); | 328 visitor->Trace(resolver_); |
328 } | 329 } |
329 | 330 |
330 } // namespace blink | 331 } // namespace blink |
OLD | NEW |