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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLLinkElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 436d57c0f4af581f7ee64bc84de1336b73e040a9..f33d4f4bf669bdadb5d36f5458c737eda31a4876 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -122,17 +122,23 @@ static const char mediaSourceBlobProtocol[] = "blob";
using namespace HTMLNames;
using namespace std;
-typedef HashMap<Document*, HashSet<HTMLMediaElement*> > DocumentElementSetMap;
+typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement> > WeakMediaElementSet;
+typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet> DocumentElementSetMap;
static DocumentElementSetMap& documentToElementSetMap()
{
+#if ENABLE(OILPAN)
+ DEFINE_STATIC_LOCAL(Persistent<DocumentElementSetMap>, map, (new DocumentElementSetMap()));
+ return *map;
+#else
DEFINE_STATIC_LOCAL(DocumentElementSetMap, map, ());
return map;
+#endif
}
static void addElementToDocumentMap(HTMLMediaElement* element, Document* document)
{
DocumentElementSetMap& map = documentToElementSetMap();
- HashSet<HTMLMediaElement*> set = map.take(document);
+ WeakMediaElementSet set = map.take(document);
set.add(element);
map.add(document, set);
}
@@ -140,7 +146,7 @@ static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
static void removeElementFromDocumentMap(HTMLMediaElement* element, Document* document)
{
DocumentElementSetMap& map = documentToElementSetMap();
- HashSet<HTMLMediaElement*> set = map.take(document);
+ WeakMediaElementSet set = map.take(document);
set.remove(element);
if (!set.isEmpty())
map.add(document, set);
@@ -318,7 +324,9 @@ HTMLMediaElement::~HTMLMediaElement()
closeMediaSource();
+#if !ENABLE(OILPAN)
removeElementFromDocumentMap(this, &document());
+#endif
// Destroying the player may cause a resource load to be canceled,
// which could result in userCancelledLoad() being called back.
@@ -327,6 +335,10 @@ HTMLMediaElement::~HTMLMediaElement()
// See http://crbug.com/233654 for more details.
m_completelyLoaded = true;
+ // With Oilpan load events on the Document are always delayed during
+ // sweeping so we don't need to explicitly increment and decrement
+ // load event delay counts.
+#if !ENABLE(OILPAN)
// Destroying the player may cause a resource load to be canceled,
// which could result in Document::dispatchWindowLoadEvent() being
// called via ResourceFetch::didLoadResource() then
@@ -334,10 +346,13 @@ HTMLMediaElement::~HTMLMediaElement()
// object destruction, we use Document::incrementLoadEventDelayCount().
// See http://crbug.com/275223 for more details.
document().incrementLoadEventDelayCount();
+#endif
clearMediaPlayerAndAudioSourceProviderClient();
+#if !ENABLE(OILPAN)
document().decrementLoadEventDelayCount();
+#endif
}
void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
@@ -3464,8 +3479,8 @@ void HTMLMediaElement::setMediaGroup(const AtomicString& group)
// 4. If there is another media element whose Document is the same as m's Document (even if one or both
// of these elements are not actually in the Document),
- HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&document());
- for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != elements.end(); ++i) {
+ WeakMediaElementSet elements = documentToElementSetMap().get(&document());
+ for (WeakMediaElementSet::iterator i = elements.begin(); i != elements.end(); ++i) {
if (*i == this)
continue;
« no previous file with comments | « Source/core/html/HTMLLinkElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698