summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 10:18:11 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 10:18:11 +0000
commite3da5f90272f3064bb6b440989aba38ea29d35a9 (patch)
treef36912359cf290a7d5149312c31fab982fdbaa25
parent671e8513e2e25e20c6189714c3762d6ef3e4a8a8 (diff)
downloadchromium_src-e3da5f90272f3064bb6b440989aba38ea29d35a9.zip
chromium_src-e3da5f90272f3064bb6b440989aba38ea29d35a9.tar.gz
chromium_src-e3da5f90272f3064bb6b440989aba38ea29d35a9.tar.bz2
Mojo: MojoWaitFlags -> MojoHandleSignals.
I still have to rename MOJO_WAIT_... and MojoWaitFlagsState, but I'll do that separately. R=sky@chromium.org Review URL: https://codereview.chromium.org/345463003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278012 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--mojo/android/system/core_impl.cc14
-rw-r--r--mojo/bindings/js/core.cc8
-rw-r--r--mojo/bindings/js/support.cc5
-rw-r--r--mojo/bindings/js/waiting_callback.cc4
-rw-r--r--mojo/bindings/js/waiting_callback.h2
-rw-r--r--mojo/common/handle_watcher.cc22
-rw-r--r--mojo/common/handle_watcher.h2
-rw-r--r--mojo/common/message_pump_mojo.cc14
-rw-r--r--mojo/common/message_pump_mojo.h6
-rw-r--r--mojo/environment/default_async_waiter_impl.cc4
-rw-r--r--mojo/public/c/environment/async_waiter.h2
-rw-r--r--mojo/public/c/system/functions.h26
-rw-r--r--mojo/public/c/system/tests/core_unittest.cc18
-rw-r--r--mojo/public/c/system/tests/core_unittest_pure_c.c6
-rw-r--r--mojo/public/c/system/types.h29
-rw-r--r--mojo/public/cpp/environment/lib/default_async_waiter.cc4
-rw-r--r--mojo/public/cpp/environment/tests/async_waiter_unittest.cc4
-rw-r--r--mojo/public/cpp/system/core.h21
-rw-r--r--mojo/public/cpp/system/tests/core_unittest.cc14
-rw-r--r--mojo/public/cpp/utility/lib/run_loop.cc15
-rw-r--r--mojo/public/cpp/utility/run_loop.h6
-rw-r--r--mojo/public/js/bindings/core.js15
-rw-r--r--mojo/public/js/bindings/support.js2
-rw-r--r--mojo/public/platform/native/system_thunks.cc8
-rw-r--r--mojo/public/platform/native/system_thunks.h4
-rw-r--r--mojo/spy/spy.cc8
-rw-r--r--mojo/system/core.cc14
-rw-r--r--mojo/system/core.h6
-rw-r--r--mojo/system/core_test_base.cc2
-rw-r--r--mojo/system/core_unittest.cc45
-rw-r--r--mojo/system/data_pipe.cc16
-rw-r--r--mojo/system/data_pipe.h4
-rw-r--r--mojo/system/data_pipe_consumer_dispatcher.cc9
-rw-r--r--mojo/system/data_pipe_consumer_dispatcher.h2
-rw-r--r--mojo/system/data_pipe_producer_dispatcher.cc9
-rw-r--r--mojo/system/data_pipe_producer_dispatcher.h2
-rw-r--r--mojo/system/dispatcher.cc6
-rw-r--r--mojo/system/dispatcher.h14
-rw-r--r--mojo/system/entrypoints.cc8
-rw-r--r--mojo/system/local_data_pipe.cc10
-rw-r--r--mojo/system/local_message_pipe_endpoint.cc16
-rw-r--r--mojo/system/local_message_pipe_endpoint.h2
-rw-r--r--mojo/system/message_pipe.cc4
-rw-r--r--mojo/system/message_pipe.h2
-rw-r--r--mojo/system/message_pipe_dispatcher.cc4
-rw-r--r--mojo/system/message_pipe_dispatcher.h2
-rw-r--r--mojo/system/message_pipe_endpoint.cc2
-rw-r--r--mojo/system/message_pipe_endpoint.h2
-rw-r--r--mojo/system/multiprocess_message_pipe_unittest.cc5
-rw-r--r--mojo/system/simple_dispatcher.cc8
-rw-r--r--mojo/system/simple_dispatcher.h2
-rw-r--r--mojo/system/simple_dispatcher_unittest.cc76
-rw-r--r--mojo/system/wait_flags_state.h22
-rw-r--r--mojo/system/waiter_list.cc8
-rw-r--r--mojo/system/waiter_list.h8
-rw-r--r--mojo/system/waiter_test_utils.cc6
-rw-r--r--mojo/system/waiter_test_utils.h4
57 files changed, 298 insertions, 285 deletions
diff --git a/mojo/android/system/core_impl.cc b/mojo/android/system/core_impl.cc
index 366573c..e7899f6 100644
--- a/mojo/android/system/core_impl.cc
+++ b/mojo/android/system/core_impl.cc
@@ -70,9 +70,9 @@ static jint WaitMany(JNIEnv* env,
const size_t nb_handles = buffer_size / record_size;
const MojoHandle* handle_start = static_cast<const MojoHandle*>(buffer_start);
- const MojoWaitFlags* flags_start =
- static_cast<const MojoWaitFlags*>(handle_start + nb_handles);
- return MojoWaitMany(handle_start, flags_start, nb_handles, deadline);
+ const MojoHandleSignals* signals_start =
+ static_cast<const MojoHandleSignals*>(handle_start + nb_handles);
+ return MojoWaitMany(handle_start, signals_start, nb_handles, deadline);
}
static jobject CreateMessagePipe(JNIEnv* env, jobject jcaller) {
@@ -129,9 +129,9 @@ static jint Close(JNIEnv* env, jobject jcaller, jint mojo_handle) {
static jint Wait(JNIEnv* env,
jobject jcaller,
jint mojo_handle,
- jint flags,
+ jint signals,
jlong deadline) {
- return MojoWait(mojo_handle, flags, deadline);
+ return MojoWait(mojo_handle, signals, deadline);
}
static jint WriteMessage(JNIEnv* env,
@@ -322,7 +322,7 @@ static int Unmap(JNIEnv* env, jobject jcaller, jobject buffer) {
static jobject AsyncWait(JNIEnv* env,
jobject jcaller,
jint mojo_handle,
- jint flags,
+ jint signals,
jlong deadline,
jobject callback) {
AsyncWaitCallbackData* callback_data =
@@ -330,7 +330,7 @@ static jobject AsyncWait(JNIEnv* env,
MojoAsyncWaitID cancel_id;
if (static_cast<MojoHandle>(mojo_handle) != MOJO_HANDLE_INVALID) {
cancel_id = mojo::GetDefaultAsyncWaiter()->AsyncWait(mojo_handle,
- flags,
+ signals,
deadline,
AsyncWaitCallback,
callback_data);
diff --git a/mojo/bindings/js/core.cc b/mojo/bindings/js/core.cc
index 0d75ce5..104a49b 100644
--- a/mojo/bindings/js/core.cc
+++ b/mojo/bindings/js/core.cc
@@ -31,16 +31,16 @@ MojoResult CloseHandle(gin::Handle<gin::HandleWrapper> handle) {
}
MojoResult WaitHandle(mojo::Handle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline) {
- return MojoWait(handle.value(), flags, deadline);
+ return MojoWait(handle.value(), signals, deadline);
}
MojoResult WaitMany(
const std::vector<mojo::Handle>& handles,
- const std::vector<MojoWaitFlags>& flags,
+ const std::vector<MojoHandleSignals>& signals,
MojoDeadline deadline) {
- return mojo::WaitMany(handles, flags, deadline);
+ return mojo::WaitMany(handles, signals, deadline);
}
gin::Dictionary CreateMessagePipe(const gin::Arguments& args) {
diff --git a/mojo/bindings/js/support.cc b/mojo/bindings/js/support.cc
index ac6cb34..2235509 100644
--- a/mojo/bindings/js/support.cc
+++ b/mojo/bindings/js/support.cc
@@ -23,9 +23,10 @@ namespace js {
namespace {
WaitingCallback* AsyncWait(const gin::Arguments& args, mojo::Handle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
v8::Handle<v8::Function> callback) {
- return WaitingCallback::Create(args.isolate(), callback, handle, flags).get();
+ return WaitingCallback::Create(args.isolate(), callback, handle, signals)
+ .get();
}
void CancelWait(WaitingCallback* waiting_callback) {
diff --git a/mojo/bindings/js/waiting_callback.cc b/mojo/bindings/js/waiting_callback.cc
index 597da44..fdcf6e3 100644
--- a/mojo/bindings/js/waiting_callback.cc
+++ b/mojo/bindings/js/waiting_callback.cc
@@ -25,12 +25,12 @@ gin::Handle<WaitingCallback> WaitingCallback::Create(
v8::Isolate* isolate,
v8::Handle<v8::Function> callback,
mojo::Handle handle,
- MojoWaitFlags flags) {
+ MojoHandleSignals signals) {
gin::Handle<WaitingCallback> waiting_callback =
gin::CreateHandle(isolate, new WaitingCallback(isolate, callback));
waiting_callback->wait_id_ = GetDefaultAsyncWaiter()->AsyncWait(
handle.value(),
- flags,
+ signals,
MOJO_DEADLINE_INDEFINITE,
&WaitingCallback::CallOnHandleReady,
waiting_callback.get());
diff --git a/mojo/bindings/js/waiting_callback.h b/mojo/bindings/js/waiting_callback.h
index 2bc1589..973a500 100644
--- a/mojo/bindings/js/waiting_callback.h
+++ b/mojo/bindings/js/waiting_callback.h
@@ -23,7 +23,7 @@ class WaitingCallback : public gin::Wrappable<WaitingCallback> {
v8::Isolate* isolate,
v8::Handle<v8::Function> callback,
mojo::Handle handle,
- MojoWaitFlags flags);
+ MojoHandleSignals signals);
// Cancels the callback. Does nothing if a callback is not pending. This is
// implicitly invoked from the destructor but can be explicitly invoked as
diff --git a/mojo/common/handle_watcher.cc b/mojo/common/handle_watcher.cc
index 4ae86db..a01c220a 100644
--- a/mojo/common/handle_watcher.cc
+++ b/mojo/common/handle_watcher.cc
@@ -46,12 +46,12 @@ base::TimeTicks MojoDeadlineToTimeTicks(MojoDeadline deadline) {
struct WatchData {
WatchData()
: id(0),
- wait_flags(MOJO_WAIT_FLAG_NONE),
+ handle_signals(MOJO_WAIT_FLAG_NONE),
message_loop(NULL) {}
WatcherID id;
Handle handle;
- MojoWaitFlags wait_flags;
+ MojoHandleSignals handle_signals;
base::TimeTicks deadline;
base::Callback<void(MojoResult)> callback;
scoped_refptr<base::MessageLoopProxy> message_loop;
@@ -103,7 +103,7 @@ void WatcherBackend::StartWatching(const WatchData& data) {
handle_to_data_[data.handle] = data;
message_pump_mojo->AddHandler(this, data.handle,
- data.wait_flags,
+ data.handle_signals,
data.deadline);
}
@@ -165,7 +165,7 @@ class WatcherThreadManager {
// on the thread StartWatching() was invoked on.
// This may be invoked on any thread.
WatcherID StartWatching(const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
base::TimeTicks deadline,
const base::Callback<void(MojoResult)>& callback);
@@ -196,14 +196,14 @@ WatcherThreadManager* WatcherThreadManager::GetInstance() {
WatcherID WatcherThreadManager::StartWatching(
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
base::TimeTicks deadline,
const base::Callback<void(MojoResult)>& callback) {
WatchData data;
data.id = watcher_id_generator_.GetNext();
data.handle = handle;
data.callback = callback;
- data.wait_flags = wait_flags;
+ data.handle_signals = handle_signals;
data.deadline = deadline;
data.message_loop = base::MessageLoopProxy::current();
DCHECK_NE(static_cast<base::MessageLoopProxy*>(NULL),
@@ -244,7 +244,7 @@ class HandleWatcher::State : public base::MessageLoop::DestructionObserver {
public:
State(HandleWatcher* watcher,
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline,
const base::Callback<void(MojoResult)>& callback)
: watcher_(watcher),
@@ -254,7 +254,7 @@ class HandleWatcher::State : public base::MessageLoop::DestructionObserver {
watcher_id_ = WatcherThreadManager::GetInstance()->StartWatching(
handle,
- wait_flags,
+ handle_signals,
MojoDeadlineToTimeTicks(deadline),
base::Bind(&State::OnHandleReady, weak_factory_.GetWeakPtr()));
}
@@ -295,13 +295,13 @@ HandleWatcher::~HandleWatcher() {
}
void HandleWatcher::Start(const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline,
const base::Callback<void(MojoResult)>& callback) {
DCHECK(handle.is_valid());
- DCHECK_NE(MOJO_WAIT_FLAG_NONE, wait_flags);
+ DCHECK_NE(MOJO_WAIT_FLAG_NONE, handle_signals);
- state_.reset(new State(this, handle, wait_flags, deadline, callback));
+ state_.reset(new State(this, handle, handle_signals, deadline, callback));
}
void HandleWatcher::Stop() {
diff --git a/mojo/common/handle_watcher.h b/mojo/common/handle_watcher.h
index 0660abb..9fac3f5 100644
--- a/mojo/common/handle_watcher.h
+++ b/mojo/common/handle_watcher.h
@@ -37,7 +37,7 @@ class MOJO_COMMON_EXPORT HandleWatcher {
// before the handle is ready, then |callback| is invoked with a result of
// MOJO_RESULT_ABORTED.
void Start(const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline,
const base::Callback<void(MojoResult)>& callback);
diff --git a/mojo/common/message_pump_mojo.cc b/mojo/common/message_pump_mojo.cc
index 9eee1a0..751d5c0 100644
--- a/mojo/common/message_pump_mojo.cc
+++ b/mojo/common/message_pump_mojo.cc
@@ -20,7 +20,7 @@ namespace common {
// corresponds to that of the control pipe.
struct MessagePumpMojo::WaitState {
std::vector<Handle> handles;
- std::vector<MojoWaitFlags> wait_flags;
+ std::vector<MojoHandleSignals> wait_signals;
};
struct MessagePumpMojo::RunState {
@@ -50,7 +50,7 @@ scoped_ptr<base::MessagePump> MessagePumpMojo::Create() {
void MessagePumpMojo::AddHandler(MessagePumpMojoHandler* handler,
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals wait_signals,
base::TimeTicks deadline) {
DCHECK(handler);
DCHECK(handle.is_valid());
@@ -58,7 +58,7 @@ void MessagePumpMojo::AddHandler(MessagePumpMojoHandler* handler,
DCHECK_EQ(0u, handlers_.count(handle));
Handler handler_data;
handler_data.handler = handler;
- handler_data.wait_flags = wait_flags;
+ handler_data.wait_signals = wait_signals;
handler_data.deadline = deadline;
handler_data.id = next_handler_id_++;
handlers_[handle] = handler_data;
@@ -142,7 +142,7 @@ void MessagePumpMojo::DoInternalWork(const RunState& run_state, bool block) {
const MojoDeadline deadline = block ? GetDeadlineForWait(run_state) : 0;
const WaitState wait_state = GetWaitState(run_state);
const MojoResult result =
- WaitMany(wait_state.handles, wait_state.wait_flags, deadline);
+ WaitMany(wait_state.handles, wait_state.wait_signals, deadline);
if (result == 0) {
// Control pipe was written to.
uint32_t num_bytes = 0;
@@ -189,7 +189,7 @@ void MessagePumpMojo::RemoveFirstInvalidHandle(const WaitState& wait_state) {
// TODO(sky): deal with control pipe going bad.
for (size_t i = 1; i < wait_state.handles.size(); ++i) {
const MojoResult result =
- Wait(wait_state.handles[i], wait_state.wait_flags[i], 0);
+ Wait(wait_state.handles[i], wait_state.wait_signals[i], 0);
if (result == MOJO_RESULT_INVALID_ARGUMENT ||
result == MOJO_RESULT_FAILED_PRECONDITION ||
result == MOJO_RESULT_CANCELLED) {
@@ -215,12 +215,12 @@ MessagePumpMojo::WaitState MessagePumpMojo::GetWaitState(
const RunState& run_state) const {
WaitState wait_state;
wait_state.handles.push_back(run_state.read_handle.get());
- wait_state.wait_flags.push_back(MOJO_WAIT_FLAG_READABLE);
+ wait_state.wait_signals.push_back(MOJO_WAIT_FLAG_READABLE);
for (HandleToHandler::const_iterator i = handlers_.begin();
i != handlers_.end(); ++i) {
wait_state.handles.push_back(i->first);
- wait_state.wait_flags.push_back(i->second.wait_flags);
+ wait_state.wait_signals.push_back(i->second.wait_signals);
}
return wait_state;
}
diff --git a/mojo/common/message_pump_mojo.h b/mojo/common/message_pump_mojo.h
index c761106..49d3e9e 100644
--- a/mojo/common/message_pump_mojo.h
+++ b/mojo/common/message_pump_mojo.h
@@ -33,7 +33,7 @@ class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
// handler can be registered for a specified handle.
void AddHandler(MessagePumpMojoHandler* handler,
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals wait_signals,
base::TimeTicks deadline);
void RemoveHandler(const Handle& handle);
@@ -51,10 +51,10 @@ class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
// Contains the data needed to track a request to AddHandler().
struct Handler {
- Handler() : handler(NULL), wait_flags(MOJO_WAIT_FLAG_NONE), id(0) {}
+ Handler() : handler(NULL), wait_signals(MOJO_WAIT_FLAG_NONE), id(0) {}
MessagePumpMojoHandler* handler;
- MojoWaitFlags wait_flags;
+ MojoHandleSignals wait_signals;
base::TimeTicks deadline;
// See description of |MessagePumpMojo::next_handler_id_| for details.
int id;
diff --git a/mojo/environment/default_async_waiter_impl.cc b/mojo/environment/default_async_waiter_impl.cc
index 5279aad..ff7a5247 100644
--- a/mojo/environment/default_async_waiter_impl.cc
+++ b/mojo/environment/default_async_waiter_impl.cc
@@ -20,13 +20,13 @@ void OnHandleReady(common::HandleWatcher* watcher,
}
MojoAsyncWaitID AsyncWait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline,
MojoAsyncWaitCallback callback,
void* closure) {
// This instance will be deleted when done or cancelled.
common::HandleWatcher* watcher = new common::HandleWatcher();
- watcher->Start(Handle(handle), flags, deadline,
+ watcher->Start(Handle(handle), signals, deadline,
base::Bind(&OnHandleReady, watcher, callback, closure));
return reinterpret_cast<MojoAsyncWaitID>(watcher);
}
diff --git a/mojo/public/c/environment/async_waiter.h b/mojo/public/c/environment/async_waiter.h
index a330b64..1eb0631 100644
--- a/mojo/public/c/environment/async_waiter.h
+++ b/mojo/public/c/environment/async_waiter.h
@@ -17,7 +17,7 @@ struct MojoAsyncWaiter {
// Returns a non-zero MojoAsyncWaitID that can be used with CancelWait to
// stop waiting. This identifier becomes invalid once the callback runs.
MojoAsyncWaitID (*AsyncWait)(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline,
MojoAsyncWaitCallback callback,
void* closure);
diff --git a/mojo/public/c/system/functions.h b/mojo/public/c/system/functions.h
index 71449ec..9d2ef6c 100644
--- a/mojo/public/c/system/functions.h
+++ b/mojo/public/c/system/functions.h
@@ -42,41 +42,41 @@ MOJO_SYSTEM_EXPORT MojoTimeTicks MojoGetTimeTicksNow(void);
// fail with |MOJO_RESULT_INVALID_ARGUMENT| if they happen after.
MOJO_SYSTEM_EXPORT MojoResult MojoClose(MojoHandle handle);
-// Waits on the given handle until the state indicated by |flags| is satisfied
+// Waits on the given handle until a signal indicated by |signals| is satisfied
// or until |deadline| has passed.
//
// Returns:
-// |MOJO_RESULT_OK| if some flag in |flags| was satisfied (or is already
+// |MOJO_RESULT_OK| if some signal in |signals| was satisfied (or is already
// satisfied).
// |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle (e.g., if
// it has already been closed).
// |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of
-// the flags being satisfied.
+// the signals being satisfied.
// |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that any
-// flag in |flags| will ever be satisfied.
+// signal in |signals| will ever be satisfied.
//
// If there are multiple waiters (on different threads, obviously) waiting on
-// the same handle and flag and that flag becomes set, all waiters will be
-// awoken.
+// the same handle and signal, and that signal becomes is satisfied, all waiters
+// will be awoken.
MOJO_SYSTEM_EXPORT MojoResult MojoWait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline);
// Waits on |handles[0]|, ..., |handles[num_handles-1]| for at least one of them
-// to satisfy the state indicated by |flags[0]|, ..., |flags[num_handles-1]|,
+// to satisfy a signal indicated by |signals[0]|, ..., |signals[num_handles-1]|,
// respectively, or until |deadline| has passed.
//
// Returns:
-// The index |i| (from 0 to |num_handles-1|) if |handle[i]| satisfies
-// |flags[i]|.
+// The index |i| (from 0 to |num_handles-1|) if |handle[i]| satisfies a signal
+// from |signals[i]|.
// |MOJO_RESULT_INVALID_ARGUMENT| if some |handle[i]| is not a valid handle
// (e.g., if it has already been closed).
// |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of
-// handles satisfying any of its flags.
+// handles satisfying any of its signals.
// |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that SOME
-// |handle[i]| will ever satisfy any of its flags |flags[i]|.
+// |handle[i]| will ever satisfy any of the signals in |signals[i]|.
MOJO_SYSTEM_EXPORT MojoResult MojoWaitMany(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline);
diff --git a/mojo/public/c/system/tests/core_unittest.cc b/mojo/public/c/system/tests/core_unittest.cc
index 7610aaa..ec366a0 100644
--- a/mojo/public/c/system/tests/core_unittest.cc
+++ b/mojo/public/c/system/tests/core_unittest.cc
@@ -23,7 +23,7 @@ TEST(CoreTest, GetTimeTicksNow) {
// Tests that everything that takes a handle properly recognizes it.
TEST(CoreTest, InvalidHandle) {
MojoHandle h0, h1;
- MojoWaitFlags wf;
+ MojoHandleSignals sig;
char buffer[10] = { 0 };
uint32_t buffer_size;
void* write_pointer;
@@ -36,9 +36,9 @@ TEST(CoreTest, InvalidHandle) {
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
MojoWait(MOJO_HANDLE_INVALID, MOJO_WAIT_FLAG_EVERYTHING, 1000000));
h0 = MOJO_HANDLE_INVALID;
- wf = MOJO_WAIT_FLAG_EVERYTHING;
+ sig = MOJO_WAIT_FLAG_EVERYTHING;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoWaitMany(&h0, &wf, 1, MOJO_DEADLINE_INDEFINITE));
+ MojoWaitMany(&h0, &sig, 1, MOJO_DEADLINE_INDEFINITE));
// Message pipe:
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
@@ -77,7 +77,7 @@ TEST(CoreTest, InvalidHandle) {
TEST(CoreTest, BasicMessagePipe) {
MojoHandle h0, h1;
- MojoWaitFlags wf;
+ MojoHandleSignals sig;
char buffer[10] = { 0 };
uint32_t buffer_size;
@@ -108,9 +108,9 @@ TEST(CoreTest, BasicMessagePipe) {
MOJO_WRITE_MESSAGE_FLAG_NONE));
// |h0| should be readable.
- wf = MOJO_WAIT_FLAG_READABLE;
+ sig = MOJO_WAIT_FLAG_READABLE;
EXPECT_EQ(MOJO_RESULT_OK,
- MojoWaitMany(&h0, &wf, 1, MOJO_DEADLINE_INDEFINITE));
+ MojoWaitMany(&h0, &sig, 1, MOJO_DEADLINE_INDEFINITE));
// Read from |h0|.
buffer_size = static_cast<uint32_t>(sizeof(buffer));
@@ -137,7 +137,7 @@ TEST(CoreTest, BasicMessagePipe) {
TEST(CoreTest, BasicDataPipe) {
MojoHandle hp, hc;
- MojoWaitFlags wf;
+ MojoHandleSignals sig;
char buffer[20] = { 0 };
uint32_t buffer_size;
void* write_pointer;
@@ -176,9 +176,9 @@ TEST(CoreTest, BasicDataPipe) {
MOJO_WRITE_MESSAGE_FLAG_NONE));
// |hc| should be(come) readable.
- wf = MOJO_WAIT_FLAG_READABLE;
+ sig = MOJO_WAIT_FLAG_READABLE;
EXPECT_EQ(MOJO_RESULT_OK,
- MojoWaitMany(&hc, &wf, 1, MOJO_DEADLINE_INDEFINITE));
+ MojoWaitMany(&hc, &sig, 1, MOJO_DEADLINE_INDEFINITE));
// Do a two-phase write to |hp|.
EXPECT_EQ(MOJO_RESULT_OK,
diff --git a/mojo/public/c/system/tests/core_unittest_pure_c.c b/mojo/public/c/system/tests/core_unittest_pure_c.c
index 3766431..cbe2cbe 100644
--- a/mojo/public/c/system/tests/core_unittest_pure_c.c
+++ b/mojo/public/c/system/tests/core_unittest_pure_c.c
@@ -42,7 +42,7 @@ const char* MinimalCTest(void) {
// at the top. (MSVS 2013 is more reasonable.)
MojoTimeTicks ticks;
MojoHandle handle0, handle1;
- MojoWaitFlags wait_flags;
+ MojoHandleSignals signals;
const char kHello[] = "hello";
char buffer[200] = { 0 };
uint32_t num_bytes;
@@ -60,9 +60,9 @@ const char* MinimalCTest(void) {
handle1 = MOJO_HANDLE_INVALID;
EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &handle0, &handle1));
- wait_flags = MOJO_WAIT_FLAG_READABLE;
+ signals = MOJO_WAIT_FLAG_READABLE;
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- MojoWaitMany(&handle0, &wait_flags, 1, 1));
+ MojoWaitMany(&handle0, &signals, 1, 1));
EXPECT_EQ(MOJO_RESULT_OK,
MojoWriteMessage(handle0, kHello, (uint32_t) sizeof(kHello), NULL,
diff --git a/mojo/public/c/system/types.h b/mojo/public/c/system/types.h
index 655e302..0e97db9 100644
--- a/mojo/public/c/system/types.h
+++ b/mojo/public/c/system/types.h
@@ -142,35 +142,38 @@ const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1);
#define MOJO_DEADLINE_INDEFINITE ((MojoDeadline) -1)
#endif
-// |MojoWaitFlags|: Used to specify the state of a handle to wait on (e.g., the
-// ability to read or write to it).
+// |MojoHandleSignals|: Used to specify signals that can be waited on for a
+// handle (and which can be triggered), e.g., the ability to read or write to
+// the handle.
// |MOJO_WAIT_FLAG_NONE| - No flags. |MojoWait()|, etc. will return
// |MOJO_RESULT_FAILED_PRECONDITION| if you attempt to wait on this.
// |MOJO_WAIT_FLAG_READABLE| - Can read (e.g., a message) from the handle.
// |MOJO_WAIT_FLAG_WRITABLE| - Can write (e.g., a message) to the handle.
// |MOJO_WAIT_FLAG_EVERYTHING| - All flags.
-typedef uint32_t MojoWaitFlags;
+typedef uint32_t MojoHandleSignals;
+// TODO(vtl): Rename these to MOJO_HANDLE_SIGNAL_....
#ifdef __cplusplus
-const MojoWaitFlags MOJO_WAIT_FLAG_NONE = 0;
-const MojoWaitFlags MOJO_WAIT_FLAG_READABLE = 1 << 0;
-const MojoWaitFlags MOJO_WAIT_FLAG_WRITABLE = 1 << 1;
-const MojoWaitFlags MOJO_WAIT_FLAG_EVERYTHING = ~0;
+const MojoHandleSignals MOJO_WAIT_FLAG_NONE = 0;
+const MojoHandleSignals MOJO_WAIT_FLAG_READABLE = 1 << 0;
+const MojoHandleSignals MOJO_WAIT_FLAG_WRITABLE = 1 << 1;
+const MojoHandleSignals MOJO_WAIT_FLAG_EVERYTHING = ~0;
#else
-#define MOJO_WAIT_FLAG_NONE ((MojoWaitFlags) 0)
-#define MOJO_WAIT_FLAG_READABLE ((MojoWaitFlags) 1 << 0)
-#define MOJO_WAIT_FLAG_WRITABLE ((MojoWaitFlags) 1 << 1)
-#define MOJO_WAIT_FLAG_EVERYTHING (~((MojoWaitFlags) 0))
+#define MOJO_WAIT_FLAG_NONE ((MojoHandleSignals) 0)
+#define MOJO_WAIT_FLAG_READABLE ((MojoHandleSignals) 1 << 0)
+#define MOJO_WAIT_FLAG_WRITABLE ((MojoHandleSignals) 1 << 1)
+#define MOJO_WAIT_FLAG_EVERYTHING (~((MojoHandleSignals) 0))
#endif
// TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany.
// Note: This struct is not extensible (and only has 32-bit quantities), so it's
// 32-bit-aligned.
+// TODO(vtl): Rename this to MojoHandleSignalsState.
MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int32_t) == 4, int32_t_has_weird_alignment);
struct MOJO_ALIGNAS(4) MojoWaitFlagsState {
- MojoWaitFlags satisfied_flags;
- MojoWaitFlags satisfiable_flags;
+ MojoHandleSignals satisfied_signals;
+ MojoHandleSignals satisfiable_signals;
};
MOJO_COMPILE_ASSERT(sizeof(MojoWaitFlagsState) == 8,
MojoWaitFlagsState_has_wrong_size);
diff --git a/mojo/public/cpp/environment/lib/default_async_waiter.cc b/mojo/public/cpp/environment/lib/default_async_waiter.cc
index 4dcbe47..ae89a86 100644
--- a/mojo/public/cpp/environment/lib/default_async_waiter.cc
+++ b/mojo/public/cpp/environment/lib/default_async_waiter.cc
@@ -59,7 +59,7 @@ class RunLoopHandlerImpl : public RunLoopHandler {
};
MojoAsyncWaitID AsyncWait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline,
MojoAsyncWaitCallback callback,
void* closure) {
@@ -70,7 +70,7 @@ MojoAsyncWaitID AsyncWait(MojoHandle handle,
// CancelWait is invoked.
RunLoopHandlerImpl* run_loop_handler =
new RunLoopHandlerImpl(Handle(handle), callback, closure);
- run_loop->AddHandler(run_loop_handler, Handle(handle), flags, deadline);
+ run_loop->AddHandler(run_loop_handler, Handle(handle), signals, deadline);
return reinterpret_cast<MojoAsyncWaitID>(run_loop_handler);
}
diff --git a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc b/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
index 7943a5d..a71f769 100644
--- a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
+++ b/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
@@ -40,11 +40,11 @@ class TestAsyncWaitCallback {
};
MojoAsyncWaitID CallAsyncWait(const Handle& handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
TestAsyncWaitCallback* callback) {
return GetDefaultAsyncWaiter()->AsyncWait(
handle.value(),
- flags,
+ signals,
MOJO_DEADLINE_INDEFINITE,
&TestAsyncWaitCallback::OnHandleReady,
callback);
diff --git a/mojo/public/cpp/system/core.h b/mojo/public/cpp/system/core.h
index 2b1caa9..60bcca9 100644
--- a/mojo/public/cpp/system/core.h
+++ b/mojo/public/cpp/system/core.h
@@ -199,21 +199,21 @@ MOJO_COMPILE_ASSERT(sizeof(ScopedHandle) == sizeof(Handle),
bad_size_for_cpp_ScopedHandle);
inline MojoResult Wait(const Handle& handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline) {
- return MojoWait(handle.value(), flags, deadline);
+ return MojoWait(handle.value(), signals, deadline);
}
// |HandleVectorType| and |FlagsVectorType| should be similar enough to
-// |std::vector<Handle>| and |std::vector<MojoWaitFlags>|, respectively:
+// |std::vector<Handle>| and |std::vector<MojoHandleSignals>|, respectively:
// - They should have a (const) |size()| method that returns an unsigned type.
// - They must provide contiguous storage, with access via (const) reference to
// that storage provided by a (const) |operator[]()| (by reference).
template <class HandleVectorType, class FlagsVectorType>
inline MojoResult WaitMany(const HandleVectorType& handles,
- const FlagsVectorType& flags,
+ const FlagsVectorType& signals,
MojoDeadline deadline) {
- if (flags.size() != handles.size())
+ if (signals.size() != handles.size())
return MOJO_RESULT_INVALID_ARGUMENT;
if (handles.size() > std::numeric_limits<uint32_t>::max())
return MOJO_RESULT_OUT_OF_RANGE;
@@ -222,11 +222,12 @@ inline MojoResult WaitMany(const HandleVectorType& handles,
return MojoWaitMany(NULL, NULL, 0, deadline);
const Handle& first_handle = handles[0];
- const MojoWaitFlags& first_flag = flags[0];
- return MojoWaitMany(reinterpret_cast<const MojoHandle*>(&first_handle),
- reinterpret_cast<const MojoWaitFlags*>(&first_flag),
- static_cast<uint32_t>(handles.size()),
- deadline);
+ const MojoHandleSignals& first_signals = signals[0];
+ return MojoWaitMany(
+ reinterpret_cast<const MojoHandle*>(&first_handle),
+ reinterpret_cast<const MojoHandleSignals*>(&first_signals),
+ static_cast<uint32_t>(handles.size()),
+ deadline);
}
// |Close()| takes ownership of the handle, since it'll invalidate it.
diff --git a/mojo/public/cpp/system/tests/core_unittest.cc b/mojo/public/cpp/system/tests/core_unittest.cc
index acaee23..9cb9307 100644
--- a/mojo/public/cpp/system/tests/core_unittest.cc
+++ b/mojo/public/cpp/system/tests/core_unittest.cc
@@ -103,10 +103,10 @@ TEST(CoreCppTest, Basic) {
std::vector<Handle> wh;
wh.push_back(h.get());
- std::vector<MojoWaitFlags> wf;
- wf.push_back(MOJO_WAIT_FLAG_EVERYTHING);
+ std::vector<MojoHandleSignals> sigs;
+ sigs.push_back(MOJO_WAIT_FLAG_EVERYTHING);
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- WaitMany(wh, wf, MOJO_DEADLINE_INDEFINITE));
+ WaitMany(wh, sigs, MOJO_DEADLINE_INDEFINITE));
}
// |MakeScopedHandle| (just compilation tests):
@@ -167,10 +167,10 @@ TEST(CoreCppTest, Basic) {
std::vector<Handle> wh;
wh.push_back(h0.get());
wh.push_back(h1.get());
- std::vector<MojoWaitFlags> wf;
- wf.push_back(MOJO_WAIT_FLAG_READABLE);
- wf.push_back(MOJO_WAIT_FLAG_WRITABLE);
- EXPECT_EQ(1, WaitMany(wh, wf, 1000));
+ std::vector<MojoHandleSignals> sigs;
+ sigs.push_back(MOJO_WAIT_FLAG_READABLE);
+ sigs.push_back(MOJO_WAIT_FLAG_WRITABLE);
+ EXPECT_EQ(1, WaitMany(wh, sigs, 1000));
// Test closing |h1| explicitly.
Close(h1.Pass());
diff --git a/mojo/public/cpp/utility/lib/run_loop.cc b/mojo/public/cpp/utility/lib/run_loop.cc
index 5bf30d5..f523eae 100644
--- a/mojo/public/cpp/utility/lib/run_loop.cc
+++ b/mojo/public/cpp/utility/lib/run_loop.cc
@@ -26,7 +26,7 @@ struct RunLoop::WaitState {
WaitState() : deadline(MOJO_DEADLINE_INDEFINITE) {}
std::vector<Handle> handles;
- std::vector<MojoWaitFlags> wait_flags;
+ std::vector<MojoHandleSignals> handle_signals;
MojoDeadline deadline;
};
@@ -64,7 +64,7 @@ RunLoop* RunLoop::current() {
void RunLoop::AddHandler(RunLoopHandler* handler,
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline) {
assert(current() == this);
assert(handler);
@@ -73,7 +73,7 @@ void RunLoop::AddHandler(RunLoopHandler* handler,
assert(0u == handler_data_.count(handle));
HandlerData handler_data;
handler_data.handler = handler;
- handler_data.wait_flags = wait_flags;
+ handler_data.handle_signals = handle_signals;
handler_data.deadline = (deadline == MOJO_DEADLINE_INDEFINITE) ?
kInvalidTimeTicks :
GetTimeTicksNow() + static_cast<MojoTimeTicks>(deadline);
@@ -125,8 +125,9 @@ bool RunLoop::Wait(bool non_blocking) {
return false;
}
- const MojoResult result =
- WaitMany(wait_state.handles, wait_state.wait_flags, wait_state.deadline);
+ const MojoResult result = WaitMany(wait_state.handles,
+ wait_state.handle_signals,
+ wait_state.deadline);
if (result >= 0) {
const size_t index = static_cast<size_t>(result);
assert(handler_data_.find(wait_state.handles[index]) !=
@@ -175,7 +176,7 @@ bool RunLoop::NotifyDeadlineExceeded() {
bool RunLoop::RemoveFirstInvalidHandle(const WaitState& wait_state) {
for (size_t i = 0; i < wait_state.handles.size(); ++i) {
const MojoResult result =
- mojo::Wait(wait_state.handles[i], wait_state.wait_flags[i],
+ mojo::Wait(wait_state.handles[i], wait_state.handle_signals[i],
static_cast<MojoDeadline>(0));
if (result == MOJO_RESULT_INVALID_ARGUMENT ||
result == MOJO_RESULT_FAILED_PRECONDITION) {
@@ -199,7 +200,7 @@ RunLoop::WaitState RunLoop::GetWaitState(bool non_blocking) const {
for (HandleToHandlerData::const_iterator i = handler_data_.begin();
i != handler_data_.end(); ++i) {
wait_state.handles.push_back(i->first);
- wait_state.wait_flags.push_back(i->second.wait_flags);
+ wait_state.handle_signals.push_back(i->second.handle_signals);
if (!non_blocking && i->second.deadline != kInvalidTimeTicks &&
(min_time == kInvalidTimeTicks || i->second.deadline < min_time)) {
min_time = i->second.deadline;
diff --git a/mojo/public/cpp/utility/run_loop.h b/mojo/public/cpp/utility/run_loop.h
index 288a68e..4febc97 100644
--- a/mojo/public/cpp/utility/run_loop.h
+++ b/mojo/public/cpp/utility/run_loop.h
@@ -33,7 +33,7 @@ class RunLoop {
// be registered for a specified handle.
void AddHandler(RunLoopHandler* handler,
const Handle& handle,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline);
void RemoveHandler(const Handle& handle);
bool HasHandler(const Handle& handle) const;
@@ -57,12 +57,12 @@ class RunLoop {
struct HandlerData {
HandlerData()
: handler(NULL),
- wait_flags(MOJO_WAIT_FLAG_NONE),
+ handle_signals(MOJO_WAIT_FLAG_NONE),
deadline(0),
id(0) {}
RunLoopHandler* handler;
- MojoWaitFlags wait_flags;
+ MojoHandleSignals handle_signals;
MojoTimeTicks deadline;
// See description of |RunLoop::next_handler_id_| for details.
int id;
diff --git a/mojo/public/js/bindings/core.js b/mojo/public/js/bindings/core.js
index 389681af..5377533 100644
--- a/mojo/public/js/bindings/core.js
+++ b/mojo/public/js/bindings/core.js
@@ -47,8 +47,9 @@ var RESULT_SHOULD_WAIT;
var DEADLINE_INDEFINITE;
/**
- * MojoWaitFlags: Used to specify the state of a handle to wait on (e.g., the
- * ability to read or write to it).
+ * MojoHandleSignals: Used to specify signals that can be waited on for a handle
+ *(and which can be triggered), e.g., the ability to read or write to
+ * the handle.
* See core.h for more information.
*/
var WAIT_FLAG_NONE;
@@ -108,15 +109,15 @@ var READ_DATA_FLAG_QUERY;
function close(handle) { [native code] }
/**
- * Waits on the given handle until the state indicated by |waitFlags| is
+ * Waits on the given handle until a signal indicated by |signals| is
* satisfied or until |deadline| is passed. See MojoWait for more information.
*
* @param {MojoHandle} handle Handle to wait on.
- * @param {MojoWaitFlags} waitFlags Specifies the condition to wait for.
+ * @param {MojoHandleSignals} signals Specifies the condition to wait for.
* @param {MojoDeadline} deadline Stops waiting if this is reached.
* @return {MojoResult} Result code.
*/
-function wait(handle, waitFlags, deadline) { [native code] }
+function wait(handle, signals, deadline) { [native code] }
/**
* Waits on |handles[0]|, ..., |handles[handles.length-1]| for at least one of
@@ -125,12 +126,12 @@ function wait(handle, waitFlags, deadline) { [native code] }
* See MojoWaitMany for more information.
*
* @param {Array.MojoHandle} handles Handles to wait on.
- * @param {Array.MojoWaitFlags} waitFlags Specifies the condition to wait for,
+ * @param {Array.MojoHandleSignals} signals Specifies the condition to wait for,
* for each corresponding handle. Must be the same length as |handles|.
* @param {MojoDeadline} deadline Stops waiting if this is reached.
* @return {MojoResult} Result code.
*/
-function waitMany(handles, waitFlags, deadline) { [native code] }
+function waitMany(handles, signals, deadline) { [native code] }
/**
* Creates a message pipe. This function always succeeds.
diff --git a/mojo/public/js/bindings/support.js b/mojo/public/js/bindings/support.js
index 756e7ba..8280a97 100644
--- a/mojo/public/js/bindings/support.js
+++ b/mojo/public/js/bindings/support.js
@@ -14,7 +14,7 @@ while (1);
* satisfied.
*
* @param {MojoHandle} handle The handle to wait on.
- * @param {MojoWaitFlags} waitFlags Flags.
+ * @param {MojoHandleSignals} signals Specifies the condition to wait for.
* @param {function (mojoResult)} callback Called with the result the wait is
* complete. See MojoWait for possible result codes.
*
diff --git a/mojo/public/platform/native/system_thunks.cc b/mojo/public/platform/native/system_thunks.cc
index ac03450..6fdc4f4 100644
--- a/mojo/public/platform/native/system_thunks.cc
+++ b/mojo/public/platform/native/system_thunks.cc
@@ -21,18 +21,18 @@ MojoResult MojoClose(MojoHandle handle) {
}
MojoResult MojoWait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline) {
assert(g_thunks.Wait);
- return g_thunks.Wait(handle, flags, deadline);
+ return g_thunks.Wait(handle, signals, deadline);
}
MojoResult MojoWaitMany(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline) {
assert(g_thunks.WaitMany);
- return g_thunks.WaitMany(handles, flags, num_handles, deadline);
+ return g_thunks.WaitMany(handles, signals, num_handles, deadline);
}
MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
diff --git a/mojo/public/platform/native/system_thunks.h b/mojo/public/platform/native/system_thunks.h
index c715cd4..de82eba 100644
--- a/mojo/public/platform/native/system_thunks.h
+++ b/mojo/public/platform/native/system_thunks.h
@@ -37,10 +37,10 @@ struct MojoSystemThunks {
MojoTimeTicks (*GetTimeTicksNow)();
MojoResult (*Close)(MojoHandle handle);
MojoResult (*Wait)(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline);
MojoResult (*WaitMany)(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline);
MojoResult (*CreateMessagePipe)(const MojoCreateMessagePipeOptions* options,
diff --git a/mojo/spy/spy.cc b/mojo/spy/spy.cc
index 349f5d5..acce078 100644
--- a/mojo/spy/spy.cc
+++ b/mojo/spy/spy.cc
@@ -49,9 +49,9 @@ class MessageProcessor :
std::vector<mojo::MessagePipeHandle> pipes;
pipes.push_back(client.get());
pipes.push_back(interceptor.get());
- std::vector<MojoWaitFlags> wait_flags;
- wait_flags.push_back(MOJO_WAIT_FLAG_READABLE);
- wait_flags.push_back(MOJO_WAIT_FLAG_READABLE);
+ std::vector<MojoHandleSignals> handle_signals;
+ handle_signals.push_back(MOJO_WAIT_FLAG_READABLE);
+ handle_signals.push_back(MOJO_WAIT_FLAG_READABLE);
scoped_ptr<char[]> mbuf(new char[kMessageBufSize]);
scoped_ptr<MojoHandle[]> hbuf(new MojoHandle[kHandleBufSize]);
@@ -64,7 +64,7 @@ class MessageProcessor :
// 4- Write the message to opposite port.
for (;;) {
- int r = WaitMany(pipes, wait_flags, MOJO_DEADLINE_INDEFINITE);
+ int r = WaitMany(pipes, handle_signals, MOJO_DEADLINE_INDEFINITE);
if ((r < 0) || (r > 1)) {
last_result_ = r;
break;
diff --git a/mojo/system/core.cc b/mojo/system/core.cc
index f670272..d72198f 100644
--- a/mojo/system/core.cc
+++ b/mojo/system/core.cc
@@ -118,24 +118,24 @@ MojoResult Core::Close(MojoHandle handle) {
}
MojoResult Core::Wait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline) {
- return WaitManyInternal(&handle, &flags, 1, deadline);
+ return WaitManyInternal(&handle, &signals, 1, deadline);
}
MojoResult Core::WaitMany(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline) {
if (!VerifyUserPointerWithCount<MojoHandle>(handles, num_handles))
return MOJO_RESULT_INVALID_ARGUMENT;
- if (!VerifyUserPointerWithCount<MojoWaitFlags>(flags, num_handles))
+ if (!VerifyUserPointerWithCount<MojoHandleSignals>(signals, num_handles))
return MOJO_RESULT_INVALID_ARGUMENT;
if (num_handles < 1)
return MOJO_RESULT_INVALID_ARGUMENT;
if (num_handles > kMaxWaitManyNumHandles)
return MOJO_RESULT_RESOURCE_EXHAUSTED;
- return WaitManyInternal(handles, flags, num_handles, deadline);
+ return WaitManyInternal(handles, signals, num_handles, deadline);
}
MojoResult Core::CreateMessagePipe(const MojoCreateMessagePipeOptions* options,
@@ -512,7 +512,7 @@ MojoResult Core::UnmapBuffer(void* buffer) {
// TODO(vtl): This incurs a performance cost in |RemoveWaiter()|. Analyze this
// more carefully and address it if necessary.
MojoResult Core::WaitManyInternal(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline) {
DCHECK_GT(num_handles, 0u);
@@ -533,7 +533,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
uint32_t i;
MojoResult rv = MOJO_RESULT_OK;
for (i = 0; i < num_handles; i++) {
- rv = dispatchers[i]->AddWaiter(&waiter, flags[i], i);
+ rv = dispatchers[i]->AddWaiter(&waiter, signals[i], i);
if (rv != MOJO_RESULT_OK)
break;
}
diff --git a/mojo/system/core.h b/mojo/system/core.h
index 0f3c76a..a0bc293 100644
--- a/mojo/system/core.h
+++ b/mojo/system/core.h
@@ -42,10 +42,10 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
MojoTimeTicks GetTimeTicksNow();
MojoResult Close(MojoHandle handle);
MojoResult Wait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline);
MojoResult WaitMany(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline);
MojoResult CreateMessagePipe(const MojoCreateMessagePipeOptions* options,
@@ -106,7 +106,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
// Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic
// validation of arguments.
MojoResult WaitManyInternal(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline);
diff --git a/mojo/system/core_test_base.cc b/mojo/system/core_test_base.cc
index 6d1ca31..c91437c 100644
--- a/mojo/system/core_test_base.cc
+++ b/mojo/system/core_test_base.cc
@@ -130,7 +130,7 @@ class MockDispatcher : public Dispatcher {
}
virtual MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/,
- MojoWaitFlags /*flags*/,
+ MojoHandleSignals /*signals*/,
uint32_t /*context*/) OVERRIDE {
info_->IncrementAddWaiterCallCount();
lock().AssertAcquired();
diff --git a/mojo/system/core_unittest.cc b/mojo/system/core_unittest.cc
index 5dac796..ee58d87 100644
--- a/mojo/system/core_unittest.cc
+++ b/mojo/system/core_unittest.cc
@@ -103,9 +103,9 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
core()->Wait(h, MOJO_WAIT_FLAG_EVERYTHING, 10 * 1000));
EXPECT_EQ(3u, info.GetAddWaiterCallCount());
- MojoWaitFlags wait_flags = MOJO_WAIT_FLAG_EVERYTHING;
+ MojoHandleSignals handle_signals = MOJO_WAIT_FLAG_EVERYTHING;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(&h, &wait_flags, 1, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(&h, &handle_signals, 1, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(4u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, info.GetDtorCallCount());
@@ -148,36 +148,36 @@ TEST_F(CoreTest, InvalidArguments) {
// |WaitMany()|:
{
- MojoHandle handles[2] = { MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID };
- MojoWaitFlags flags[2] = { MOJO_WAIT_FLAG_EVERYTHING,
- MOJO_WAIT_FLAG_EVERYTHING };
+ MojoHandle handles[2] = {MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID};
+ MojoHandleSignals signals[2] = {MOJO_WAIT_FLAG_EVERYTHING,
+ MOJO_WAIT_FLAG_EVERYTHING};
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(handles, flags, 0, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 0, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(NULL, flags, 0, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(NULL, signals, 0, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
core()->WaitMany(handles, NULL, 0, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(NULL, flags, 1, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(NULL, signals, 1, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
core()->WaitMany(handles, NULL, 1, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(handles, flags, 1, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 1, MOJO_DEADLINE_INDEFINITE));
MockHandleInfo info[2];
handles[0] = CreateMockHandle(&info[0]);
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(handles, flags, 1, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 1, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(handles, flags, 2, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 2, MOJO_DEADLINE_INDEFINITE));
handles[1] = handles[0] + 1; // Invalid handle.
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(handles, flags, 2, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 2, MOJO_DEADLINE_INDEFINITE));
handles[1] = CreateMockHandle(&info[1]);
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(handles, flags, 2, MOJO_DEADLINE_INDEFINITE));
+ core()->WaitMany(handles, signals, 2, MOJO_DEADLINE_INDEFINITE));
EXPECT_EQ(MOJO_RESULT_OK, core()->Close(handles[0]));
EXPECT_EQ(MOJO_RESULT_OK, core()->Close(handles[1]));
@@ -320,7 +320,7 @@ TEST_F(CoreTest, InvalidArguments) {
// TODO(vtl): test |Wait()| and |WaitMany()| properly
// - including |WaitMany()| with the same handle more than once (with
-// same/different flags)
+// same/different signals)
TEST_F(CoreTest, MessagePipe) {
MojoHandle h[2];
@@ -332,9 +332,10 @@ TEST_F(CoreTest, MessagePipe) {
EXPECT_NE(h[0], h[1]);
// Neither should be readable.
- MojoWaitFlags flags[2] = { MOJO_WAIT_FLAG_READABLE, MOJO_WAIT_FLAG_READABLE };
+ MojoHandleSignals signals[2] = {MOJO_WAIT_FLAG_READABLE,
+ MOJO_WAIT_FLAG_READABLE};
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- core()->WaitMany(h, flags, 2, 0));
+ core()->WaitMany(h, signals, 2, 0));
// Try to read anyway.
char buffer[1] = { 'a' };
@@ -353,9 +354,9 @@ TEST_F(CoreTest, MessagePipe) {
core()->Wait(h[1], MOJO_WAIT_FLAG_WRITABLE, 1000000000));
// Also check that |h[1]| is writable using |WaitMany()|.
- flags[0] = MOJO_WAIT_FLAG_READABLE;
- flags[1] = MOJO_WAIT_FLAG_WRITABLE;
- EXPECT_EQ(1, core()->WaitMany(h, flags, 2, MOJO_DEADLINE_INDEFINITE));
+ signals[0] = MOJO_WAIT_FLAG_READABLE;
+ signals[1] = MOJO_WAIT_FLAG_WRITABLE;
+ EXPECT_EQ(1, core()->WaitMany(h, signals, 2, MOJO_DEADLINE_INDEFINITE));
// Write to |h[1]|.
buffer[0] = 'b';
@@ -364,9 +365,9 @@ TEST_F(CoreTest, MessagePipe) {
MOJO_WRITE_MESSAGE_FLAG_NONE));
// Check that |h[0]| is now readable.
- flags[0] = MOJO_WAIT_FLAG_READABLE;
- flags[1] = MOJO_WAIT_FLAG_READABLE;
- EXPECT_EQ(0, core()->WaitMany(h, flags, 2, MOJO_DEADLINE_INDEFINITE));
+ signals[0] = MOJO_WAIT_FLAG_READABLE;
+ signals[1] = MOJO_WAIT_FLAG_READABLE;
+ EXPECT_EQ(0, core()->WaitMany(h, signals, 2, MOJO_DEADLINE_INDEFINITE));
// Read from |h[0]|.
// First, get only the size.
diff --git a/mojo/system/data_pipe.cc b/mojo/system/data_pipe.cc
index 7429813..80cd44c 100644
--- a/mojo/system/data_pipe.cc
+++ b/mojo/system/data_pipe.cc
@@ -177,18 +177,18 @@ MojoResult DataPipe::ProducerEndWriteData(uint32_t num_bytes_written) {
}
MojoResult DataPipe::ProducerAddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
base::AutoLock locker(lock_);
DCHECK(has_local_producer_no_lock());
WaitFlagsState producer_state = ProducerGetWaitFlagsStateNoLock();
- if (producer_state.satisfies(flags))
+ if (producer_state.satisfies(signals))
return MOJO_RESULT_ALREADY_EXISTS;
- if (!producer_state.can_satisfy(flags))
+ if (!producer_state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- producer_waiter_list_->AddWaiter(waiter, flags, context);
+ producer_waiter_list_->AddWaiter(waiter, signals, context);
return MOJO_RESULT_OK;
}
@@ -329,18 +329,18 @@ MojoResult DataPipe::ConsumerEndReadData(uint32_t num_bytes_read) {
}
MojoResult DataPipe::ConsumerAddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
base::AutoLock locker(lock_);
DCHECK(has_local_consumer_no_lock());
WaitFlagsState consumer_state = ConsumerGetWaitFlagsStateNoLock();
- if (consumer_state.satisfies(flags))
+ if (consumer_state.satisfies(signals))
return MOJO_RESULT_ALREADY_EXISTS;
- if (!consumer_state.can_satisfy(flags))
+ if (!consumer_state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- consumer_waiter_list_->AddWaiter(waiter, flags, context);
+ consumer_waiter_list_->AddWaiter(waiter, signals, context);
return MOJO_RESULT_OK;
}
diff --git a/mojo/system/data_pipe.h b/mojo/system/data_pipe.h
index d3de60a..20a7b5a 100644
--- a/mojo/system/data_pipe.h
+++ b/mojo/system/data_pipe.h
@@ -60,7 +60,7 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipe :
bool all_or_none);
MojoResult ProducerEndWriteData(uint32_t num_bytes_written);
MojoResult ProducerAddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context);
void ProducerRemoveWaiter(Waiter* waiter);
bool ProducerIsBusy() const;
@@ -83,7 +83,7 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipe :
bool all_or_none);
MojoResult ConsumerEndReadData(uint32_t num_bytes_read);
MojoResult ConsumerAddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context);
void ConsumerRemoveWaiter(Waiter* waiter);
bool ConsumerIsBusy() const;
diff --git a/mojo/system/data_pipe_consumer_dispatcher.cc b/mojo/system/data_pipe_consumer_dispatcher.cc
index b1272fe..99818e2 100644
--- a/mojo/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/system/data_pipe_consumer_dispatcher.cc
@@ -108,11 +108,12 @@ MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock(
return data_pipe_->ConsumerEndReadData(num_bytes_read);
}
-MojoResult DataPipeConsumerDispatcher::AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
- uint32_t context) {
+MojoResult DataPipeConsumerDispatcher::AddWaiterImplNoLock(
+ Waiter* waiter,
+ MojoHandleSignals signals,
+ uint32_t context) {
lock().AssertAcquired();
- return data_pipe_->ConsumerAddWaiter(waiter, flags, context);
+ return data_pipe_->ConsumerAddWaiter(waiter, signals, context);
}
void DataPipeConsumerDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
diff --git a/mojo/system/data_pipe_consumer_dispatcher.h b/mojo/system/data_pipe_consumer_dispatcher.h
index f5a13fb..390d0bf 100644
--- a/mojo/system/data_pipe_consumer_dispatcher.h
+++ b/mojo/system/data_pipe_consumer_dispatcher.h
@@ -45,7 +45,7 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher : public Dispatcher {
MojoReadDataFlags flags) OVERRIDE;
virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read) OVERRIDE;
virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) OVERRIDE;
virtual void RemoveWaiterImplNoLock(Waiter* waiter) OVERRIDE;
virtual bool IsBusyNoLock() const OVERRIDE;
diff --git a/mojo/system/data_pipe_producer_dispatcher.cc b/mojo/system/data_pipe_producer_dispatcher.cc
index 3eeec75..ec99549 100644
--- a/mojo/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/system/data_pipe_producer_dispatcher.cc
@@ -87,11 +87,12 @@ MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock(
return data_pipe_->ProducerEndWriteData(num_bytes_written);
}
-MojoResult DataPipeProducerDispatcher::AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
- uint32_t context) {
+MojoResult DataPipeProducerDispatcher::AddWaiterImplNoLock(
+ Waiter* waiter,
+ MojoHandleSignals signals,
+ uint32_t context) {
lock().AssertAcquired();
- return data_pipe_->ProducerAddWaiter(waiter, flags, context);
+ return data_pipe_->ProducerAddWaiter(waiter, signals, context);
}
void DataPipeProducerDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
diff --git a/mojo/system/data_pipe_producer_dispatcher.h b/mojo/system/data_pipe_producer_dispatcher.h
index d46ec9c..63ad318 100644
--- a/mojo/system/data_pipe_producer_dispatcher.h
+++ b/mojo/system/data_pipe_producer_dispatcher.h
@@ -47,7 +47,7 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher : public Dispatcher {
virtual MojoResult EndWriteDataImplNoLock(
uint32_t num_bytes_written) OVERRIDE;
virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) OVERRIDE;
virtual void RemoveWaiterImplNoLock(Waiter* waiter) OVERRIDE;
virtual bool IsBusyNoLock() const OVERRIDE;
diff --git a/mojo/system/dispatcher.cc b/mojo/system/dispatcher.cc
index aa99c94..d03fca7 100644
--- a/mojo/system/dispatcher.cc
+++ b/mojo/system/dispatcher.cc
@@ -215,13 +215,13 @@ MojoResult Dispatcher::MapBuffer(
}
MojoResult Dispatcher::AddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
base::AutoLock locker(lock_);
if (is_closed_)
return MOJO_RESULT_INVALID_ARGUMENT;
- return AddWaiterImplNoLock(waiter, flags, context);
+ return AddWaiterImplNoLock(waiter, signals, context);
}
void Dispatcher::RemoveWaiter(Waiter* waiter) {
@@ -347,7 +347,7 @@ MojoResult Dispatcher::MapBufferImplNoLock(
}
MojoResult Dispatcher::AddWaiterImplNoLock(Waiter* /*waiter*/,
- MojoWaitFlags /*flags*/,
+ MojoHandleSignals /*signals*/,
uint32_t /*context*/) {
lock_.AssertAcquired();
DCHECK(!is_closed_);
diff --git a/mojo/system/dispatcher.h b/mojo/system/dispatcher.h
index 2679ac2..051e2bc 100644
--- a/mojo/system/dispatcher.h
+++ b/mojo/system/dispatcher.h
@@ -117,17 +117,19 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher :
scoped_ptr<RawSharedBufferMapping>* mapping);
// Adds a waiter to this dispatcher. The waiter will be woken up when this
- // object changes state to satisfy |flags| with context |context|. It will
+ // object changes state to satisfy |signals| with context |context|. It will
// also be woken up when it becomes impossible for the object to ever satisfy
- // |flags| with a suitable error status.
+ // |signals| with a suitable error status.
//
// Returns:
// - |MOJO_RESULT_OK| if the waiter was added;
- // - |MOJO_RESULT_ALREADY_EXISTS| if |flags| is already satisfied;
+ // - |MOJO_RESULT_ALREADY_EXISTS| if |signals| is already satisfied;
// - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and
// - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible
- // that |flags| will ever be satisfied.
- MojoResult AddWaiter(Waiter* waiter, MojoWaitFlags flags, uint32_t context);
+ // that |signals| will ever be satisfied.
+ MojoResult AddWaiter(Waiter* waiter,
+ MojoHandleSignals signals,
+ uint32_t context);
void RemoveWaiter(Waiter* waiter);
// A dispatcher must be put into a special state in order to be sent across a
@@ -242,7 +244,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher :
MojoMapBufferFlags flags,
scoped_ptr<RawSharedBufferMapping>* mapping);
virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context);
virtual void RemoveWaiterImplNoLock(Waiter* waiter);
diff --git a/mojo/system/entrypoints.cc b/mojo/system/entrypoints.cc
index 8274f93..b70fcad 100644
--- a/mojo/system/entrypoints.cc
+++ b/mojo/system/entrypoints.cc
@@ -40,16 +40,16 @@ MojoResult MojoClose(MojoHandle handle) {
}
MojoResult MojoWait(MojoHandle handle,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
MojoDeadline deadline) {
- return g_core->Wait(handle, flags, deadline);
+ return g_core->Wait(handle, signals, deadline);
}
MojoResult MojoWaitMany(const MojoHandle* handles,
- const MojoWaitFlags* flags,
+ const MojoHandleSignals* signals,
uint32_t num_handles,
MojoDeadline deadline) {
- return g_core->WaitMany(handles, flags, num_handles, deadline);
+ return g_core->WaitMany(handles, signals, num_handles, deadline);
}
MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
diff --git a/mojo/system/local_data_pipe.cc b/mojo/system/local_data_pipe.cc
index d98ccf4..05eacf5 100644
--- a/mojo/system/local_data_pipe.cc
+++ b/mojo/system/local_data_pipe.cc
@@ -156,8 +156,8 @@ WaitFlagsState LocalDataPipe::ProducerGetWaitFlagsStateNoLock() const {
if (consumer_open_no_lock()) {
if ((may_discard() || current_num_bytes_ < capacity_num_bytes()) &&
!producer_in_two_phase_write_no_lock())
- rv.satisfied_flags |= MOJO_WAIT_FLAG_WRITABLE;
- rv.satisfiable_flags |= MOJO_WAIT_FLAG_WRITABLE;
+ rv.satisfied_signals |= MOJO_WAIT_FLAG_WRITABLE;
+ rv.satisfiable_signals |= MOJO_WAIT_FLAG_WRITABLE;
}
return rv;
}
@@ -277,10 +277,10 @@ WaitFlagsState LocalDataPipe::ConsumerGetWaitFlagsStateNoLock() const {
WaitFlagsState rv;
if (current_num_bytes_ > 0) {
if (!consumer_in_two_phase_read_no_lock())
- rv.satisfied_flags |= MOJO_WAIT_FLAG_READABLE;
- rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfied_signals |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfiable_signals |= MOJO_WAIT_FLAG_READABLE;
} else if (producer_open_no_lock()) {
- rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfiable_signals |= MOJO_WAIT_FLAG_READABLE;
}
return rv;
}
diff --git a/mojo/system/local_message_pipe_endpoint.cc b/mojo/system/local_message_pipe_endpoint.cc
index 89764c8..d919854 100644
--- a/mojo/system/local_message_pipe_endpoint.cc
+++ b/mojo/system/local_message_pipe_endpoint.cc
@@ -128,17 +128,17 @@ MojoResult LocalMessagePipeEndpoint::ReadMessage(void* bytes,
}
MojoResult LocalMessagePipeEndpoint::AddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
DCHECK(is_open_);
WaitFlagsState state = GetWaitFlagsState();
- if (state.satisfies(flags))
+ if (state.satisfies(signals))
return MOJO_RESULT_ALREADY_EXISTS;
- if (!state.can_satisfy(flags))
+ if (!state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- waiter_list_.AddWaiter(waiter, flags, context);
+ waiter_list_.AddWaiter(waiter, signals, context);
return MOJO_RESULT_OK;
}
@@ -150,12 +150,12 @@ void LocalMessagePipeEndpoint::RemoveWaiter(Waiter* waiter) {
WaitFlagsState LocalMessagePipeEndpoint::GetWaitFlagsState() {
WaitFlagsState rv;
if (!message_queue_.IsEmpty()) {
- rv.satisfied_flags |= MOJO_WAIT_FLAG_READABLE;
- rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfied_signals |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfiable_signals |= MOJO_WAIT_FLAG_READABLE;
}
if (is_peer_open_) {
- rv.satisfied_flags |= MOJO_WAIT_FLAG_WRITABLE;
- rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE;
+ rv.satisfied_signals |= MOJO_WAIT_FLAG_WRITABLE;
+ rv.satisfiable_signals |= MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE;
}
return rv;
}
diff --git a/mojo/system/local_message_pipe_endpoint.h b/mojo/system/local_message_pipe_endpoint.h
index 4a62508..e30aff4 100644
--- a/mojo/system/local_message_pipe_endpoint.h
+++ b/mojo/system/local_message_pipe_endpoint.h
@@ -37,7 +37,7 @@ class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint
uint32_t* num_dispatchers,
MojoReadMessageFlags flags) OVERRIDE;
virtual MojoResult AddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) OVERRIDE;
virtual void RemoveWaiter(Waiter* waiter) OVERRIDE;
diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc
index 3e544c5..c297f38 100644
--- a/mojo/system/message_pipe.cc
+++ b/mojo/system/message_pipe.cc
@@ -99,14 +99,14 @@ MojoResult MessagePipe::ReadMessage(unsigned port,
MojoResult MessagePipe::AddWaiter(unsigned port,
Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
DCHECK(port == 0 || port == 1);
base::AutoLock locker(lock_);
DCHECK(endpoints_[port]);
- return endpoints_[port]->AddWaiter(waiter, flags, context);
+ return endpoints_[port]->AddWaiter(waiter, signals, context);
}
void MessagePipe::RemoveWaiter(unsigned port, Waiter* waiter) {
diff --git a/mojo/system/message_pipe.h b/mojo/system/message_pipe.h
index 0781324..e43dcb6 100644
--- a/mojo/system/message_pipe.h
+++ b/mojo/system/message_pipe.h
@@ -66,7 +66,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipe :
MojoReadMessageFlags flags);
MojoResult AddWaiter(unsigned port,
Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context);
void RemoveWaiter(unsigned port, Waiter* waiter);
diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
index 00d743f..484613c 100644
--- a/mojo/system/message_pipe_dispatcher.cc
+++ b/mojo/system/message_pipe_dispatcher.cc
@@ -217,10 +217,10 @@ MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
}
MojoResult MessagePipeDispatcher::AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
lock().AssertAcquired();
- return message_pipe_->AddWaiter(port_, waiter, flags, context);
+ return message_pipe_->AddWaiter(port_, waiter, signals, context);
}
void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
diff --git a/mojo/system/message_pipe_dispatcher.h b/mojo/system/message_pipe_dispatcher.h
index 0f856ab..d3a3946 100644
--- a/mojo/system/message_pipe_dispatcher.h
+++ b/mojo/system/message_pipe_dispatcher.h
@@ -89,7 +89,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher : public Dispatcher {
uint32_t* num_dispatchers,
MojoReadMessageFlags flags) OVERRIDE;
virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) OVERRIDE;
virtual void RemoveWaiterImplNoLock(Waiter* waiter) OVERRIDE;
virtual void StartSerializeImplNoLock(Channel* channel,
diff --git a/mojo/system/message_pipe_endpoint.cc b/mojo/system/message_pipe_endpoint.cc
index e415d7c..f5ccfc7 100644
--- a/mojo/system/message_pipe_endpoint.cc
+++ b/mojo/system/message_pipe_endpoint.cc
@@ -28,7 +28,7 @@ MojoResult MessagePipeEndpoint::ReadMessage(void* /*bytes*/,
}
MojoResult MessagePipeEndpoint::AddWaiter(Waiter* /*waiter*/,
- MojoWaitFlags /*flags*/,
+ MojoHandleSignals /*signals*/,
uint32_t /*context*/) {
NOTREACHED();
return MOJO_RESULT_INTERNAL;
diff --git a/mojo/system/message_pipe_endpoint.h b/mojo/system/message_pipe_endpoint.h
index 6d42126..7da65f0 100644
--- a/mojo/system/message_pipe_endpoint.h
+++ b/mojo/system/message_pipe_endpoint.h
@@ -67,7 +67,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipeEndpoint {
uint32_t* num_dispatchers,
MojoReadMessageFlags flags);
virtual MojoResult AddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context);
virtual void RemoveWaiter(Waiter* waiter);
diff --git a/mojo/system/multiprocess_message_pipe_unittest.cc b/mojo/system/multiprocess_message_pipe_unittest.cc
index fa16996..a27a40c 100644
--- a/mojo/system/multiprocess_message_pipe_unittest.cc
+++ b/mojo/system/multiprocess_message_pipe_unittest.cc
@@ -125,11 +125,12 @@ class MultiprocessMessagePipeTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTest);
};
-MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, MojoWaitFlags flags) {
+MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp,
+ MojoHandleSignals signals) {
Waiter waiter;
waiter.Init();
- MojoResult add_result = mp->AddWaiter(0, &waiter, flags, 0);
+ MojoResult add_result = mp->AddWaiter(0, &waiter, signals, 0);
if (add_result != MOJO_RESULT_OK) {
return (add_result == MOJO_RESULT_ALREADY_EXISTS) ? MOJO_RESULT_OK :
add_result;
diff --git a/mojo/system/simple_dispatcher.cc b/mojo/system/simple_dispatcher.cc
index 4edd1ca..b9870a3 100644
--- a/mojo/system/simple_dispatcher.cc
+++ b/mojo/system/simple_dispatcher.cc
@@ -26,17 +26,17 @@ void SimpleDispatcher::CancelAllWaitersNoLock() {
}
MojoResult SimpleDispatcher::AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
lock().AssertAcquired();
WaitFlagsState state(GetWaitFlagsStateNoLock());
- if (state.satisfies(flags))
+ if (state.satisfies(signals))
return MOJO_RESULT_ALREADY_EXISTS;
- if (!state.can_satisfy(flags))
+ if (!state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- waiter_list_.AddWaiter(waiter, flags, context);
+ waiter_list_.AddWaiter(waiter, signals, context);
return MOJO_RESULT_OK;
}
diff --git a/mojo/system/simple_dispatcher.h b/mojo/system/simple_dispatcher.h
index 0e55832..c096486 100644
--- a/mojo/system/simple_dispatcher.h
+++ b/mojo/system/simple_dispatcher.h
@@ -36,7 +36,7 @@ class MOJO_SYSTEM_IMPL_EXPORT SimpleDispatcher : public Dispatcher {
// |Dispatcher| protected methods:
virtual void CancelAllWaitersNoLock() OVERRIDE;
virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) OVERRIDE;
virtual void RemoveWaiterImplNoLock(Waiter* waiter) OVERRIDE;
diff --git a/mojo/system/simple_dispatcher_unittest.cc b/mojo/system/simple_dispatcher_unittest.cc
index 3b292ddd..2910608 100644
--- a/mojo/system/simple_dispatcher_unittest.cc
+++ b/mojo/system/simple_dispatcher_unittest.cc
@@ -31,32 +31,32 @@ class MockSimpleDispatcher : public SimpleDispatcher {
: state_(MOJO_WAIT_FLAG_NONE,
MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE) {}
- void SetSatisfiedFlags(MojoWaitFlags new_satisfied_flags) {
+ void SetSatisfiedSignals(MojoHandleSignals new_satisfied_signals) {
base::AutoLock locker(lock());
- // Any new flags that are set should be satisfiable.
- CHECK_EQ(new_satisfied_flags & ~state_.satisfied_flags,
- new_satisfied_flags & ~state_.satisfied_flags &
- state_.satisfiable_flags);
+ // Any new signals that are set should be satisfiable.
+ CHECK_EQ(new_satisfied_signals & ~state_.satisfied_signals,
+ new_satisfied_signals & ~state_.satisfied_signals &
+ state_.satisfiable_signals);
- if (new_satisfied_flags == state_.satisfied_flags)
+ if (new_satisfied_signals == state_.satisfied_signals)
return;
- state_.satisfied_flags = new_satisfied_flags;
+ state_.satisfied_signals = new_satisfied_signals;
WaitFlagsStateChangedNoLock();
}
- void SetSatisfiableFlags(MojoWaitFlags new_satisfiable_flags) {
+ void SetSatisfiableSignals(MojoHandleSignals new_satisfiable_signals) {
base::AutoLock locker(lock());
// Satisfied implies satisfiable.
- CHECK_EQ(new_satisfiable_flags & state_.satisfied_flags,
- state_.satisfied_flags);
+ CHECK_EQ(new_satisfiable_signals & state_.satisfied_signals,
+ state_.satisfied_signals);
- if (new_satisfiable_flags == state_.satisfiable_flags)
+ if (new_satisfiable_signals == state_.satisfiable_signals)
return;
- state_.satisfiable_flags = new_satisfiable_flags;
+ state_.satisfiable_signals = new_satisfiable_signals;
WaitFlagsStateChangedNoLock();
}
@@ -96,16 +96,16 @@ TEST(SimpleDispatcherTest, Basic) {
// Try adding a readable waiter when already readable.
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_ALREADY_EXISTS,
d->AddWaiter(&w, MOJO_WAIT_FLAG_READABLE, 0));
// Shouldn't need to remove the waiter (it was not added).
// Wait (forever) for writable when already writable.
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 1));
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout());
@@ -114,9 +114,9 @@ TEST(SimpleDispatcherTest, Basic) {
// Wait for zero time for writable when already writable.
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 2));
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK, w.Wait(0, &context));
EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout());
@@ -125,9 +125,9 @@ TEST(SimpleDispatcherTest, Basic) {
// Wait for non-zero, finite time for writable when already writable.
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 3));
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_WRITABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_OK,
w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), &context));
@@ -137,7 +137,7 @@ TEST(SimpleDispatcherTest, Basic) {
// Wait for zero time for writable when not writable (will time out).
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 4));
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, NULL));
@@ -147,7 +147,7 @@ TEST(SimpleDispatcherTest, Basic) {
// Wait for non-zero, finite time for writable when not writable (will time
// out).
w.Init();
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 5));
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
@@ -169,17 +169,17 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
// Try adding a writable waiter when it can never be writable.
w.Init();
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE);
- d->SetSatisfiedFlags(0);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(0);
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 1));
// Shouldn't need to remove the waiter (it was not added).
// Wait (forever) for writable and then it becomes never writable.
w.Init();
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 2));
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
@@ -189,9 +189,9 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
// Wait for zero time for writable and then it becomes never writable.
w.Init();
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 3));
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, w.Wait(0, &context));
EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout());
@@ -201,9 +201,9 @@ TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
// Wait for non-zero, finite time for writable and then it becomes never
// writable.
w.Init();
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->AddWaiter(&w, MOJO_WAIT_FLAG_WRITABLE, 4));
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE);
stopwatch.Start();
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), &context));
@@ -275,7 +275,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
{
scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
{
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
test::WaiterThread thread(d,
MOJO_WAIT_FLAG_READABLE,
MOJO_DEADLINE_INDEFINITE,
@@ -302,7 +302,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
stopwatch.Start();
thread.Start();
base::PlatformThread::Sleep(2 * test::EpsilonTimeout());
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the thread.
base::TimeDelta elapsed = stopwatch.Elapsed();
@@ -323,7 +323,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
stopwatch.Start();
thread.Start();
base::PlatformThread::Sleep(2 * test::EpsilonTimeout());
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_NONE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_NONE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the thread.
elapsed = stopwatch.Elapsed();
@@ -366,7 +366,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
thread.Start();
base::PlatformThread::Sleep(1 * test::EpsilonTimeout());
// Not what we're waiting for.
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_WRITABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_WRITABLE);
} // Joins the thread (after its wait times out).
// If we closed earlier, then probably we'd get a |MOJO_RESULT_CANCELLED|.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
@@ -400,7 +400,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
threads.back()->Start();
}
base::PlatformThread::Sleep(2 * test::EpsilonTimeout());
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
for (uint32_t i = 0; i < kNumWaiters; i++) {
@@ -435,7 +435,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
threads.back()->Start();
}
base::PlatformThread::Sleep(2 * test::EpsilonTimeout());
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
// This will wake up the ones waiting to write.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
@@ -476,9 +476,9 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
threads.back()->Start();
}
base::PlatformThread::Sleep(1 * test::EpsilonTimeout());
- d->SetSatisfiableFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiableSignals(MOJO_WAIT_FLAG_READABLE);
base::PlatformThread::Sleep(1 * test::EpsilonTimeout());
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
@@ -516,7 +516,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
threads.back()->Start();
}
base::PlatformThread::Sleep(2 * test::EpsilonTimeout());
- d->SetSatisfiedFlags(MOJO_WAIT_FLAG_READABLE);
+ d->SetSatisfiedSignals(MOJO_WAIT_FLAG_READABLE);
// All those waiting for writable should have timed out.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
diff --git a/mojo/system/wait_flags_state.h b/mojo/system/wait_flags_state.h
index aaddd0c..5647b68 100644
--- a/mojo/system/wait_flags_state.h
+++ b/mojo/system/wait_flags_state.h
@@ -16,25 +16,25 @@ namespace system {
// (for convenience). This should add no overhead.
struct MOJO_SYSTEM_IMPL_EXPORT WaitFlagsState : public MojoWaitFlagsState {
WaitFlagsState() {
- satisfied_flags = MOJO_WAIT_FLAG_NONE;
- satisfiable_flags = MOJO_WAIT_FLAG_NONE;
+ satisfied_signals = MOJO_WAIT_FLAG_NONE;
+ satisfiable_signals = MOJO_WAIT_FLAG_NONE;
}
- WaitFlagsState(MojoWaitFlags satisfied, MojoWaitFlags satisfiable) {
- satisfied_flags = satisfied;
- satisfiable_flags = satisfiable;
+ WaitFlagsState(MojoHandleSignals satisfied, MojoHandleSignals satisfiable) {
+ satisfied_signals = satisfied;
+ satisfiable_signals = satisfiable;
}
bool equals(const WaitFlagsState& other) const {
- return satisfied_flags == other.satisfied_flags &&
- satisfiable_flags == other.satisfiable_flags;
+ return satisfied_signals == other.satisfied_signals &&
+ satisfiable_signals == other.satisfiable_signals;
}
- bool satisfies(MojoWaitFlags flags) const {
- return !!(satisfied_flags & flags);
+ bool satisfies(MojoHandleSignals signals) const {
+ return !!(satisfied_signals & signals);
}
- bool can_satisfy(MojoWaitFlags flags) const {
- return !!(satisfiable_flags & flags);
+ bool can_satisfy(MojoHandleSignals signals) const {
+ return !!(satisfiable_signals & signals);
}
// (Copy and assignment allowed.)
diff --git a/mojo/system/waiter_list.cc b/mojo/system/waiter_list.cc
index e286543..3de452a 100644
--- a/mojo/system/waiter_list.cc
+++ b/mojo/system/waiter_list.cc
@@ -21,9 +21,9 @@ WaiterList::~WaiterList() {
void WaiterList::AwakeWaitersForStateChange(const WaitFlagsState& state) {
for (WaiterInfoList::iterator it = waiters_.begin(); it != waiters_.end();
++it) {
- if (state.satisfies(it->flags))
+ if (state.satisfies(it->signals))
it->waiter->Awake(MOJO_RESULT_OK, it->context);
- else if (!state.can_satisfy(it->flags))
+ else if (!state.can_satisfy(it->signals))
it->waiter->Awake(MOJO_RESULT_FAILED_PRECONDITION, it->context);
}
}
@@ -37,9 +37,9 @@ void WaiterList::CancelAllWaiters() {
}
void WaiterList::AddWaiter(Waiter* waiter,
- MojoWaitFlags flags,
+ MojoHandleSignals signals,
uint32_t context) {
- waiters_.push_back(WaiterInfo(waiter, flags, context));
+ waiters_.push_back(WaiterInfo(waiter, signals, context));
}
void WaiterList::RemoveWaiter(Waiter* waiter) {
diff --git a/mojo/system/waiter_list.h b/mojo/system/waiter_list.h
index 17745c5..62d05d1 100644
--- a/mojo/system/waiter_list.h
+++ b/mojo/system/waiter_list.h
@@ -33,16 +33,16 @@ class MOJO_SYSTEM_IMPL_EXPORT WaiterList {
void AwakeWaitersForStateChange(const WaitFlagsState& state);
void CancelAllWaiters();
- void AddWaiter(Waiter* waiter, MojoWaitFlags flags, uint32_t context);
+ void AddWaiter(Waiter* waiter, MojoHandleSignals signals, uint32_t context);
void RemoveWaiter(Waiter* waiter);
private:
struct WaiterInfo {
- WaiterInfo(Waiter* waiter, MojoWaitFlags flags, uint32_t context)
- : waiter(waiter), flags(flags), context(context) {}
+ WaiterInfo(Waiter* waiter, MojoHandleSignals signals, uint32_t context)
+ : waiter(waiter), signals(signals), context(context) {}
Waiter* waiter;
- MojoWaitFlags flags;
+ MojoHandleSignals signals;
uint32_t context;
};
typedef std::list<WaiterInfo> WaiterInfoList;
diff --git a/mojo/system/waiter_test_utils.cc b/mojo/system/waiter_test_utils.cc
index 23c8e3e..f762e985f 100644
--- a/mojo/system/waiter_test_utils.cc
+++ b/mojo/system/waiter_test_utils.cc
@@ -26,7 +26,7 @@ void SimpleWaiterThread::Run() {
}
WaiterThread::WaiterThread(scoped_refptr<Dispatcher> dispatcher,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline,
uint32_t context,
bool* did_wait_out,
@@ -34,7 +34,7 @@ WaiterThread::WaiterThread(scoped_refptr<Dispatcher> dispatcher,
uint32_t* context_out)
: base::SimpleThread("waiter_thread"),
dispatcher_(dispatcher),
- wait_flags_(wait_flags),
+ handle_signals_(handle_signals),
deadline_(deadline),
context_(context),
did_wait_out_(did_wait_out),
@@ -52,7 +52,7 @@ WaiterThread::~WaiterThread() {
void WaiterThread::Run() {
waiter_.Init();
- *result_out_ = dispatcher_->AddWaiter(&waiter_, wait_flags_, context_);
+ *result_out_ = dispatcher_->AddWaiter(&waiter_, handle_signals_, context_);
if (*result_out_ != MOJO_RESULT_OK)
return;
diff --git a/mojo/system/waiter_test_utils.h b/mojo/system/waiter_test_utils.h
index 26dd747..95e0f51 100644
--- a/mojo/system/waiter_test_utils.h
+++ b/mojo/system/waiter_test_utils.h
@@ -70,7 +70,7 @@ class WaiterThread : public base::SimpleThread {
// Note: |*did_wait_out|, |*result_out|, and |*context_out| "belong" to this
// object (i.e., may be modified by, on some other thread) while it's alive.
WaiterThread(scoped_refptr<Dispatcher> dispatcher,
- MojoWaitFlags wait_flags,
+ MojoHandleSignals handle_signals,
MojoDeadline deadline,
uint32_t context,
bool* did_wait_out,
@@ -82,7 +82,7 @@ class WaiterThread : public base::SimpleThread {
virtual void Run() OVERRIDE;
const scoped_refptr<Dispatcher> dispatcher_;
- const MojoWaitFlags wait_flags_;
+ const MojoHandleSignals handle_signals_;
const MojoDeadline deadline_;
const uint32_t context_;
bool* const did_wait_out_;