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

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 1554903002: EventSender<T> singletons are better off on the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove no-op cancelEvent()s Created 4 years, 11 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) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "platform/Logging.h" 47 #include "platform/Logging.h"
48 #include "platform/RuntimeEnabledFeatures.h" 48 #include "platform/RuntimeEnabledFeatures.h"
49 #include "platform/weborigin/SecurityOrigin.h" 49 #include "platform/weborigin/SecurityOrigin.h"
50 #include "platform/weborigin/SecurityPolicy.h" 50 #include "platform/weborigin/SecurityPolicy.h"
51 #include "public/platform/WebURLRequest.h" 51 #include "public/platform/WebURLRequest.h"
52 52
53 namespace blink { 53 namespace blink {
54 54
55 static ImageEventSender& loadEventSender() 55 static ImageEventSender& loadEventSender()
56 { 56 {
57 DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::load)); 57 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::load)));
58 return sender; 58 return *sender;
59 } 59 }
60 60
61 static ImageEventSender& errorEventSender() 61 static ImageEventSender& errorEventSender()
62 { 62 {
63 DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::error)); 63 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::error)));
64 return sender; 64 return *sender;
65 } 65 }
66 66
67 static inline bool pageIsBeingDismissed(Document* document) 67 static inline bool pageIsBeingDismissed(Document* document)
68 { 68 {
69 return document->pageDismissalEventBeingDispatched() != Document::NoDismissa l; 69 return document->pageDismissalEventBeingDispatched() != Document::NoDismissa l;
70 } 70 }
71 71
72 static ImageLoader::BypassMainWorldBehavior shouldBypassMainWorldCSP(ImageLoader * loader) 72 static ImageLoader::BypassMainWorldBehavior shouldBypassMainWorldCSP(ImageLoader * loader)
73 { 73 {
74 ASSERT(loader); 74 ASSERT(loader);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 #endif 174 #endif
175 175
176 #if ENABLE(OILPAN) 176 #if ENABLE(OILPAN)
177 for (const auto& client : m_clients) 177 for (const auto& client : m_clients)
178 willRemoveClient(*client); 178 willRemoveClient(*client);
179 #endif 179 #endif
180 180
181 if (m_image) 181 if (m_image)
182 m_image->removeClient(this); 182 m_image->removeClient(this);
183 183
184 #if !ENABLE(OILPAN)
184 ASSERT(m_hasPendingLoadEvent || !loadEventSender().hasPendingEvents(this)); 185 ASSERT(m_hasPendingLoadEvent || !loadEventSender().hasPendingEvents(this));
185 if (m_hasPendingLoadEvent) 186 if (m_hasPendingLoadEvent)
186 loadEventSender().cancelEvent(this); 187 loadEventSender().cancelEvent(this);
187 188
188 ASSERT(m_hasPendingErrorEvent || !errorEventSender().hasPendingEvents(this)) ; 189 ASSERT(m_hasPendingErrorEvent || !errorEventSender().hasPendingEvents(this)) ;
189 if (m_hasPendingErrorEvent) 190 if (m_hasPendingErrorEvent)
190 errorEventSender().cancelEvent(this); 191 errorEventSender().cancelEvent(this);
192 #endif
191 } 193 }
192 194
193 #if ENABLE(OILPAN) 195 #if ENABLE(OILPAN)
194 void ImageLoader::clearWeakMembers(Visitor* visitor) 196 void ImageLoader::clearWeakMembers(Visitor* visitor)
195 { 197 {
196 Vector<UntracedMember<ImageLoaderClient>> deadClients; 198 Vector<UntracedMember<ImageLoaderClient>> deadClients;
197 for (const auto& client : m_clients) { 199 for (const auto& client : m_clients) {
198 if (!Heap::isHeapObjectAlive(client)) { 200 if (!Heap::isHeapObjectAlive(client)) {
199 willRemoveClient(*client); 201 willRemoveClient(*client);
200 deadClients.append(client); 202 deadClients.append(client);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 678
677 void ImageLoader::sourceImageChanged() 679 void ImageLoader::sourceImageChanged()
678 { 680 {
679 for (auto& client : m_clients) { 681 for (auto& client : m_clients) {
680 ImageLoaderClient* handle = client; 682 ImageLoaderClient* handle = client;
681 handle->notifyImageSourceChanged(); 683 handle->notifyImageSourceChanged();
682 } 684 }
683 } 685 }
684 686
685 } // namespace blink 687 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.h ('k') | third_party/WebKit/Source/core/svg/SVGStyleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698