| OLD | NEW |
| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget) | 267 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget) |
| 268 { | 268 { |
| 269 if (DOMWindow* window = eventTarget.toDOMWindow()) | 269 if (DOMWindow* window = eventTarget.toDOMWindow()) |
| 270 return fromInternal(*window); | 270 return fromInternal(*window); |
| 271 | 271 |
| 272 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope()); | 272 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope()); |
| 273 return fromInternal(*toWorkerGlobalScope(eventTarget.executionContext())); | 273 return fromInternal(*toWorkerGlobalScope(eventTarget.executionContext())); |
| 274 } | 274 } |
| 275 | 275 |
| 276 template <class T> | 276 |
| 277 template<> |
| 278 ImageBitmapFactories& ImageBitmapFactories::fromInternal(WorkerGlobalScope& obje
ct) |
| 279 { |
| 280 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe
HeapSupplement<WorkerGlobalScope>::from(object, supplementName())); |
| 281 if (!supplement) { |
| 282 supplement = new ImageBitmapFactories(); |
| 283 WillBeHeapSupplement<WorkerGlobalScope>::provideTo(object, supplementNam
e(), adoptPtrWillBeNoop(supplement)); |
| 284 } |
| 285 return *supplement; |
| 286 } |
| 287 |
| 288 template<class T> |
| 277 ImageBitmapFactories& ImageBitmapFactories::fromInternal(T& object) | 289 ImageBitmapFactories& ImageBitmapFactories::fromInternal(T& object) |
| 278 { | 290 { |
| 279 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(Supple
ment<T>::from(object, supplementName())); | 291 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(Supple
ment<T>::from(object, supplementName())); |
| 280 if (!supplement) { | 292 if (!supplement) { |
| 281 supplement = new ImageBitmapFactories(); | 293 supplement = new ImageBitmapFactories(); |
| 282 Supplement<T>::provideTo(object, supplementName(), adoptPtr(supplement))
; | 294 Supplement<T>::provideTo(object, supplementName(), adoptPtr(supplement))
; |
| 283 } | 295 } |
| 284 return *supplement; | 296 return *supplement; |
| 285 } | 297 } |
| 286 | 298 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 ScriptScope scope(m_scriptState); | 359 ScriptScope scope(m_scriptState); |
| 348 m_resolver->resolve(imageBitmap.release()); | 360 m_resolver->resolve(imageBitmap.release()); |
| 349 m_factory->didFinishLoading(this); | 361 m_factory->didFinishLoading(this); |
| 350 } | 362 } |
| 351 | 363 |
| 352 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) | 364 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) |
| 353 { | 365 { |
| 354 rejectPromise(); | 366 rejectPromise(); |
| 355 } | 367 } |
| 356 | 368 |
| 369 void ImageBitmapFactories::trace(Visitor*) |
| 370 { |
| 371 } |
| 372 |
| 357 } // namespace WebCore | 373 } // namespace WebCore |
| OLD | NEW |