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

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

Issue 197283042: Remove use of a V8 isolate outside of bindings code in ImageBitmapFactories.cpp. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return IntSize(); 63 return IntSize();
64 } 64 }
65 65
66 static ScriptPromise fulfillImageBitmap(ExecutionContext* context, PassRefPtrWil lBeRawPtr<ImageBitmap> imageBitmap) 66 static ScriptPromise fulfillImageBitmap(ExecutionContext* context, PassRefPtrWil lBeRawPtr<ImageBitmap> imageBitmap)
67 { 67 {
68 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(conte xt); 68 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(conte xt);
69 ScriptPromise promise = resolver->promise(); 69 ScriptPromise promise = resolver->promise();
70 if (imageBitmap) { 70 if (imageBitmap) {
71 resolver->resolve(imageBitmap); 71 resolver->resolve(imageBitmap);
72 } else { 72 } else {
73 v8::Isolate* isolate = ScriptState::current()->isolate(); 73 resolver->reject(ScriptValue::createNull());
74 resolver->reject(ScriptValue(v8::Null(isolate), isolate));
75 } 74 }
76 return promise; 75 return promise;
77 } 76 }
78 77
79 ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionState) 78 ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionState)
80 { 79 {
81 LayoutSize s = sizeFor(image); 80 LayoutSize s = sizeFor(image);
82 return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), ex ceptionState); 81 return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), ex ceptionState);
83 } 82 }
84 83
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 { 308 {
310 } 309 }
311 310
312 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co ntext, Blob* blob) 311 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co ntext, Blob* blob)
313 { 312 {
314 m_loader.start(context, blob->blobDataHandle()); 313 m_loader.start(context, blob->blobDataHandle());
315 } 314 }
316 315
317 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() 316 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise()
318 { 317 {
319 v8::Isolate* isolate = m_scriptState->isolate();
320 ScriptScope scope(m_scriptState); 318 ScriptScope scope(m_scriptState);
321 m_resolver->reject(ScriptValue(v8::Null(isolate), isolate)); 319 m_resolver->reject(ScriptValue::createNull());
322 m_factory->didFinishLoading(this); 320 m_factory->didFinishLoading(this);
323 } 321 }
324 322
325 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() 323 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading()
326 { 324 {
327 if (!m_loader.arrayBufferResult()) { 325 if (!m_loader.arrayBufferResult()) {
328 rejectPromise(); 326 rejectPromise();
329 return; 327 return;
330 } 328 }
331 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr ayBufferResult()->data(), m_loader.arrayBufferResult()->byteLength()); 329 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr ayBufferResult()->data(), m_loader.arrayBufferResult()->byteLength());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 WillBeHeapSupplement<WorkerGlobalScope>::provideTo(object, ImageBitmapFa ctories::supplementName(), adoptPtrWillBeNoop(supplement)); 365 WillBeHeapSupplement<WorkerGlobalScope>::provideTo(object, ImageBitmapFa ctories::supplementName(), adoptPtrWillBeNoop(supplement));
368 } 366 }
369 return *supplement; 367 return *supplement;
370 } 368 }
371 369
372 void WorkerGlobalScopeImageBitmapFactories::trace(Visitor*) 370 void WorkerGlobalScopeImageBitmapFactories::trace(Visitor*)
373 { 371 {
374 } 372 }
375 373
376 } // namespace WebCore 374 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698