Index: remoting/ios/bridge/frame_consumer_bridge.h |
diff --git a/remoting/ios/bridge/frame_consumer_bridge.h b/remoting/ios/bridge/frame_consumer_bridge.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ebb1a92edbf32c7b754b05b28219d0a0e5b1708f |
--- /dev/null |
+++ b/remoting/ios/bridge/frame_consumer_bridge.h |
@@ -0,0 +1,63 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ |
+#define REMOTING_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ |
+ |
+#include <list> |
+ |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_vector.h" |
+#include "remoting/client/frame_consumer.h" |
+#include "remoting/client/frame_producer.h" |
+ |
+#include "remoting/ios/bridge/frame_consumer_bridge_callback.h" |
+ |
+namespace remoting { |
+ |
+// FrameConsumer implementation that draws onto a byte buffer. |
dcaiafa
2014/03/19 01:14:15
Description doesn't match functionality.
aboone
2014/03/21 16:42:07
Done.
|
+class FrameConsumerBridge : public FrameConsumer { |
+ public: |
+ // The instance does not take ownership of |objc_runtime|. |
dcaiafa
2014/03/19 01:14:15
Comment doesn't match signature.
aboone
2014/03/21 16:42:07
Done.
|
+ explicit FrameConsumerBridge(FrameConsumerBridgeCallback callback); |
+ |
+ // This must be called once before the producer's source size is set. |
+ void Initialize(FrameProducer* producer); |
+ |
+ // FrameConsumer implementation. |
+ virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, |
+ const webrtc::DesktopRect& clip_area, |
+ webrtc::DesktopFrame* buffer, |
+ const webrtc::DesktopRegion& region, |
+ const webrtc::DesktopRegion& shape) OVERRIDE; |
+ virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; |
+ virtual void SetSourceSize(const webrtc::DesktopSize& source_size, |
+ const webrtc::DesktopVector& dpi) OVERRIDE; |
+ virtual PixelFormat GetPixelFormat() OVERRIDE; |
+ |
+ private: |
+ // Allocates a new buffer of |view_size_|, and tells |
+ // the producer to draw onto it. |
+ void AllocateBuffer(); |
+ |
+ // Frees a frame buffer previously allocated by AllocateBuffer. |
+ void FreeBuffer(webrtc::DesktopFrame* buffer); |
+ |
+ // Variables are to be used from the display thread. |
+ |
+ // Used to obtain task runner references and make calls to OBJ_C methods. |
+ FrameConsumerBridgeCallback callback_; |
+ |
+ FrameProducer* frame_producer_; |
+ webrtc::DesktopSize view_size_; |
+ |
+ // List of allocated image buffers. |
+ ScopedVector<webrtc::DesktopFrame> buffers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FrameConsumerBridge); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ |