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

Side by Side Diff: Source/modules/imagebitmap/ImageBitmapFactories.cpp

Issue 190183003: Oilpan: move ImageBitmap to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have ImageLoader keep a persistent set of ImageLoaderClients Created 6 years, 9 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return IntSize(); 56 return IntSize();
57 } 57 }
58 58
59 static IntSize sizeFor(HTMLVideoElement* video) 59 static IntSize sizeFor(HTMLVideoElement* video)
60 { 60 {
61 if (MediaPlayer* player = video->player()) 61 if (MediaPlayer* player = video->player())
62 return player->naturalSize(); 62 return player->naturalSize();
63 return IntSize(); 63 return IntSize();
64 } 64 }
65 65
66 static ScriptPromise fulfillImageBitmap(ExecutionContext* context, PassRefPtr<Im ageBitmap> imageBitmap) 66 static ScriptPromise fulfillImageBitmap(ExecutionContext* context, PassRefPtrWil lBeRawPtr<ImageBitmap> imageBitmap)
67 { 67 {
68 ScriptPromise promise = ScriptPromise::createPending(context); 68 ScriptPromise promise = ScriptPromise::createPending(context);
69 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(promi se, context); 69 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(promi se, context);
70 resolver->resolve(imageBitmap); 70 resolver->resolve(imageBitmap);
71 return promise; 71 return promise;
72 } 72 }
73 73
74 ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionState) 74 ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionState)
75 { 75 {
76 LayoutSize s = sizeFor(image); 76 LayoutSize s = sizeFor(image);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 RefPtr<Image> image = BitmapImage::create(imageSkia); 336 RefPtr<Image> image = BitmapImage::create(imageSkia);
337 if (!image->width() || !image->height()) { 337 if (!image->width() || !image->height()) {
338 rejectPromise(); 338 rejectPromise();
339 return; 339 return;
340 } 340 }
341 if (!m_cropRect.width() && !m_cropRect.height()) { 341 if (!m_cropRect.width() && !m_cropRect.height()) {
342 // No cropping variant was called. 342 // No cropping variant was called.
343 m_cropRect = IntRect(IntPoint(), image->size()); 343 m_cropRect = IntRect(IntPoint(), image->size());
344 } 344 }
345 345
346 RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(), m_cropRec t); 346 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get( ), m_cropRect);
347 ScriptScope scope(m_scriptState); 347 ScriptScope scope(m_scriptState);
348 m_resolver->resolve(imageBitmap.release()); 348 m_resolver->resolve(imageBitmap.release());
349 m_factory->didFinishLoading(this); 349 m_factory->didFinishLoading(this);
350 } 350 }
351 351
352 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) 352 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
353 { 353 {
354 rejectPromise(); 354 rejectPromise();
355 } 355 }
356 356
357 } // namespace WebCore 357 } // namespace WebCore
OLDNEW
« Source/core/loader/ImageLoader.h ('K') | « Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698