Chromium Code Reviews| 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..ac1f4070372c44ab9fd507ad15bc085b859f66ca |
| --- /dev/null |
| +++ b/mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h |
| @@ -0,0 +1,68 @@ |
| +// 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 mojo::gfx::ImagePipe { |
| + public: |
| + ImagePipeConsumerEndpoint( |
| + mojo::InterfaceRequest<mojo::gfx::ImagePipe> request, |
| + mojo::gfx::SupportedImagePropertiesPtr supported_properties, |
| + ImagePipeConsumerDelegate* delegate); |
| + ~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); |
|
jamesr
2016/02/18 20:40:58
google c++ style is parameters are either pointers
Forrest Reiling
2016/02/25 00:35:14
Good to know. Done.
|
| + |
| + // Releases an image back to the producer |
| + void ReleaseImage(uint32_t id, mojo::gfx::PresentationStatus status); |
| + |
| + void SetSupportedImageProperties( |
| + mojo::gfx::SupportedImagePropertiesPtr supported_properties); |
| + |
| + // For testing only, makes fatal errors not quite fatal, which allows tests |
| + // to cause a fatal error and check that it was caught correctly without |
| + // dying a horrible death in the process. If you are using this for something |
| + // other than testing you are probably doing something very wrong. |
| + void DisableFatalErrors(); |
| + |
| + private: |
| + void CloseEndpoint(); |
| + |
| + // Inherited from mojo::gfx::ImagePipe, see image_pipe.mojom for comments |
| + 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; |
| + |
| + ImagePipeEndpoint state_tacker_; |
|
jamesr
2016/02/18 20:40:58
"tracker"?
Forrest Reiling
2016/02/25 00:35:14
Its amazing how many times I copy and pasted that
|
| + 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_ |