Chromium Code Reviews| Index: mojo/examples/sample_app/sample_app.cc |
| diff --git a/mojo/examples/sample_app/sample_app.cc b/mojo/examples/sample_app/sample_app.cc |
| index 820bdd4d95fbdca8fe666eb538ad1e16bd1e506c..f1d18f8f4387c5f7594b60dc71f45f483fb9fb5f 100644 |
| --- a/mojo/examples/sample_app/sample_app.cc |
| +++ b/mojo/examples/sample_app/sample_app.cc |
| @@ -4,8 +4,8 @@ |
| #include <stdio.h> |
| -#include "base/basictypes.h" |
| #include "mojo/public/system/core.h" |
| +#include "mojo/public/system/macros.h" |
|
Ben Goodger (Google)
2013/10/29 21:34:41
I noticed that this app need not depend on base at
|
| #include "mojo/system/core_impl.h" |
| #if defined(OS_WIN) |
| @@ -39,7 +39,8 @@ char* ReadStringFromPipe(mojo::Handle pipe) { |
| class SampleMessageWaiter { |
| public: |
| - explicit SampleMessageWaiter(mojo::Handle pipe) : pipe_(pipe) {} |
| + explicit SampleMessageWaiter(mojo::Handle pipe) |
| + : pipe_(pipe), running_(false) {} |
| ~SampleMessageWaiter() {} |
| void Read() { |
| @@ -52,18 +53,23 @@ class SampleMessageWaiter { |
| } |
| void WaitAndRead() { |
| - MojoResult result = mojo::Wait(pipe_, MOJO_WAIT_FLAG_READABLE, 100); |
| - if (result < MOJO_RESULT_OK) { |
| - // Failure... |
| - } |
| - |
| - Read(); |
| + running_ = true; |
|
abarth-chromium
2013/10/29 21:48:44
Do we want to set running_ to false at some point?
|
| + do { |
| + MojoResult result = mojo::Wait(pipe_, MOJO_WAIT_FLAG_READABLE, 100); |
| + if (result < MOJO_RESULT_OK) { |
| + // Failure... |
| + } |
| + Read(); |
| + } while (running_); |
| + // TODO: quit, etc. i.e. real MessageLoop. |
| } |
| private: |
| mojo::Handle pipe_; |
| - DISALLOW_COPY_AND_ASSIGN(SampleMessageWaiter); |
| + bool running_; |
| + |
| + MOJO_DISALLOW_COPY_AND_ASSIGN(SampleMessageWaiter); |
| }; |
| extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( |