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

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

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix webusb ScriptPromiseResolver usage Created 5 years, 4 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
« no previous file with comments | « Source/modules/geofencing/Geofencing.cpp ('k') | Source/modules/mediastream/MediaDevices.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 static IntSize sizeFor(HTMLVideoElement* video) 62 static IntSize sizeFor(HTMLVideoElement* video)
63 { 63 {
64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) 64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer())
65 return webMediaPlayer->naturalSize(); 65 return webMediaPlayer->naturalSize();
66 return IntSize(); 66 return IntSize();
67 } 67 }
68 68
69 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill BeRawPtr<ImageBitmap> imageBitmap) 69 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill BeRawPtr<ImageBitmap> imageBitmap)
70 { 70 {
71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 71 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
72 ScriptPromise promise = resolver->promise(); 72 ScriptPromise promise = resolver->promise();
73 if (imageBitmap) { 73 if (imageBitmap) {
74 resolver->resolve(imageBitmap); 74 resolver->resolve(imageBitmap);
75 } else { 75 } else {
76 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate( )))); 76 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate( ))));
77 } 77 }
78 return promise; 78 return promise;
79 } 79 }
80 80
81 ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptS tate, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& excepti onState) 81 ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptS tate, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& excepti onState)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (!sw || !sh) { 177 if (!sw || !sh) {
178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
179 return ScriptPromise(); 179 return ScriptPromise();
180 } 180 }
181 181
182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap:: create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); 183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap:: create(canvas, IntRect(sx, sy, sw, sh)) : nullptr);
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/geofencing/Geofencing.cpp ('k') | Source/modules/mediastream/MediaDevices.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698