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

Side by Side Diff: mojo/public/cpp/utility/run_loop.h

Issue 345463003: Mojo: MojoWaitFlags -> MojoHandleSignals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/public/cpp/utility/lib/run_loop.cc ('k') | mojo/public/js/bindings/core.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ 5 #ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
6 #define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ 6 #define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "mojo/public/cpp/system/core.h" 10 #include "mojo/public/cpp/system/core.h"
(...skipping 15 matching lines...) Expand all
26 static void TearDown(); 26 static void TearDown();
27 27
28 // Returns the RunLoop for the current thread. Returns NULL if not yet 28 // Returns the RunLoop for the current thread. Returns NULL if not yet
29 // created. 29 // created.
30 static RunLoop* current(); 30 static RunLoop* current();
31 31
32 // Registers a RunLoopHandler for the specified handle. Only one handler can 32 // Registers a RunLoopHandler for the specified handle. Only one handler can
33 // be registered for a specified handle. 33 // be registered for a specified handle.
34 void AddHandler(RunLoopHandler* handler, 34 void AddHandler(RunLoopHandler* handler,
35 const Handle& handle, 35 const Handle& handle,
36 MojoWaitFlags wait_flags, 36 MojoHandleSignals handle_signals,
37 MojoDeadline deadline); 37 MojoDeadline deadline);
38 void RemoveHandler(const Handle& handle); 38 void RemoveHandler(const Handle& handle);
39 bool HasHandler(const Handle& handle) const; 39 bool HasHandler(const Handle& handle) const;
40 40
41 // Runs the loop servicing handles as they are ready. This returns when Quit() 41 // Runs the loop servicing handles as they are ready. This returns when Quit()
42 // is invoked, or there no more handles. 42 // is invoked, or there no more handles.
43 void Run(); 43 void Run();
44 44
45 // Runs the loop servicing any handles that are ready. Does not wait for 45 // Runs the loop servicing any handles that are ready. Does not wait for
46 // handles to become ready before returning. Returns early if Quit() is 46 // handles to become ready before returning. Returns early if Quit() is
47 // invoked. 47 // invoked.
48 void RunUntilIdle(); 48 void RunUntilIdle();
49 49
50 void Quit(); 50 void Quit();
51 51
52 private: 52 private:
53 struct RunState; 53 struct RunState;
54 struct WaitState; 54 struct WaitState;
55 55
56 // Contains the data needed to track a request to AddHandler(). 56 // Contains the data needed to track a request to AddHandler().
57 struct HandlerData { 57 struct HandlerData {
58 HandlerData() 58 HandlerData()
59 : handler(NULL), 59 : handler(NULL),
60 wait_flags(MOJO_WAIT_FLAG_NONE), 60 handle_signals(MOJO_WAIT_FLAG_NONE),
61 deadline(0), 61 deadline(0),
62 id(0) {} 62 id(0) {}
63 63
64 RunLoopHandler* handler; 64 RunLoopHandler* handler;
65 MojoWaitFlags wait_flags; 65 MojoHandleSignals handle_signals;
66 MojoTimeTicks deadline; 66 MojoTimeTicks deadline;
67 // See description of |RunLoop::next_handler_id_| for details. 67 // See description of |RunLoop::next_handler_id_| for details.
68 int id; 68 int id;
69 }; 69 };
70 70
71 typedef std::map<Handle, HandlerData> HandleToHandlerData; 71 typedef std::map<Handle, HandlerData> HandleToHandlerData;
72 72
73 // Waits for a handle to be ready. Returns after servicing at least one 73 // Waits for a handle to be ready. Returns after servicing at least one
74 // handle (or there are no more handles) unless |non_blocking| is true, 74 // handle (or there are no more handles) unless |non_blocking| is true,
75 // in which case it will also return if servicing at least one handle 75 // in which case it will also return if servicing at least one handle
(...skipping 23 matching lines...) Expand all
99 // match it means the handler was removed then added so that we shouldn't 99 // match it means the handler was removed then added so that we shouldn't
100 // notify it. 100 // notify it.
101 int next_handler_id_; 101 int next_handler_id_;
102 102
103 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); 103 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop);
104 }; 104 };
105 105
106 } // namespace mojo 106 } // namespace mojo
107 107
108 #endif // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ 108 #endif // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/utility/lib/run_loop.cc ('k') | mojo/public/js/bindings/core.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698