Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 2325603005: Reject createImageBitmap promise when the cropRect or resize is too big (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas sRefPtr<SkImage> frame) 243 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas sRefPtr<SkImage> frame)
244 { 244 {
245 if (!frame) { 245 if (!frame) {
246 rejectPromise(); 246 rejectPromise();
247 return; 247 return;
248 } 248 }
249 ASSERT(frame->width() && frame->height()); 249 ASSERT(frame->width() && frame->height());
250 250
251 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(frame); 251 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(frame);
252 image->setOriginClean(true); 252 image->setOriginClean(true);
253
254 ImageBitmap* imageBitmap = ImageBitmap::create(image, m_cropRect, m_options) ; 253 ImageBitmap* imageBitmap = ImageBitmap::create(image, m_cropRect, m_options) ;
255 if (imageBitmap && imageBitmap->bitmapImage()) { 254 if (imageBitmap && imageBitmap->bitmapImage()) {
256 m_resolver->resolve(imageBitmap); 255 m_resolver->resolve(imageBitmap);
257 } else { 256 } else {
258 rejectPromise(); 257 rejectPromise();
259 return; 258 return;
260 } 259 }
261 m_factory->didFinishLoading(this); 260 m_factory->didFinishLoading(this);
262 } 261 }
263 262
264 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) 263 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader)
265 { 264 {
266 visitor->trace(m_factory); 265 visitor->trace(m_factory);
267 visitor->trace(m_resolver); 266 visitor->trace(m_resolver);
268 } 267 }
269 268
270 } // namespace blink 269 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698