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 | 11 |
12 namespace webrtc { | 12 namespace webrtc { |
13 class DesktopFrame; | 13 class DesktopFrame; |
14 } // namespace webrtc | 14 } // namespace webrtc |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 class ChromotingJni; | 17 class ChromotingJni; |
18 class FrameProducer; | 18 class FrameProducer; |
19 | 19 |
20 // FrameConsumer implementation that draws onto a JNI direct byte buffer. | 20 // FrameConsumer implementation that draws onto a JNI direct byte buffer. |
21 class JniFrameConsumer : public FrameConsumer { | 21 class JniFrameConsumer : public FrameConsumer { |
22 public: | 22 public: |
23 JniFrameConsumer(); | 23 JniFrameConsumer(ChromotingJni* jni_environment); |
24 virtual ~JniFrameConsumer(); | 24 virtual ~JniFrameConsumer(); |
25 | 25 |
26 // This must be called once before the producer's source size is set. | 26 // This must be called once before the producer's source size is set. |
27 void set_frame_producer(FrameProducer* producer); | 27 void set_frame_producer(FrameProducer* producer); |
28 | 28 |
29 // FrameConsumer implementation. | 29 // FrameConsumer implementation. |
30 virtual void ApplyBuffer(const SkISize& view_size, | 30 virtual void ApplyBuffer(const SkISize& view_size, |
31 const SkIRect& clip_area, | 31 const SkIRect& clip_area, |
32 webrtc::DesktopFrame* buffer, | 32 webrtc::DesktopFrame* buffer, |
33 const SkRegion& region) OVERRIDE; | 33 const SkRegion& region) OVERRIDE; |
34 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; | 34 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; |
35 virtual void SetSourceSize(const SkISize& source_size, | 35 virtual void SetSourceSize(const SkISize& source_size, |
36 const SkIPoint& dpi) OVERRIDE; | 36 const SkIPoint& dpi) OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 // Variables are to be used from the display thread. | 39 // Variables are to be used from the display thread. |
40 | 40 |
41 // Whether to allocate/provide the producer with a buffer when able. This | 41 // Whether we're currently in the constructor, and should deallocate the |
42 // goes to false during destruction so that we don't leak memory. | 42 // buffer instead of passing it back to the producer. |
43 bool provide_buffer_; | 43 bool in_dtor_; |
44 | 44 |
45 FrameProducer* frame_producer_; | 45 FrameProducer* frame_producer_; |
46 SkISize view_size_; | 46 SkISize view_size_; |
47 SkIRect clip_area_; | 47 SkIRect clip_area_; |
48 ChromotingJni* jni_environment_; | |
Wez
2013/07/23 03:53:06
nit: Suggest java_interface_ or jni_interface_
solb
2013/07/23 19:01:10
I'm renaming ChromotingJni to ChromotingJniRuntime
| |
48 | 49 |
49 // If |provide_buffer_|, allocates a new buffer of |view_size_|, informs | 50 // If |provide_buffer_|, allocates a new buffer of |view_size_|, informs |
50 // Java about it, and tells the producer to draw onto it. Otherwise, no-op. | 51 // Java about it, and tells the producer to draw onto it. Otherwise, no-op. |
51 void AllocateBuffer(); | 52 void AllocateBuffer(); |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer); | 54 DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace remoting | 57 } // namespace remoting |
57 | 58 |
58 #endif | 59 #endif |
OLD | NEW |