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

Side by Side Diff: base/message_pump_win.h

Issue 6736019: Base: A few more files using BASE_API (for base.dll) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 | « base/message_pump.h ('k') | base/metrics/histogram.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MESSAGE_PUMP_WIN_H_ 5 #ifndef BASE_MESSAGE_PUMP_WIN_H_
6 #define BASE_MESSAGE_PUMP_WIN_H_ 6 #define BASE_MESSAGE_PUMP_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include <list> 11 #include <list>
12 12
13 #include "base/base_api.h"
13 #include "base/basictypes.h" 14 #include "base/basictypes.h"
14 #include "base/message_pump.h" 15 #include "base/message_pump.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "base/time.h" 17 #include "base/time.h"
17 #include "base/win/scoped_handle.h" 18 #include "base/win/scoped_handle.h"
18 19
19 namespace base { 20 namespace base {
20 21
21 // MessagePumpWin serves as the base for specialized versions of the MessagePump 22 // MessagePumpWin serves as the base for specialized versions of the MessagePump
22 // for Windows. It provides basic functionality like handling of observers and 23 // for Windows. It provides basic functionality like handling of observers and
23 // controlling the lifetime of the message pump. 24 // controlling the lifetime of the message pump.
24 class MessagePumpWin : public MessagePump { 25 class BASE_API MessagePumpWin : public MessagePump {
25 public: 26 public:
26 // An Observer is an object that receives global notifications from the 27 // An Observer is an object that receives global notifications from the
27 // UI MessageLoop. 28 // UI MessageLoop.
28 // 29 //
29 // NOTE: An Observer implementation should be extremely fast! 30 // NOTE: An Observer implementation should be extremely fast!
30 // 31 //
31 class Observer { 32 class Observer {
32 public: 33 public:
33 virtual ~Observer() {} 34 virtual ~Observer() {}
34 35
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // kMsgHaveWork messages. As a result, care is taken to do some peeking in 150 // kMsgHaveWork messages. As a result, care is taken to do some peeking in
150 // between the posting of each kMsgHaveWork message (i.e., after kMsgHaveWork 151 // between the posting of each kMsgHaveWork message (i.e., after kMsgHaveWork
151 // is peeked, and before a replacement kMsgHaveWork is posted). 152 // is peeked, and before a replacement kMsgHaveWork is posted).
152 // 153 //
153 // NOTE: Although it may seem odd that messages are used to start and stop this 154 // NOTE: Although it may seem odd that messages are used to start and stop this
154 // flow (as opposed to signaling objects, etc.), it should be understood that 155 // flow (as opposed to signaling objects, etc.), it should be understood that
155 // the native message pump will *only* respond to messages. As a result, it is 156 // the native message pump will *only* respond to messages. As a result, it is
156 // an excellent choice. It is also helpful that the starter messages that are 157 // an excellent choice. It is also helpful that the starter messages that are
157 // placed in the queue when new task arrive also awakens DoRunLoop. 158 // placed in the queue when new task arrive also awakens DoRunLoop.
158 // 159 //
159 class MessagePumpForUI : public MessagePumpWin { 160 class BASE_API MessagePumpForUI : public MessagePumpWin {
160 public: 161 public:
161 // The application-defined code passed to the hook procedure. 162 // The application-defined code passed to the hook procedure.
162 static const int kMessageFilterCode = 0x5001; 163 static const int kMessageFilterCode = 0x5001;
163 164
164 MessagePumpForUI(); 165 MessagePumpForUI();
165 virtual ~MessagePumpForUI(); 166 virtual ~MessagePumpForUI();
166 167
167 // MessagePump methods: 168 // MessagePump methods:
168 virtual void ScheduleWork(); 169 virtual void ScheduleWork();
169 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); 170 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
(...skipping 18 matching lines...) Expand all
188 // A hidden message-only window. 189 // A hidden message-only window.
189 HWND message_hwnd_; 190 HWND message_hwnd_;
190 }; 191 };
191 192
192 //----------------------------------------------------------------------------- 193 //-----------------------------------------------------------------------------
193 // MessagePumpForIO extends MessagePumpWin with methods that are particular to a 194 // MessagePumpForIO extends MessagePumpWin with methods that are particular to a
194 // MessageLoop instantiated with TYPE_IO. This version of MessagePump does not 195 // MessageLoop instantiated with TYPE_IO. This version of MessagePump does not
195 // deal with Windows mesagges, and instead has a Run loop based on Completion 196 // deal with Windows mesagges, and instead has a Run loop based on Completion
196 // Ports so it is better suited for IO operations. 197 // Ports so it is better suited for IO operations.
197 // 198 //
198 class MessagePumpForIO : public MessagePumpWin { 199 class BASE_API MessagePumpForIO : public MessagePumpWin {
199 public: 200 public:
200 struct IOContext; 201 struct IOContext;
201 202
202 // Clients interested in receiving OS notifications when asynchronous IO 203 // Clients interested in receiving OS notifications when asynchronous IO
203 // operations complete should implement this interface and register themselves 204 // operations complete should implement this interface and register themselves
204 // with the message pump. 205 // with the message pump.
205 // 206 //
206 // Typical use #1: 207 // Typical use #1:
207 // // Use only when there are no user's buffers involved on the actual IO, 208 // // Use only when there are no user's buffers involved on the actual IO,
208 // // so that all the cleanup can be done by the message pump. 209 // // so that all the cleanup can be done by the message pump.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // This list will be empty almost always. It stores IO completions that have 361 // This list will be empty almost always. It stores IO completions that have
361 // not been delivered yet because somebody was doing cleanup. 362 // not been delivered yet because somebody was doing cleanup.
362 std::list<IOItem> completed_io_; 363 std::list<IOItem> completed_io_;
363 364
364 ObserverList<IOObserver> io_observers_; 365 ObserverList<IOObserver> io_observers_;
365 }; 366 };
366 367
367 } // namespace base 368 } // namespace base
368 369
369 #endif // BASE_MESSAGE_PUMP_WIN_H_ 370 #endif // BASE_MESSAGE_PUMP_WIN_H_
OLDNEW
« no previous file with comments | « base/message_pump.h ('k') | base/metrics/histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698