Disable CS_TRACK_OWNER on Mac in debug mode.
Local testing indicates that the pthread_t member variable might be causing alignment problems on the Chromium bots. After landing this (and once the Chromium tree is open again), I'll try a roll again to see if this has an effect.
R=magjed@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/48449004
Cr-Original-Commit-Position: refs/heads/master@{#8644}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 679d2f13522e1cf426f5088549521e591ce2f36c
diff --git a/base/criticalsection.h b/base/criticalsection.h
index 3a1f6a4..c78e818 100644
--- a/base/criticalsection.h
+++ b/base/criticalsection.h
@@ -44,7 +44,13 @@
#endif
#ifdef _DEBUG
+#if defined(WEBRTC_MAC)
+// TODO(tommi): This is related to the comment above. It looks like the
+// pthread_t member might be throwing off the mac debug bots (10.9).
+#define CS_TRACK_OWNER 0
+#else
#define CS_TRACK_OWNER 1
+#endif
#endif // _DEBUG
#if CS_TRACK_OWNER
diff --git a/base/messagequeue.cc b/base/messagequeue.cc
index 74b1024..3706898 100644
--- a/base/messagequeue.cc
+++ b/base/messagequeue.cc
@@ -59,7 +59,9 @@
// MessageQueueManager methods should be non-reentrant, so we
// ASSERT that is the case. If any of these ASSERT, please
// contact bpm or jbeda.
+#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
ASSERT(!crit_.CurrentThreadIsOwner());
+#endif
CritScope cs(&crit_);
message_queues_.push_back(message_queue);
}
@@ -71,7 +73,9 @@
return Instance()->RemoveInternal(message_queue);
}
void MessageQueueManager::RemoveInternal(MessageQueue *message_queue) {
+#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
ASSERT(!crit_.CurrentThreadIsOwner()); // See note above.
+#endif
// If this is the last MessageQueue, destroy the manager as well so that
// we don't leak this object at program shutdown. As mentioned above, this is
// not thread-safe, but this should only happen at program termination (when
@@ -100,7 +104,9 @@
return Instance()->ClearInternal(handler);
}
void MessageQueueManager::ClearInternal(MessageHandler *handler) {
+#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
ASSERT(!crit_.CurrentThreadIsOwner()); // See note above.
+#endif
CritScope cs(&crit_);
std::vector<MessageQueue *>::iterator iter;
for (iter = message_queues_.begin(); iter != message_queues_.end(); iter++)