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

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

Issue 1710013002: Cleanup HTMLMediaElement to use anonymous namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index efeaceaddd63eecdb4b7d2f1a3ec83db944fcc60..94a7462aa3d18fe965aef3720517b3e66fc8ae9d 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -87,11 +87,32 @@
#include "wtf/text/CString.h"
#include <limits>
+#ifndef LOG_MEDIA_EVENTS
+// Default to not logging events because so many are generated they can overwhelm the rest of
+// the logging.
+#define LOG_MEDIA_EVENTS 0
+#endif
+
+#ifndef LOG_CACHED_TIME_WARNINGS
+// Default to not logging warnings about excessive drift in the cached media time because it adds a
+// fair amount of overhead and logging.
+#define LOG_CACHED_TIME_WARNINGS 0
+#endif
namespace blink {
+using namespace HTMLNames;
+
+using WeakMediaElementSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement>>;
+using DocumentElementSetMap = WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet>;
+
+namespace {
+
+// URL protocol used to signal that the media source API is being used.
+const char mediaSourceBlobProtocol[] = "blob";
+
#if !LOG_DISABLED
-static String urlForLoggingMedia(const KURL& url)
+String urlForLoggingMedia(const KURL& url)
{
static const unsigned maximumURLLengthForLogging = 128;
@@ -100,38 +121,19 @@ static String urlForLoggingMedia(const KURL& url)
return url.string().substring(0, maximumURLLengthForLogging) + "...";
}
-static const char* boolString(bool val)
+const char* boolString(bool val)
{
return val ? "true" : "false";
}
#endif
-#ifndef LOG_MEDIA_EVENTS
-// Default to not logging events because so many are generated they can overwhelm the rest of
-// the logging.
-#define LOG_MEDIA_EVENTS 0
-#endif
-
-#ifndef LOG_CACHED_TIME_WARNINGS
-// Default to not logging warnings about excessive drift in the cached media time because it adds a
-// fair amount of overhead and logging.
-#define LOG_CACHED_TIME_WARNINGS 0
-#endif
-
-// URL protocol used to signal that the media source API is being used.
-static const char mediaSourceBlobProtocol[] = "blob";
-
-using namespace HTMLNames;
-
-typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement>> WeakMediaElementSet;
-typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet> DocumentElementSetMap;
-static DocumentElementSetMap& documentToElementSetMap()
+DocumentElementSetMap& documentToElementSetMap()
{
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<DocumentElementSetMap>, map, (adoptPtrWillBeNoop(new DocumentElementSetMap())));
return *map;
}
-static void addElementToDocumentMap(HTMLMediaElement* element, Document* document)
+void addElementToDocumentMap(HTMLMediaElement* element, Document* document)
{
DocumentElementSetMap& map = documentToElementSetMap();
WeakMediaElementSet set = map.take(document);
@@ -139,7 +141,7 @@ static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
map.add(document, set);
}
-static void removeElementFromDocumentMap(HTMLMediaElement* element, Document* document)
+void removeElementFromDocumentMap(HTMLMediaElement* element, Document* document)
{
DocumentElementSetMap& map = documentToElementSetMap();
WeakMediaElementSet set = map.take(document);
@@ -167,7 +169,7 @@ private:
Member<AudioSourceProviderClient> m_client;
};
-static const AtomicString& AudioKindToString(WebMediaPlayerClient::AudioTrackKind kind)
+const AtomicString& AudioKindToString(WebMediaPlayerClient::AudioTrackKind kind)
{
switch (kind) {
case WebMediaPlayerClient::AudioTrackKindNone:
@@ -190,7 +192,7 @@ static const AtomicString& AudioKindToString(WebMediaPlayerClient::AudioTrackKin
return emptyAtom;
}
-static const AtomicString& VideoKindToString(WebMediaPlayerClient::VideoTrackKind kind)
+const AtomicString& VideoKindToString(WebMediaPlayerClient::VideoTrackKind kind)
{
switch (kind) {
case WebMediaPlayerClient::VideoTrackKindNone:
@@ -213,7 +215,7 @@ static const AtomicString& VideoKindToString(WebMediaPlayerClient::VideoTrackKin
return emptyAtom;
}
-static bool canLoadURL(const KURL& url, const ContentType& contentType, const String& keySystem)
+bool canLoadURL(const KURL& url, const ContentType& contentType, const String& keySystem)
{
DEFINE_STATIC_LOCAL(const String, codecs, ("codecs"));
@@ -241,6 +243,8 @@ static bool canLoadURL(const KURL& url, const ContentType& contentType, const St
return false;
}
+} // anonymous namespace
+
void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric)
{
DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, ("Blink.MediaElement.Autoplay", NumberOfAutoplayMetrics));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698