Chromium Code Reviews| Index: remoting/protocol/authenticator.h |
| diff --git a/remoting/protocol/authenticator.h b/remoting/protocol/authenticator.h |
| index b8aa37d4544220d010195f63a2e89be64f09f126..a3d81ff0ad0e5aa6fa43eb0b8195c7cd66fdaf89 100644 |
| --- a/remoting/protocol/authenticator.h |
| +++ b/remoting/protocol/authenticator.h |
| @@ -7,6 +7,7 @@ |
| #include <string> |
| +#include "base/callback.h" |
| #include "base/memory/scoped_ptr.h" |
| namespace buzz { |
| @@ -38,6 +39,7 @@ class Authenticator { |
| // WAITING_MESSAGE -> MESSAGE_READY |
| // WAITING_MESSAGE -> ACCEPTED |
| // WAITING_MESSAGE -> REJECTED |
| + // WAITING_MESSAGE -> PROCESSING_MESSAGE -> MESSAGE_READY |
| // When GetNextMessage() is called: |
| // MESSAGE_READY -> WAITING_MESSAGE |
| // MESSAGE_READY -> ACCEPTED |
| @@ -53,6 +55,9 @@ class Authenticator { |
| // Session is rejected. |
| REJECTED, |
| + |
| + // Asynchronously processing the last message from the peer. |
| + PROCESSING_MESSAGE, |
|
rmsousa
2013/02/28 23:29:23
The current code always processes messages synchro
|
| }; |
| enum RejectionReason { |
| @@ -81,9 +86,12 @@ class Authenticator { |
| virtual RejectionReason rejection_reason() const = 0; |
| // Called in response to incoming message received from the peer. |
| - // Should only be called when in WAITING_MESSAGE state. Caller |
| - // retains ownership of |message|. |
| - virtual void ProcessMessage(const buzz::XmlElement* message) = 0; |
| + // Should only be called when in WAITING_MESSAGE state. Caller retains |
| + // ownership of |message|. |resume_callback| will be called when processing is |
| + // finished. The implementation must guarantee that |resume_callback| is not |
| + // called after the Authenticator is destroyed. |
| + virtual void ProcessMessage(const base::Closure& resume_callback, |
| + const buzz::XmlElement* message) = 0; |
| // Must be called when in MESSAGE_READY state. Returns next |
| // authentication message that needs to be sent to the peer. |