Index: base/message_pump_win.h |
diff --git a/base/message_pump_win.h b/base/message_pump_win.h |
index e778e01fb2abab53971dd93b3cdb9780e080cecb..fd461988ed9527569ff66849983306c8c868e790 100644 |
--- a/base/message_pump_win.h |
+++ b/base/message_pump_win.h |
@@ -296,6 +296,12 @@ class BASE_EXPORT MessagePumpForIO : public MessagePumpWin { |
// |handler| must be valid as long as there is pending IO for the given file. |
void RegisterIOHandler(HANDLE file_handle, IOHandler* handler); |
+ // Register the handler to be used to process job events. The registration |
+ // persists as long as the job object is live, so |handler| must be valid |
+ // until the job object is destroyed. Returns true if the registration |
+ // succeeded, and false otherwise. |
+ bool RegisterJobObject(HANDLE job_handle, IOHandler* handler); |
+ |
// Waits for the next IO completion that should be processed by |filter|, for |
// up to |timeout| milliseconds. Return true if any IO operation completed, |
// regardless of the involved handler, and false if the timeout expired. If |
@@ -316,6 +322,11 @@ class BASE_EXPORT MessagePumpForIO : public MessagePumpWin { |
IOContext* context; |
DWORD bytes_transfered; |
DWORD error; |
+ |
+ // In some cases |context| can be a non-pointer value casted to a pointer. |
+ // |has_valid_io_context| is true if |context| is a valid IOContext |
+ // pointer, and false otherwise. |
+ bool has_valid_io_context; |
}; |
virtual void DoRunLoop(); |
@@ -326,6 +337,14 @@ class BASE_EXPORT MessagePumpForIO : public MessagePumpWin { |
void WillProcessIOEvent(); |
void DidProcessIOEvent(); |
+ // Converts an IOHandler pointer to a completion port key. |
+ // |has_valid_io_context| specifies whether completion packets posted to |
+ // |handler| will have valid OVERLAPPED pointers. |
+ static ULONG_PTR HandlerToKey(IOHandler* handler, bool has_valid_io_context); |
+ |
+ // Converts a completion port key to an IOHandler pointer. |
+ static IOHandler* KeyToHandler(ULONG_PTR key, bool* has_valid_io_context); |
+ |
// The completion port associated with this thread. |
win::ScopedHandle port_; |
// This list will be empty almost always. It stores IO completions that have |