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

Unified Diff: runtime/vm/thread_android.cc

Issue 474913004: - Account for number of pending tasks in old-space collections. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
Index: runtime/vm/thread_android.cc
===================================================================
--- runtime/vm/thread_android.cc (revision 39381)
+++ runtime/vm/thread_android.cc (working copy)
@@ -11,6 +11,7 @@
#include <sys/time.h> // NOLINT
#include "platform/assert.h"
+#include "vm/isolate.h"
namespace dart {
@@ -192,6 +193,12 @@
result = pthread_mutexattr_destroy(&attr);
VALIDATE_PTHREAD_RESULT(result);
+
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == Isolate::Current());
siva 2014/08/20 17:21:23 How does this assert work? owner_ field has not be
Ivan Posva 2014/08/20 18:35:20 Done. Thanks!
+ owner_ = NULL;
+#endif // defined(DEBUG)
}
@@ -199,6 +206,11 @@
int result = pthread_mutex_destroy(data_.mutex());
// Verify that the pthread_mutex was destroyed.
VALIDATE_PTHREAD_RESULT(result);
+
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == NULL);
+#endif // defined(DEBUG)
}
@@ -207,7 +219,10 @@
// Specifically check for dead lock to help debugging.
ASSERT(result != EDEADLK);
ASSERT(result == 0); // Verify no other errors.
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
}
@@ -218,13 +233,20 @@
return false;
}
ASSERT(result == 0); // Verify no other errors.
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
return true;
}
void Mutex::Unlock() {
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == Isolate::Current());
+ owner_ = NULL;
+#endif // defined(DEBUG)
int result = pthread_mutex_unlock(data_.mutex());
// Specifically check for wrong thread unlocking to aid debugging.
ASSERT(result != EPERM);
« runtime/vm/snapshot.h ('K') | « runtime/vm/thread.h ('k') | runtime/vm/thread_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698