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

Unified Diff: mojo/examples/sample_app/sample_app.cc

Issue 51373002: NativeViewport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
« no previous file with comments | « no previous file | mojo/mojo.gyp » ('j') | mojo/services/native_viewport/native_viewport.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | mojo/mojo.gyp » ('j') | mojo/services/native_viewport/native_viewport.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698