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

Side by Side Diff: mojo/edk/platform/message_loop.h

Issue 1465203003: EDK: Make ConnectionManagerTest not use base::MessageLoop/RunLoop. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « mojo/edk/base_edk/platform_message_loop_impl_unittest.cc ('k') | mojo/edk/system/BUILD.gn » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This file provides an interface for "message loops", which are used within 5 // This file provides an interface for "message loops", which are used within
6 // the EDK itself. 6 // the EDK itself.
7 7
8 #ifndef MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_ 8 #ifndef MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_
9 #define MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_ 9 #define MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_
10 10
(...skipping 10 matching lines...) Expand all
21 // methods may only be called on the thread it was created on (the |MessageLoop| 21 // methods may only be called on the thread it was created on (the |MessageLoop|
22 // is said to "belong to" that thread). 22 // is said to "belong to" that thread).
23 // 23 //
24 // In general, the result of running a |MessageLoop| "inside" a |MessageLoop| 24 // In general, the result of running a |MessageLoop| "inside" a |MessageLoop|
25 // (whether the same one -- the classic "nested message loop" case -- or a 25 // (whether the same one -- the classic "nested message loop" case -- or a
26 // different one) is implementation-defined. 26 // different one) is implementation-defined.
27 class MessageLoop { 27 class MessageLoop {
28 public: 28 public:
29 virtual ~MessageLoop() {} 29 virtual ~MessageLoop() {}
30 30
31 // Runs the message loop until it is told to quit (via |QuitWhenIdle()|). 31 // Runs the message loop until it is told to quit (via |QuitNow() or
32 // |QuitWhenIdle()|).
32 virtual void Run() = 0; 33 virtual void Run() = 0;
33 34
34 // Runs the message loop until there are no more tasks available to execute 35 // Runs the message loop until there are no more tasks available to execute
35 // immediately (i.e., not including delayed tasks). 36 // immediately (i.e., not including delayed tasks).
36 virtual void RunUntilIdle() = 0; 37 virtual void RunUntilIdle() = 0;
37 38
38 // Quits the message loop when there are no more tasks available to execute 39 // If running, quits the message loop when there are no more tasks available
39 // immediately. (Note that this includes "future" tasks, i.e., those that are 40 // to execute immediately. (Note that this includes "future" tasks, i.e.,
40 // posted as a result of executing other tasks, so this may never quit. 41 // those that are posted as a result of executing other tasks, so this may
41 // However, it does not include delayed tasks.) 42 // never quit. However, it does not include delayed tasks.)
42 // TODO(vtl): Do we also want a |QuitNow()|?
43 virtual void QuitWhenIdle() = 0; 43 virtual void QuitWhenIdle() = 0;
44 44
45 // If running, quits the message loop now (i.e., do not process any further
46 // tasks until |Run()| or |RunUntilIdle()|) is called again.
47 virtual void QuitNow() = 0;
48
45 // Gets the |TaskRunner| for this message loop, which can be used to post 49 // Gets the |TaskRunner| for this message loop, which can be used to post
46 // tasks to it. For a given |MessageLoop| instance, this will always return a 50 // tasks to it. For a given |MessageLoop| instance, this will always return a
47 // reference to the same |TaskRunner| (and different |MessageLoop| instances 51 // reference to the same |TaskRunner| (and different |MessageLoop| instances
48 // have different |TaskRunner|s). This may be called from any thread (and 52 // have different |TaskRunner|s). This may be called from any thread (and
49 // returned |TaskRunner| is also thread-safe). 53 // returned |TaskRunner| is also thread-safe).
50 // 54 //
51 // Note: The returned |TaskRunner| should only claim to run tasks on the 55 // Note: The returned |TaskRunner| should only claim to run tasks on the
52 // thread which this message loop belongs to. 56 // thread which this message loop belongs to.
53 virtual const mojo::util::RefPtr<TaskRunner>& GetTaskRunner() const = 0; 57 virtual const mojo::util::RefPtr<TaskRunner>& GetTaskRunner() const = 0;
54 58
(...skipping 11 matching lines...) Expand all
66 MessageLoop() {} 70 MessageLoop() {}
67 71
68 private: 72 private:
69 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageLoop); 73 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageLoop);
70 }; 74 };
71 75
72 } // namespace platform 76 } // namespace platform
73 } // namespace mojo 77 } // namespace mojo
74 78
75 #endif // MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_ 79 #endif // MOJO_EDK_PLATFORM_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « mojo/edk/base_edk/platform_message_loop_impl_unittest.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698