Index: mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h |
diff --git a/mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h b/mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..12b833492d1c0110dfb2005359497b8f1eb1ede8 |
--- /dev/null |
+++ b/mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2015 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 MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |
+#define MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |
+ |
+#include "image_pipe_endpoint.h" |
+#include "mojo/public/c/system/macros.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
+#include "mojo/services/gfx/images/cpp/image_pipe_consumer_delegate.h" |
+#include "mojo/services/gfx/images/interfaces/image_pipe.mojom.h" |
+ |
+namespace image_pipe { |
+ |
+class ImagePipeConsumerEndpoint : private ImagePipeEndpoint, |
+ private mojo::gfx::ImagePipe { |
+ public: |
+ ImagePipeConsumerEndpoint( |
+ mojo::InterfaceRequest<mojo::gfx::ImagePipe> request, |
+ mojo::gfx::SupportedImagePropertiesPtr supported_properties, |
+ ImagePipeConsumerDelegate* delegate, |
+ bool is_checked = true); |
+ ~ImagePipeConsumerEndpoint() override; |
+ |
+ // Different methods for selecting images out of the pipe based on various |
+ // selection policies. If no images are available that match the selection |
+ // criteria the calls will return false otherwise they will write the selected |
+ // id into their id argument and return true |
+ |
+ // Aquire the Image presented least recently (queue like behavior). |
+ bool AcquireNextImage(uint32_t& id); |
+ |
+ // Releases an image back to the producer |
+ void ReleaseImage(uint32_t id, mojo::gfx::PresentationStatus status); |
+ |
+ void SetSupportedImageProperties( |
+ mojo::gfx::SupportedImagePropertiesPtr supported_properties); |
+ |
+ void CloseEndpoint() override; |
+ |
+ private: |
+ // mojo::gfx::ImagePipe implementation |
+ void AddImage(mojo::gfx::ImagePtr image, uint32_t id) override; |
+ void RemoveImage(uint32_t id) override; |
+ void PresentImage(uint32_t id, const PresentImageCallback& callback) override; |
+ void FlushImages() override; |
+ void GetSupportedImageProperties( |
+ const GetSupportedImagePropertiesCallback& callback) override; |
+ |
+ ImagePipeConsumerDelegate* delegate_; |
+ |
+ mojo::gfx::SupportedImagePropertiesPtr supported_properties_; |
+ bool supported_properties_dirty_; |
+ GetSupportedImagePropertiesCallback supported_properties_callback_; |
+ bool supported_properties_callback_pending_; |
+ |
+ mojo::Binding<mojo::gfx::ImagePipe> image_pipe_binding_; |
+ |
+ MOJO_DISALLOW_COPY_AND_ASSIGN(ImagePipeConsumerEndpoint); |
+}; |
+ |
+} // namespace image_pipe |
+ |
+#endif // MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |