Add asserts to MediaStreamPrivate observer routines
https://bugs.webkit.org/show_bug.cgi?id=202724
Reviewed by Alex Christensen.
These methods are only to be called in main thread.
Add asserts to validate this.
No change of behavior.
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::addObserver):
(WebCore::MediaStreamPrivate::removeObserver):
(WebCore::MediaStreamPrivate::forEachObserver const):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 14339e7..074fefb 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2019-10-10 youenn fablet <youenn@apple.com>
+
+ Add asserts to MediaStreamPrivate observer routines
+ https://bugs.webkit.org/show_bug.cgi?id=202724
+
+ Reviewed by Alex Christensen.
+
+ These methods are only to be called in main thread.
+ Add asserts to validate this.
+ No change of behavior.
+
+ * platform/mediastream/MediaStreamPrivate.cpp:
+ (WebCore::MediaStreamPrivate::addObserver):
+ (WebCore::MediaStreamPrivate::removeObserver):
+ (WebCore::MediaStreamPrivate::forEachObserver const):
+
2019-10-09 youenn fablet <youenn@apple.com>
A service worker process should not be created when enqueuing a service worker job
diff --git a/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp b/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
index d58c69d..ccb4606 100644
--- a/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
+++ b/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
@@ -91,16 +91,19 @@
void MediaStreamPrivate::addObserver(MediaStreamPrivate::Observer& observer)
{
+ RELEASE_ASSERT(isMainThread());
m_observers.add(&observer);
}
void MediaStreamPrivate::removeObserver(MediaStreamPrivate::Observer& observer)
{
+ RELEASE_ASSERT(isMainThread());
m_observers.remove(&observer);
}
void MediaStreamPrivate::forEachObserver(const WTF::Function<void(Observer&)>& apply) const
{
+ RELEASE_ASSERT(isMainThread());
for (auto* observer : copyToVector(m_observers)) {
if (!m_observers.contains(observer))
continue;