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

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

Issue 783423003: Make ScriptPromiseResolver RefCountedWillBeRefCountedGarbageCollected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP: 1st trial Created 6 years 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 static IntSize sizeFor(HTMLVideoElement* video) 61 static IntSize sizeFor(HTMLVideoElement* video)
62 { 62 {
63 if (blink::WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) 63 if (blink::WebMediaPlayer* webMediaPlayer = video->webMediaPlayer())
64 return webMediaPlayer->naturalSize(); 64 return webMediaPlayer->naturalSize();
65 return IntSize(); 65 return IntSize();
66 } 66 }
67 67
68 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill BeRawPtr<ImageBitmap> imageBitmap) 68 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill BeRawPtr<ImageBitmap> imageBitmap)
69 { 69 {
70 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 70 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
71 ScriptPromise promise = resolver->promise(); 71 ScriptPromise promise = resolver->promise();
72 if (imageBitmap) { 72 if (imageBitmap) {
73 resolver->resolve(imageBitmap); 73 resolver->resolve(imageBitmap);
74 } else { 74 } else {
75 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate( )))); 75 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate( ))));
76 } 76 }
77 return promise; 77 return promise;
78 } 78 }
79 79
80 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionStat e) 80 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionStat e)
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 328
329 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) 329 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
330 { 330 {
331 rejectPromise(); 331 rejectPromise();
332 } 332 }
333 333
334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) 334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor)
335 { 335 {
336 visitor->trace(m_factory); 336 visitor->trace(m_factory);
337 visitor->trace(m_resolver);
337 } 338 }
338 339
339 } // namespace blink 340 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698