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

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

Issue 212933005: Oilpan: turn DOMWindow into a heap supplementable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make use of DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED() 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
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 { 269 {
270 return "ImageBitmapFactories"; 270 return "ImageBitmapFactories";
271 } 271 }
272 272
273 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget) 273 ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget)
274 { 274 {
275 if (DOMWindow* window = eventTarget.toDOMWindow()) 275 if (DOMWindow* window = eventTarget.toDOMWindow())
276 return fromInternal(*window); 276 return fromInternal(*window);
277 277
278 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope()); 278 ASSERT(eventTarget.executionContext()->isWorkerGlobalScope());
279 return WorkerGlobalScopeImageBitmapFactories::fromInternal(*toWorkerGlobalSc ope(eventTarget.executionContext())); 279 return ImageBitmapFactories::fromInternal(*toWorkerGlobalScope(eventTarget.e xecutionContext()));
280 } 280 }
281 281
282 ImageBitmapFactories& ImageBitmapFactories::fromInternal(DOMWindow& object) 282 template<class GlobalObject>
283 ImageBitmapFactories& ImageBitmapFactories::fromInternal(GlobalObject& object)
283 { 284 {
284 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(Supple ment<DOMWindow>::from(object, supplementName())); 285 ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(WillBe HeapSupplement<GlobalObject>::from(object, supplementName()));
285 if (!supplement) { 286 if (!supplement) {
286 supplement = new ImageBitmapFactories(); 287 supplement = new ImageBitmapFactories();
287 Supplement<DOMWindow>::provideTo(object, supplementName(), adoptPtr(supp lement)); 288 WillBeHeapSupplement<GlobalObject>::provideTo(object, supplementName(), adoptPtrWillBeNoop(supplement));
288 } 289 }
289 return *supplement; 290 return *supplement;
290 } 291 }
291 292
292 void ImageBitmapFactories::addLoader(PassRefPtr<ImageBitmapLoader> loader) 293 void ImageBitmapFactories::addLoader(PassRefPtr<ImageBitmapLoader> loader)
293 { 294 {
294 m_pendingLoaders.add(loader); 295 m_pendingLoaders.add(loader);
295 } 296 }
296 297
297 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader) 298 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 ScriptScope scope(m_scriptState); 353 ScriptScope scope(m_scriptState);
353 m_resolver->resolve(imageBitmap.release()); 354 m_resolver->resolve(imageBitmap.release());
354 m_factory->didFinishLoading(this); 355 m_factory->didFinishLoading(this);
355 } 356 }
356 357
357 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) 358 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
358 { 359 {
359 rejectPromise(); 360 rejectPromise();
360 } 361 }
361 362
362 ImageBitmapFactories& WorkerGlobalScopeImageBitmapFactories::fromInternal(Worker GlobalScope& object)
363 {
364 WorkerGlobalScopeImageBitmapFactories* supplement = static_cast<WorkerGlobal ScopeImageBitmapFactories*>(WillBeHeapSupplement<WorkerGlobalScope>::from(object , ImageBitmapFactories::supplementName()));
365 if (!supplement) {
366 supplement = new WorkerGlobalScopeImageBitmapFactories();
367 WillBeHeapSupplement<WorkerGlobalScope>::provideTo(object, ImageBitmapFa ctories::supplementName(), adoptPtrWillBeNoop(supplement));
368 }
369 return *supplement;
370 }
371
372 void WorkerGlobalScopeImageBitmapFactories::trace(Visitor*)
373 {
374 }
375
376 } // namespace WebCore 363 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/imagebitmap/ImageBitmapFactories.h ('k') | Source/modules/indexeddb/DOMWindowIndexedDatabase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698