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

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

Issue 323293004: Enable Oilpan for ImageBitmapFactories::ImageBitmapLoader by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/imagebitmap/ImageBitmapFactories.h ('k') | no next file » | 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 177 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
178 return ScriptPromise(); 178 return ScriptPromise();
179 } 179 }
180 180
181 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 181 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
182 return fulfillImageBitmap(scriptState, canvas->buffer() ? ImageBitmap::creat e(canvas, IntRect(sx, sy, sw, sh)) : nullptr); 182 return fulfillImageBitmap(scriptState, canvas->buffer() ? ImageBitmap::creat e(canvas, IntRect(sx, sy, sw, sh)) : nullptr);
183 } 183 }
184 184
185 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState) 185 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState)
186 { 186 {
187 RefPtrWillBeRawPtr<ImageBitmapLoader> loader = ImageBitmapFactories::ImageBi tmapLoader::create(from(eventTarget), IntRect(), scriptState); 187 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create( from(eventTarget), IntRect(), scriptState);
188 ScriptPromise promise = loader->promise(); 188 ScriptPromise promise = loader->promise();
189 from(eventTarget).addLoader(loader); 189 from(eventTarget).addLoader(loader);
190 loader->loadBlobAsync(eventTarget.executionContext(), blob); 190 loader->loadBlobAsync(eventTarget.executionContext(), blob);
191 return promise; 191 return promise;
192 } 192 }
193 193
194 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, int sx, int sy, int sw, int sh, ExceptionS tate& exceptionState) 194 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Blob* blob, int sx, int sy, int sw, int sh, ExceptionS tate& exceptionState)
195 { 195 {
196 if (!sw || !sh) { 196 if (!sw || !sh) {
197 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 197 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
198 return ScriptPromise(); 198 return ScriptPromise();
199 } 199 }
200 RefPtrWillBeRawPtr<ImageBitmapLoader> loader = ImageBitmapFactories::ImageBi tmapLoader::create(from(eventTarget), IntRect(sx, sy, sw, sh), scriptState); 200 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create( from(eventTarget), IntRect(sx, sy, sw, sh), scriptState);
201 ScriptPromise promise = loader->promise(); 201 ScriptPromise promise = loader->promise();
202 from(eventTarget).addLoader(loader); 202 from(eventTarget).addLoader(loader);
203 loader->loadBlobAsync(eventTarget.executionContext(), blob); 203 loader->loadBlobAsync(eventTarget.executionContext(), blob);
204 return promise; 204 return promise;
205 } 205 }
206 206
207 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, ImageData* data, ExceptionState& exceptionState) 207 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, ImageData* data, ExceptionState& exceptionState)
208 { 208 {
209 return createImageBitmap(scriptState, eventTarget, data, 0, 0, data->width() , data->height(), exceptionState); 209 return createImageBitmap(scriptState, eventTarget, data, 0, 0, data->width() , data->height(), exceptionState);
210 } 210 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 ImageBitmapFactories& ImageBitmapFactories::fromInternal(GlobalObject& object) 252 ImageBitmapFactories& ImageBitmapFactories::fromInternal(GlobalObject& object)
253 { 253 {
254 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe HeapSupplement<GlobalObject>::from(object, supplementName())); 254 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe HeapSupplement<GlobalObject>::from(object, supplementName()));
255 if (!supplement) { 255 if (!supplement) {
256 supplement = new ImageBitmapFactories(); 256 supplement = new ImageBitmapFactories();
257 WillBeHeapSupplement<GlobalObject>::provideTo(object, supplementName(), adoptPtrWillBeNoop(supplement)); 257 WillBeHeapSupplement<GlobalObject>::provideTo(object, supplementName(), adoptPtrWillBeNoop(supplement));
258 } 258 }
259 return *supplement; 259 return *supplement;
260 } 260 }
261 261
262 void ImageBitmapFactories::addLoader(PassRefPtrWillBeRawPtr<ImageBitmapLoader> l oader) 262 void ImageBitmapFactories::addLoader(ImageBitmapLoader* loader)
263 { 263 {
264 m_pendingLoaders.add(loader); 264 m_pendingLoaders.add(loader);
265 } 265 }
266 266
267 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader) 267 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader)
268 { 268 {
269 ASSERT(m_pendingLoaders.contains(loader)); 269 ASSERT(m_pendingLoaders.contains(loader));
270 m_pendingLoaders.remove(loader); 270 m_pendingLoaders.remove(loader);
271 } 271 }
272 272
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 { 331 {
332 rejectPromise(); 332 rejectPromise();
333 } 333 }
334 334
335 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) 335 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor)
336 { 336 {
337 visitor->trace(m_factory); 337 visitor->trace(m_factory);
338 } 338 }
339 339
340 } // namespace WebCore 340 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/imagebitmap/ImageBitmapFactories.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698