OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 #ifndef MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |
| 5 #define MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |
| 6 |
| 7 #include "image_pipe_endpoint.h" |
| 8 #include "mojo/public/c/system/macros.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 #include "mojo/services/gfx/images/cpp/image_pipe_consumer_delegate.h" |
| 11 #include "mojo/services/gfx/images/interfaces/image_pipe.mojom.h" |
| 12 |
| 13 namespace image_pipe { |
| 14 |
| 15 class ImagePipeConsumerEndpoint : private ImagePipeEndpoint, |
| 16 private mojo::gfx::ImagePipe { |
| 17 public: |
| 18 ImagePipeConsumerEndpoint( |
| 19 mojo::InterfaceRequest<mojo::gfx::ImagePipe> request, |
| 20 mojo::gfx::SupportedImagePropertiesPtr supported_properties, |
| 21 ImagePipeConsumerDelegate* delegate, |
| 22 bool is_checked = true); |
| 23 ~ImagePipeConsumerEndpoint() override; |
| 24 |
| 25 // Different methods for selecting images out of the pipe based on various |
| 26 // selection policies. If no images are available that match the selection |
| 27 // criteria the calls will return false otherwise they will write the selected |
| 28 // id into their id argument and return true |
| 29 |
| 30 // Aquire the Image presented least recently (queue like behavior). |
| 31 bool AcquireNextImage(uint32_t& id); |
| 32 |
| 33 // Releases an image back to the producer |
| 34 void ReleaseImage(uint32_t id, mojo::gfx::PresentationStatus status); |
| 35 |
| 36 void SetSupportedImageProperties( |
| 37 mojo::gfx::SupportedImagePropertiesPtr supported_properties); |
| 38 |
| 39 void CloseEndpoint() override; |
| 40 |
| 41 private: |
| 42 // mojo::gfx::ImagePipe implementation |
| 43 void AddImage(mojo::gfx::ImagePtr image, uint32_t id) override; |
| 44 void RemoveImage(uint32_t id) override; |
| 45 void PresentImage(uint32_t id, const PresentImageCallback& callback) override; |
| 46 void FlushImages() override; |
| 47 void GetSupportedImageProperties( |
| 48 const GetSupportedImagePropertiesCallback& callback) override; |
| 49 |
| 50 ImagePipeConsumerDelegate* delegate_; |
| 51 |
| 52 mojo::gfx::SupportedImagePropertiesPtr supported_properties_; |
| 53 bool supported_properties_dirty_; |
| 54 GetSupportedImagePropertiesCallback supported_properties_callback_; |
| 55 bool supported_properties_callback_pending_; |
| 56 |
| 57 mojo::Binding<mojo::gfx::ImagePipe> image_pipe_binding_; |
| 58 |
| 59 MOJO_DISALLOW_COPY_AND_ASSIGN(ImagePipeConsumerEndpoint); |
| 60 }; |
| 61 |
| 62 } // namespace image_pipe |
| 63 |
| 64 #endif // MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ |
OLD | NEW |