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

Unified Diff: remoting/client/software_video_renderer.h

Issue 1236663002: Allow shaped-desktop hosts to send shape only when it changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify FrameConsumerProxy Created 5 years, 5 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/software_video_renderer.h
diff --git a/remoting/client/software_video_renderer.h b/remoting/client/software_video_renderer.h
index 11be6dc0eae679c7800a71911b722ed4798f1fb1..91af14d6488db141ec35be1bfcf0e8579735f553 100644
--- a/remoting/client/software_video_renderer.h
+++ b/remoting/client/software_video_renderer.h
@@ -7,8 +7,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "remoting/client/chromoting_stats.h"
-#include "remoting/client/frame_consumer_proxy.h"
+#include "remoting/client/frame_consumer.h"
#include "remoting/client/frame_producer.h"
#include "remoting/client/video_renderer.h"
#include "remoting/protocol/video_stub.h"
@@ -25,8 +26,7 @@ class ChromotingStats;
// Implementation of VideoRenderer interface that decodes frame on CPU (on a
// decode thread) and then passes decoded frames to a FrameConsumer.
// FrameProducer methods can be called on any thread. All other methods must be
-// called on the main thread. Owned must ensure that this class outlives
-// FrameConsumer (which calls FrameProducer interface).
+// called on the main thread.
class SoftwareVideoRenderer : public VideoRenderer,
public protocol::VideoStub,
public FrameProducer,
@@ -35,12 +35,13 @@ class SoftwareVideoRenderer : public VideoRenderer,
// Creates an update decoder on |main_task_runner_| and |decode_task_runner_|,
// outputting to |consumer|. The |main_task_runner_| is responsible for
// receiving and queueing packets. The |decode_task_runner_| is responsible
- // for decoding the video packets.
- // TODO(wez): Replace the ref-counted proxy with an owned FrameConsumer.
+ // for decoding the video packets. |consumer| must remain valid until the
+ // SoftwareVideoRenderer is destroyed, but the caller must also ensure that
+ // the |consumer| makes no more FrameProducer API calls beyond that point.
SoftwareVideoRenderer(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner,
- scoped_refptr<FrameConsumerProxy> consumer);
+ FrameConsumer* consumer);
~SoftwareVideoRenderer() override;
// VideoRenderer interface.
@@ -80,6 +81,9 @@ class SoftwareVideoRenderer : public VideoRenderer,
// Keep track of the latest event timestamp bounced back from the host.
int64 latest_event_timestamp_;
+ // Used to decouple the Core from the FrameConsumer during teardown.
+ base::WeakPtrFactory<FrameConsumer> weak_frame_consumer_;
+
base::WeakPtrFactory<SoftwareVideoRenderer> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SoftwareVideoRenderer);

Powered by Google App Engine
This is Rietveld 408576698