diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 22:56:04 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 22:56:04 +0000 |
commit | e295ff0698eda75aa7e2b887362310df59ff559e (patch) | |
tree | 371a61e5da9e5c572ef40045937d6548fbcae6e3 /remoting/client/decoder.h | |
parent | 0a33b90c45a0b1a139e3a655666ba337ecb600b0 (diff) | |
download | chromium_src-e295ff0698eda75aa7e2b887362310df59ff559e.zip chromium_src-e295ff0698eda75aa7e2b887362310df59ff559e.tar.gz chromium_src-e295ff0698eda75aa7e2b887362310df59ff559e.tar.bz2 |
Changing UpdateStreamPacket protobuf definition for chromoting
This code also changes the API for encoder and ClientConnection to eliminate
one less copy.
Review URL: http://codereview.chromium.org/2963003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/decoder.h')
-rw-r--r-- | remoting/client/decoder.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/remoting/client/decoder.h b/remoting/client/decoder.h index ac2fe4d..4d083bd 100644 --- a/remoting/client/decoder.h +++ b/remoting/client/decoder.h @@ -57,9 +57,20 @@ class Decoder { // Give a HostMessage that contains the update stream packet that contains // the encoded data to the decoder. // The decoder will own |message| and is responsible for deleting it. + // // If the decoder has written something into |frame|, // |partial_decode_done_| is called with |frame| and updated regions. // Return true if the decoder can accept |message| and decode it. + // + // HostMessage returned by this method will contain a + // UpdateStreamPacketMessage. + // This message will contain either: + // 1. UpdateStreamBeginRect + // 2. UpdateStreamRectData + // 3. UpdateStreamEndRect + // + // See remoting/base/protocol/chromotocol.proto for more information about + // these messages. virtual bool PartialDecode(HostMessage* message) = 0; // Notify the decoder that we have received the last update stream packet. @@ -68,6 +79,34 @@ class Decoder { // If the update stream is not received fully and this method is called the // decoder should also call |decode_done_| as soon as possible. virtual void EndDecode() = 0; + + protected: + // Every decoder will have two internal states because there are three + // kinds of messages send to PartialDecode(). + // + // Here's a state diagram: + // + // UpdateStreamBeginRect UpdateStreamRectData + // .............. ............ + // . . . . + // . v . . + // kWaitingForBeginRect kWaitingForRectData . + // ^ . ^ . + // . . . . + // .............. ............ + // UpdateStreaEndRect + enum State { + // In this state the decoder is waiting for UpdateStreamBeginRect. + // After receiving UpdateStreaBeginRect, the encoder will transit to + // to kWaitingForRectData state. + kWaitingForBeginRect, + + // In this state the decoder is waiting for UpdateStreamRectData. + // The decode remains in this state if UpdateStreamRectData is received. + // The decoder will transit to kWaitingForBeginRect if UpdateStreamEndRect + // is received. + kWaitingForRectData, + }; }; } // namespace remoting |