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

Unified Diff: mojo/edk/system/waiter_unittest.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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: mojo/edk/system/waiter_unittest.cc
diff --git a/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc b/mojo/edk/system/waiter_unittest.cc
similarity index 94%
copy from third_party/mojo/src/mojo/edk/system/waiter_unittest.cc
copy to mojo/edk/system/waiter_unittest.cc
index 8d6e99d66b9992de70fe8859167552a0ac90b95a..71d9d8c5b1e6272e77dd02629f64da8810bc0076 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc
+++ b/mojo/edk/system/waiter_unittest.cc
@@ -7,18 +7,18 @@
// increase tolerance and reduce observed flakiness (though doing so reduces the
// meaningfulness of the test).
-#include "third_party/mojo/src/mojo/edk/system/waiter.h"
+#include "mojo/edk/system/waiter.h"
#include <stdint.h>
+#include "base/synchronization/lock.h"
#include "base/threading/simple_thread.h"
+#include "mojo/edk/system/test_utils.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/edk/system/mutex.h"
-#include "third_party/mojo/src/mojo/edk/system/test_utils.h"
namespace mojo {
-namespace system {
+namespace edk {
namespace {
const unsigned kPollTimeMs = 10;
@@ -41,7 +41,7 @@ class WaitingThread : public base::SimpleThread {
MojoDeadline* elapsed) {
for (;;) {
{
- MutexLocker locker(&mutex_);
+ base::AutoLock locker(lock_);
if (done_) {
*result = result_;
*context = context_;
@@ -68,7 +68,7 @@ class WaitingThread : public base::SimpleThread {
elapsed = stopwatch.Elapsed();
{
- MutexLocker locker(&mutex_);
+ base::AutoLock locker(lock_);
done_ = true;
result_ = result;
context_ = context;
@@ -79,11 +79,11 @@ class WaitingThread : public base::SimpleThread {
const MojoDeadline deadline_;
Waiter waiter_; // Thread-safe.
- Mutex mutex_;
- bool done_ MOJO_GUARDED_BY(mutex_);
- MojoResult result_ MOJO_GUARDED_BY(mutex_);
- uint32_t context_ MOJO_GUARDED_BY(mutex_);
- MojoDeadline elapsed_ MOJO_GUARDED_BY(mutex_);
+ base::Lock lock_; // Protects the following members.
+ bool done_;
+ MojoResult result_;
+ uint32_t context_;
+ MojoDeadline elapsed_;
MOJO_DISALLOW_COPY_AND_ASSIGN(WaitingThread);
};
@@ -294,5 +294,5 @@ TEST(WaiterTest, MultipleAwakes) {
}
} // namespace
-} // namespace system
+} // namespace edk
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698