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

Side by Side Diff: base/message_pump_win.h

Issue 10831271: [Chromoting] Adding uiAccess='true' to the remoting_me2me_host.exe's manifest as it is required to … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 4 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
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_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 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 // MessagePump methods: 290 // MessagePump methods:
291 virtual void ScheduleWork(); 291 virtual void ScheduleWork();
292 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); 292 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
293 293
294 // Register the handler to be used when asynchronous IO for the given file 294 // Register the handler to be used when asynchronous IO for the given file
295 // completes. The registration persists as long as |file_handle| is valid, so 295 // completes. The registration persists as long as |file_handle| is valid, so
296 // |handler| must be valid as long as there is pending IO for the given file. 296 // |handler| must be valid as long as there is pending IO for the given file.
297 void RegisterIOHandler(HANDLE file_handle, IOHandler* handler); 297 void RegisterIOHandler(HANDLE file_handle, IOHandler* handler);
298 298
299 // Register the handler to be used to process job events. The registration
300 // persists as long as the job object is live, so |handler| must be valid
301 // until the job object is destroyed. Returns true if the registration
302 // succeeded, and false otherwise.
303 bool RegisterJobObject(HANDLE job_handle, IOHandler* handler);
304
299 // Waits for the next IO completion that should be processed by |filter|, for 305 // Waits for the next IO completion that should be processed by |filter|, for
300 // up to |timeout| milliseconds. Return true if any IO operation completed, 306 // up to |timeout| milliseconds. Return true if any IO operation completed,
301 // regardless of the involved handler, and false if the timeout expired. If 307 // regardless of the involved handler, and false if the timeout expired. If
302 // the completion port received any message and the involved IO handler 308 // the completion port received any message and the involved IO handler
303 // matches |filter|, the callback is called before returning from this code; 309 // matches |filter|, the callback is called before returning from this code;
304 // if the handler is not the one that we are looking for, the callback will 310 // if the handler is not the one that we are looking for, the callback will
305 // be postponed for another time, so reentrancy problems can be avoided. 311 // be postponed for another time, so reentrancy problems can be avoided.
306 // External use of this method should be reserved for the rare case when the 312 // External use of this method should be reserved for the rare case when the
307 // caller is willing to allow pausing regular task dispatching on this thread. 313 // caller is willing to allow pausing regular task dispatching on this thread.
308 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); 314 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter);
309 315
310 void AddIOObserver(IOObserver* obs); 316 void AddIOObserver(IOObserver* obs);
311 void RemoveIOObserver(IOObserver* obs); 317 void RemoveIOObserver(IOObserver* obs);
312 318
313 private: 319 private:
314 struct IOItem { 320 struct IOItem {
315 IOHandler* handler; 321 IOHandler* handler;
316 IOContext* context; 322 IOContext* context;
317 DWORD bytes_transfered; 323 DWORD bytes_transfered;
318 DWORD error; 324 DWORD error;
325
326 // In some cases |context| can be a non-pointer value casted to a pointer.
327 // |has_valid_io_context| is true if |context| is a valid IOContext
328 // pointer, and false otherwise.
329 bool has_valid_io_context;
319 }; 330 };
320 331
321 virtual void DoRunLoop(); 332 virtual void DoRunLoop();
322 void WaitForWork(); 333 void WaitForWork();
323 bool MatchCompletedIOItem(IOHandler* filter, IOItem* item); 334 bool MatchCompletedIOItem(IOHandler* filter, IOItem* item);
324 bool GetIOItem(DWORD timeout, IOItem* item); 335 bool GetIOItem(DWORD timeout, IOItem* item);
325 bool ProcessInternalIOItem(const IOItem& item); 336 bool ProcessInternalIOItem(const IOItem& item);
326 void WillProcessIOEvent(); 337 void WillProcessIOEvent();
327 void DidProcessIOEvent(); 338 void DidProcessIOEvent();
328 339
340 // Converts an IOHandler pointer to a completion port key.
341 // |has_valid_io_context| specifies whether completion packets posted to
342 // |handler| will have valid OVERLAPPED pointers.
343 static ULONG_PTR HandlerToKey(IOHandler* handler, bool has_valid_io_context);
344
345 // Converts a completion port key to an IOHandler pointer.
346 static IOHandler* KeyToHandler(ULONG_PTR key, bool* has_valid_io_context);
347
329 // The completion port associated with this thread. 348 // The completion port associated with this thread.
330 win::ScopedHandle port_; 349 win::ScopedHandle port_;
331 // This list will be empty almost always. It stores IO completions that have 350 // This list will be empty almost always. It stores IO completions that have
332 // not been delivered yet because somebody was doing cleanup. 351 // not been delivered yet because somebody was doing cleanup.
333 std::list<IOItem> completed_io_; 352 std::list<IOItem> completed_io_;
334 353
335 ObserverList<IOObserver> io_observers_; 354 ObserverList<IOObserver> io_observers_;
336 }; 355 };
337 356
338 } // namespace base 357 } // namespace base
339 358
340 #endif // BASE_MESSAGE_PUMP_WIN_H_ 359 #endif // BASE_MESSAGE_PUMP_WIN_H_
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_win.cc » ('j') | base/message_pump_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698