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

Unified Diff: remoting/client/rectangle_update_decoder.h

Issue 10879085: Cleanup RectangleUpdateDecoder and VideoStub (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/rectangle_update_decoder.h
diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h
index af91267a6d0b6e80f5dbefccc3d4490c7acf1fa5..d248b68c6c11f230d196479dcdd3bd731d6daf5d 100644
--- a/remoting/client/rectangle_update_decoder.h
+++ b/remoting/client/rectangle_update_decoder.h
@@ -7,7 +7,7 @@
#include <list>
-#include "base/callback.h"
+#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/codec/video_decoder.h"
@@ -22,12 +22,11 @@ class SingleThreadTaskRunner;
namespace pp {
class ImageData;
-};
+} // namespace pp
namespace remoting {
class ChromotingStats;
-class VideoPacket;
namespace protocol {
class SessionConfig;
@@ -54,8 +53,8 @@ class RectangleUpdateDecoder
// Initializes decoder with the information from the protocol config.
void Initialize(const protocol::SessionConfig& config);
- // Removes all video packets in the queue.
- void DropAllPackets();
+ // Stop decoding of any pending video packets.
+ void Stop();
// FrameProducer implementation. These methods may be called before we are
// Initialize()d, or we know the source screen size.
@@ -68,20 +67,11 @@ class RectangleUpdateDecoder
// VideoStub implementation.
virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
const base::Closure& done) OVERRIDE;
- virtual int GetPendingVideoPackets() OVERRIDE;
// Return the stats recorded by this client.
ChromotingStats* GetStats();
private:
- struct QueuedVideoPacket {
- QueuedVideoPacket(scoped_ptr<VideoPacket> packet,
- const base::Closure& done);
- ~QueuedVideoPacket();
- VideoPacket* packet;
- base::Closure done;
- };
-
friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>;
virtual ~RectangleUpdateDecoder();
@@ -90,10 +80,6 @@ class RectangleUpdateDecoder
void SchedulePaint();
void DoPaint();
- // If a packet is not being processed, dispatches a single message from the
- // |received_packets_| queue.
- void ProcessNextPacket();
-
// Decodes the contents of |packet|. DecodePacket may keep a reference to
// |packet| so the |packet| must remain alive and valid until |done| is
// executed.
@@ -102,7 +88,9 @@ class RectangleUpdateDecoder
// Callback method when a VideoPacket is processed.
// If |last_packet| is true then |decode_start| contains the timestamp when
// the packet will start to be processed.
- void OnPacketDone(bool last_packet, base::Time decode_start);
+ void OnPacketDone(bool last_packet,
+ base::Time decode_start,
+ const base::Closure& done);
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_;
@@ -125,16 +113,8 @@ class RectangleUpdateDecoder
// Flag used to coalesce runs of SchedulePaint()s into a single DoPaint().
bool paint_scheduled_;
- // Contains all video packets that have been received, but have not yet been
- // processed.
- //
- // Used to serialize sending of messages to the client.
- // TODO(sergeyu): Simplify this code and remove this list.
- std::list<QueuedVideoPacket> received_packets_;
-
- // True if a message is being processed. Can be used to determine if it is
- // safe to dispatch another message.
- bool packet_being_processed_;
+ // Set to true after Stop() has been called.
Wez 2012/08/28 16:42:27 nit: True after Stop() has been called. The curren
Sergey Ulanov 2012/08/28 18:30:27 Done.
+ bool stopped_;
ChromotingStats stats_;

Powered by Google App Engine
This is Rietveld 408576698