Index: mojo/edk/system/core.cc |
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc |
index 27d33b26db94a85b32993de05d751b055764b65b..c67a6260fb33dd4d0c972f9bdd714ad10a31ac17 100644 |
--- a/mojo/edk/system/core.cc |
+++ b/mojo/edk/system/core.cc |
@@ -10,7 +10,7 @@ |
#include "base/time/time.h" |
#include "mojo/edk/embedder/platform_shared_buffer.h" |
#include "mojo/edk/embedder/platform_support.h" |
-#include "mojo/edk/system/configuration.h" |
+#include "mojo/edk/system/constants.h" |
#include "mojo/edk/system/data_pipe.h" |
#include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
#include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
@@ -126,7 +126,11 @@ |
UserPointer<MojoHandleSignalsState> signals_state) { |
uint32_t unused = static_cast<uint32_t>(-1); |
HandleSignalsState hss; |
- MojoResult rv = WaitManyInternal(&handle, &signals, 1, deadline, &unused, |
+ MojoResult rv = WaitManyInternal(&handle, |
+ &signals, |
+ 1, |
+ deadline, |
+ &unused, |
signals_state.IsNull() ? nullptr : &hss); |
if (rv != MOJO_RESULT_INVALID_ARGUMENT && !signals_state.IsNull()) |
signals_state.Put(hss); |
@@ -141,7 +145,7 @@ |
UserPointer<MojoHandleSignalsState> signals_states) { |
if (num_handles < 1) |
return MOJO_RESULT_INVALID_ARGUMENT; |
- if (num_handles > GetConfiguration().max_wait_many_num_handles) |
+ if (num_handles > kMaxWaitManyNumHandles) |
return MOJO_RESULT_RESOURCE_EXHAUSTED; |
UserPointer<const MojoHandle>::Reader handles_reader(handles, num_handles); |
@@ -151,17 +155,23 @@ |
MojoResult rv; |
if (signals_states.IsNull()) { |
rv = WaitManyInternal(handles_reader.GetPointer(), |
- signals_reader.GetPointer(), num_handles, deadline, |
- &index, nullptr); |
+ signals_reader.GetPointer(), |
+ num_handles, |
+ deadline, |
+ &index, |
+ nullptr); |
} else { |
UserPointer<MojoHandleSignalsState>::Writer signals_states_writer( |
signals_states, num_handles); |
// Note: The |reinterpret_cast| is safe, since |HandleSignalsState| is a |
// subclass of |MojoHandleSignalsState| that doesn't add any data members. |
rv = WaitManyInternal(handles_reader.GetPointer(), |
- signals_reader.GetPointer(), num_handles, deadline, |
- &index, reinterpret_cast<HandleSignalsState*>( |
- signals_states_writer.GetPointer())); |
+ signals_reader.GetPointer(), |
+ num_handles, |
+ deadline, |
+ &index, |
+ reinterpret_cast<HandleSignalsState*>( |
+ signals_states_writer.GetPointer())); |
if (rv != MOJO_RESULT_INVALID_ARGUMENT) |
signals_states_writer.Commit(); |
} |
@@ -236,7 +246,7 @@ |
// validity, even for dispatchers that don't support |WriteMessage()| and will |
// simply return failure unconditionally. It also breaks the usual |
// left-to-right verification order of arguments.) |
- if (num_handles > GetConfiguration().max_message_num_handles) |
+ if (num_handles > kMaxMessageNumHandles) |
return MOJO_RESULT_RESOURCE_EXHAUSTED; |
UserPointer<const MojoHandle>::Reader handles_reader(handles, num_handles); |
@@ -253,9 +263,11 @@ |
// handles from the handle table. |
{ |
base::AutoLock locker(handle_table_lock_); |
- MojoResult result = handle_table_.MarkBusyAndStartTransport( |
- message_pipe_handle, handles_reader.GetPointer(), num_handles, |
- &transports); |
+ MojoResult result = |
+ handle_table_.MarkBusyAndStartTransport(message_pipe_handle, |
+ handles_reader.GetPointer(), |
+ num_handles, |
+ &transports); |
if (result != MOJO_RESULT_OK) |
return result; |
} |
@@ -296,12 +308,12 @@ |
MojoResult rv; |
if (num_handles_value == 0) { |
// Easy case: won't receive any handles. |
- rv = dispatcher->ReadMessage(bytes, num_bytes, nullptr, &num_handles_value, |
- flags); |
+ rv = dispatcher->ReadMessage( |
+ bytes, num_bytes, nullptr, &num_handles_value, flags); |
} else { |
DispatcherVector dispatchers; |
- rv = dispatcher->ReadMessage(bytes, num_bytes, &dispatchers, |
- &num_handles_value, flags); |
+ rv = dispatcher->ReadMessage( |
+ bytes, num_bytes, &dispatchers, &num_handles_value, flags); |
if (!dispatchers.empty()) { |
DCHECK_EQ(rv, MOJO_RESULT_OK); |
DCHECK(!num_handles.IsNull()); |
@@ -454,8 +466,8 @@ |
return result; |
scoped_refptr<SharedBufferDispatcher> dispatcher; |
- result = SharedBufferDispatcher::Create(platform_support(), validated_options, |
- num_bytes, &dispatcher); |
+ result = SharedBufferDispatcher::Create( |
+ platform_support(), validated_options, num_bytes, &dispatcher); |
if (result != MOJO_RESULT_OK) { |
DCHECK(!dispatcher.get()); |
return result; |