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

Unified Diff: remoting/client/jni/jni_frame_consumer.h

Issue 1288063004: Simplify FrameConsumer interface. Remove FrameProducer interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.cc ('k') | remoting/client/jni/jni_frame_consumer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/jni_frame_consumer.h
diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h
index a9a036196acca0dc58b121f624b1028658462326..5a9f7e6394071142f7447245b9397547a1e7040c 100644
--- a/remoting/client/jni/jni_frame_consumer.h
+++ b/remoting/client/jni/jni_frame_consumer.h
@@ -7,80 +7,43 @@
#include <list>
-#include "base/android/scoped_java_ref.h"
#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "remoting/client/frame_consumer.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
-namespace gfx {
-class JavaBitmap;
-} // namespace gfx
-
-namespace webrtc {
-class DesktopFrame;
-} // namespace webrtc
-
namespace remoting {
-class ChromotingJniInstance;
+
class ChromotingJniRuntime;
-class FrameProducer;
// FrameConsumer implementation that draws onto a JNI direct byte buffer.
class JniFrameConsumer : public FrameConsumer {
public:
- // The instance does not take ownership of |jni_runtime|.
- explicit JniFrameConsumer(ChromotingJniRuntime* jni_runtime,
- scoped_refptr<ChromotingJniInstance> jni_instance);
+ // Does not take ownership of |jni_runtime|.
+ explicit JniFrameConsumer(ChromotingJniRuntime* jni_runtime);
~JniFrameConsumer() override;
- // This must be called once before the producer's source size is set.
- void set_frame_producer(FrameProducer* producer);
-
// FrameConsumer implementation.
- void ApplyBuffer(const webrtc::DesktopSize& view_size,
- const webrtc::DesktopRect& clip_area,
- webrtc::DesktopFrame* buffer,
- const webrtc::DesktopRegion& region,
- const webrtc::DesktopRegion* shape) override;
- void ReturnBuffer(webrtc::DesktopFrame* buffer) override;
- void SetSourceSize(const webrtc::DesktopSize& source_size,
- const webrtc::DesktopVector& dpi) override;
+ scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+ const webrtc::DesktopSize& size) override;
+ void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+ const base::Closure& done) override;
PixelFormat GetPixelFormat() override;
private:
- // Allocates a new buffer of |source_size|, informs Java about it, and tells
- // the producer to draw onto it.
- void AllocateBuffer(const webrtc::DesktopSize& source_size);
+ class Renderer;
- // Frees a frame buffer previously allocated by AllocateBuffer.
- void FreeBuffer(webrtc::DesktopFrame* buffer);
-
- // Variables are to be used from the display thread.
+ void OnFrameRendered(const base::Closure& done);
// Used to obtain task runner references and make calls to Java methods.
ChromotingJniRuntime* jni_runtime_;
- // Used to record statistics.
- scoped_refptr<ChromotingJniInstance> jni_instance_;
-
- FrameProducer* frame_producer_;
- webrtc::DesktopRect clip_area_;
-
- // List of allocated image buffers.
- std::list<webrtc::DesktopFrame*> buffers_;
-
- // This global reference is required, instead of a local reference, so it
- // remains valid for the lifetime of |bitmap_| - gfx::JavaBitmap does not
- // create its own global reference internally. And this global ref must be
- // destroyed (released) after |bitmap_| is destroyed.
- base::android::ScopedJavaGlobalRef<jobject> bitmap_global_ref_;
+ // Renderer object used to render the frames on the display thread.
+ scoped_ptr<Renderer> renderer_;
- // Reference to the frame bitmap that is passed to Java when the frame is
- // allocated. This provides easy access to the underlying pixels.
- scoped_ptr<gfx::JavaBitmap> bitmap_;
+ base::WeakPtrFactory<JniFrameConsumer> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer);
};
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.cc ('k') | remoting/client/jni/jni_frame_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698