| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ | 5 #ifndef REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ |
| 6 #define REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ | 6 #define REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ |
| 7 | 7 |
| 8 #include "remoting/client/frame_consumer.h" | 8 #include "remoting/client/frame_consumer.h" |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 12 | 11 |
| 13 namespace webrtc { | 12 namespace webrtc { |
| 14 class DesktopFrame; | 13 class DesktopFrame; |
| 15 } // namespace webrtc | 14 } // namespace webrtc |
| 16 | 15 |
| 17 namespace remoting { | 16 namespace remoting { |
| 18 class ChromotingJniRuntime; | 17 class ChromotingJniRuntime; |
| 19 class FrameProducer; | 18 class FrameProducer; |
| 20 | 19 |
| 21 // FrameConsumer implementation that draws onto a JNI direct byte buffer. | 20 // FrameConsumer implementation that draws onto a JNI direct byte buffer. |
| 22 class JniFrameConsumer : public FrameConsumer { | 21 class JniFrameConsumer : public FrameConsumer { |
| 23 public: | 22 public: |
| 24 // The instance does not take ownership of |jni_runtime|. | 23 // The instance does not take ownership of |jni_runtime|. |
| 25 explicit JniFrameConsumer(ChromotingJniRuntime* jni_runtime); | 24 explicit JniFrameConsumer(ChromotingJniRuntime* jni_runtime); |
| 26 | 25 |
| 27 virtual ~JniFrameConsumer(); | 26 virtual ~JniFrameConsumer(); |
| 28 | 27 |
| 29 // This must be called once before the producer's source size is set. | 28 // This must be called once before the producer's source size is set. |
| 30 void set_frame_producer(FrameProducer* producer); | 29 void set_frame_producer(FrameProducer* producer); |
| 31 | 30 |
| 32 // FrameConsumer implementation. | 31 // FrameConsumer implementation. |
| 33 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, | 32 virtual void ApplyBuffer(const SkISize& view_size, |
| 34 const webrtc::DesktopRect& clip_area, | 33 const SkIRect& clip_area, |
| 35 webrtc::DesktopFrame* buffer, | 34 webrtc::DesktopFrame* buffer, |
| 36 const webrtc::DesktopRegion& region) OVERRIDE; | 35 const SkRegion& region) OVERRIDE; |
| 37 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; | 36 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; |
| 38 virtual void SetSourceSize(const webrtc::DesktopSize& source_size, | 37 virtual void SetSourceSize(const SkISize& source_size, |
| 39 const webrtc::DesktopVector& dpi) OVERRIDE; | 38 const SkIPoint& dpi) OVERRIDE; |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 // Variables are to be used from the display thread. | 41 // Variables are to be used from the display thread. |
| 43 | 42 |
| 44 // Used to obtain task runner references and make calls to Java methods. | 43 // Used to obtain task runner references and make calls to Java methods. |
| 45 ChromotingJniRuntime* jni_runtime_; | 44 ChromotingJniRuntime* jni_runtime_; |
| 46 | 45 |
| 47 // Whether we're currently in the constructor, and should deallocate the | 46 // Whether we're currently in the constructor, and should deallocate the |
| 48 // buffer instead of passing it back to the producer. | 47 // buffer instead of passing it back to the producer. |
| 49 bool in_dtor_; | 48 bool in_dtor_; |
| 50 | 49 |
| 51 FrameProducer* frame_producer_; | 50 FrameProducer* frame_producer_; |
| 52 webrtc::DesktopSize view_size_; | 51 SkISize view_size_; |
| 53 webrtc::DesktopRect clip_area_; | 52 SkIRect clip_area_; |
| 54 | 53 |
| 55 // If |provide_buffer_|, allocates a new buffer of |view_size_|, informs | 54 // If |provide_buffer_|, allocates a new buffer of |view_size_|, informs |
| 56 // Java about it, and tells the producer to draw onto it. Otherwise, no-op. | 55 // Java about it, and tells the producer to draw onto it. Otherwise, no-op. |
| 57 void AllocateBuffer(); | 56 void AllocateBuffer(); |
| 58 | 57 |
| 59 DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer); | 58 DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer); |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 } // namespace remoting | 61 } // namespace remoting |
| 63 | 62 |
| 64 #endif | 63 #endif |
| OLD | NEW |