OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 class ImageLoader::Task : public blink::WebThread::Task { | 73 class ImageLoader::Task : public blink::WebThread::Task { |
74 public: | 74 public: |
75 static PassOwnPtr<Task> create(ImageLoader* loader, UpdateFromElementBehavio
r updateBehavior) | 75 static PassOwnPtr<Task> create(ImageLoader* loader, UpdateFromElementBehavio
r updateBehavior) |
76 { | 76 { |
77 return adoptPtr(new Task(loader, updateBehavior)); | 77 return adoptPtr(new Task(loader, updateBehavior)); |
78 } | 78 } |
79 | 79 |
80 Task(ImageLoader* loader, UpdateFromElementBehavior updateBehavior) | 80 Task(ImageLoader* loader, UpdateFromElementBehavior updateBehavior) |
81 : m_loader(loader) | 81 : m_loader(loader) |
82 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) | 82 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) |
| 83 , m_updateBehavior(updateBehavior) |
83 , m_weakFactory(this) | 84 , m_weakFactory(this) |
84 , m_updateBehavior(updateBehavior) | |
85 { | 85 { |
86 } | 86 } |
87 | 87 |
88 virtual void run() override | 88 virtual void run() override |
89 { | 89 { |
90 if (m_loader) { | 90 if (m_loader) { |
| 91 #if ENABLE(OILPAN) |
| 92 // Oilpan: this WebThread::Task microtask may run after the |
| 93 // loader has been GCed, but not yet lazily swept & finalized |
| 94 // (when this task's loader reference will be cleared.) |
| 95 // |
| 96 // Handle this transient condition by explicitly checking here |
| 97 // before going ahead with the update operation. Unsafe to do it |
| 98 // if so, as the objects that the loader refers to may have been |
| 99 // finalized by this time. |
| 100 if (Heap::willObjectBeLazilySwept(m_loader)) |
| 101 return; |
| 102 #endif |
91 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBe
havior); | 103 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBe
havior); |
92 } | 104 } |
93 } | 105 } |
94 | 106 |
95 void clearLoader() | 107 void clearLoader() |
96 { | 108 { |
97 m_loader = 0; | 109 m_loader = 0; |
98 } | 110 } |
99 | 111 |
100 WeakPtr<Task> createWeakPtr() | 112 WeakPtr<Task> createWeakPtr() |
101 { | 113 { |
102 return m_weakFactory.createWeakPtr(); | 114 return m_weakFactory.createWeakPtr(); |
103 } | 115 } |
104 | 116 |
105 private: | 117 private: |
106 ImageLoader* m_loader; | 118 ImageLoader* m_loader; |
107 BypassMainWorldBehavior m_shouldBypassMainWorldCSP; | 119 BypassMainWorldBehavior m_shouldBypassMainWorldCSP; |
| 120 UpdateFromElementBehavior m_updateBehavior; |
108 WeakPtrFactory<Task> m_weakFactory; | 121 WeakPtrFactory<Task> m_weakFactory; |
109 UpdateFromElementBehavior m_updateBehavior; | |
110 }; | 122 }; |
111 | 123 |
112 ImageLoader::ImageLoader(Element* element) | 124 ImageLoader::ImageLoader(Element* element) |
113 : m_element(element) | 125 : m_element(element) |
114 , m_image(0) | 126 , m_image(0) |
115 , m_derefElementTimer(this, &ImageLoader::timerFired) | 127 , m_derefElementTimer(this, &ImageLoader::timerFired) |
116 , m_hasPendingLoadEvent(false) | 128 , m_hasPendingLoadEvent(false) |
117 , m_hasPendingErrorEvent(false) | 129 , m_hasPendingErrorEvent(false) |
118 , m_imageComplete(true) | 130 , m_imageComplete(true) |
119 , m_loadingImageDocument(false) | 131 , m_loadingImageDocument(false) |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 #endif | 601 #endif |
590 } | 602 } |
591 | 603 |
592 #if ENABLE(OILPAN) | 604 #if ENABLE(OILPAN) |
593 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 605 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
594 { | 606 { |
595 m_loader.willRemoveClient(m_client); | 607 m_loader.willRemoveClient(m_client); |
596 } | 608 } |
597 #endif | 609 #endif |
598 } | 610 } |
OLD | NEW |