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

Side by Side Diff: base/run_loop.h

Issue 10689161: Adds MessageLoopUIApplication for use on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
« base/message_pump_mac.mm ('K') | « base/message_pump_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 BASE_RUN_LOOP_H_ 5 #ifndef BASE_RUN_LOOP_H_
6 #define BASE_RUN_LOOP_H_ 6 #define BASE_RUN_LOOP_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_export.h" 9 #include "base/base_export.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 13
14 namespace base { 14 namespace base {
15 #if defined(OS_ANDROID) 15 #if defined(OS_ANDROID)
16 class MessagePumpForUI; 16 class MessagePumpForUI;
17 #endif 17 #endif
18 18
19 #if defined(OS_IOS)
20 class MessagePumpUIApplication;
21 #endif
22
19 // Helper class to Run a nested MessageLoop. Please do not use nested 23 // Helper class to Run a nested MessageLoop. Please do not use nested
20 // MessageLoops in production code! If you must, use this class instead of 24 // MessageLoops in production code! If you must, use this class instead of
21 // calling MessageLoop::Run/Quit directly. RunLoop::Run can only be called once 25 // calling MessageLoop::Run/Quit directly. RunLoop::Run can only be called once
22 // per RunLoop lifetime. Create a RunLoop on the stack and call Run/Quit to run 26 // per RunLoop lifetime. Create a RunLoop on the stack and call Run/Quit to run
23 // a nested MessageLoop. 27 // a nested MessageLoop.
24 class BASE_EXPORT RunLoop { 28 class BASE_EXPORT RunLoop {
25 public: 29 public:
26 RunLoop(); 30 RunLoop();
27 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 31 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
28 explicit RunLoop(MessageLoop::Dispatcher* dispatcher); 32 explicit RunLoop(MessageLoop::Dispatcher* dispatcher);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::Closure QuitClosure(); 74 base::Closure QuitClosure();
71 75
72 private: 76 private:
73 friend class ::MessageLoop; 77 friend class ::MessageLoop;
74 #if defined(OS_ANDROID) 78 #if defined(OS_ANDROID)
75 // Android doesn't support the blocking MessageLoop::Run, so it calls 79 // Android doesn't support the blocking MessageLoop::Run, so it calls
76 // BeforeRun and AfterRun directly. 80 // BeforeRun and AfterRun directly.
77 friend class base::MessagePumpForUI; 81 friend class base::MessagePumpForUI;
78 #endif 82 #endif
79 83
84 #if defined(OS_IOS)
85 // iOS doesn't support the blocking MessageLoop::Run, so it calls
86 // BeforeRun directly.
87 friend class base::MessagePumpUIApplication;
88 #endif
89
80 // Return false to abort the Run. 90 // Return false to abort the Run.
81 bool BeforeRun(); 91 bool BeforeRun();
82 void AfterRun(); 92 void AfterRun();
83 93
84 MessageLoop* loop_; 94 MessageLoop* loop_;
85 95
86 // WeakPtrFactory for QuitClosure safety. 96 // WeakPtrFactory for QuitClosure safety.
87 base::WeakPtrFactory<RunLoop> weak_factory_; 97 base::WeakPtrFactory<RunLoop> weak_factory_;
88 98
89 // Parent RunLoop or NULL if this is the top-most RunLoop. 99 // Parent RunLoop or NULL if this is the top-most RunLoop.
(...skipping 13 matching lines...) Expand all
103 // Used to record that QuitWhenIdle() was called on the MessageLoop, meaning 113 // Used to record that QuitWhenIdle() was called on the MessageLoop, meaning
104 // that we should quit Run once it becomes idle. 114 // that we should quit Run once it becomes idle.
105 bool quit_when_idle_received_; 115 bool quit_when_idle_received_;
106 116
107 DISALLOW_COPY_AND_ASSIGN(RunLoop); 117 DISALLOW_COPY_AND_ASSIGN(RunLoop);
108 }; 118 };
109 119
110 } // namespace base 120 } // namespace base
111 121
112 #endif // BASE_RUN_LOOP_H_ 122 #endif // BASE_RUN_LOOP_H_
OLDNEW
« base/message_pump_mac.mm ('K') | « base/message_pump_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698