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..53ef7abd3595ffe8313158078512acc73e58d655 |
| --- /dev/null |
| +++ b/mojo/services/gfx/images/cpp/image_pipe_consumer_endpoint.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2016 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 { |
|
jeffbrown
2016/03/03 23:27:49
public
nit: add docs
Forrest Reiling
2016/03/04 21:04:27
Done.
|
| + public: |
| + ImagePipeConsumerEndpoint( |
| + mojo::InterfaceRequest<mojo::gfx::ImagePipe> request, |
| + mojo::gfx::SupportedImagePropertiesPtr supported_properties, |
|
jeffbrown
2016/03/03 23:27:49
remove this
Forrest Reiling
2016/03/04 21:04:27
Done.
|
| + 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 |
|
jeffbrown
2016/03/03 23:27:49
dead? delete this comment
Forrest Reiling
2016/03/04 21:04:27
merged with below comment
|
| + |
| + // Aquire the Image presented least recently (queue like behavior). |
| + bool AcquireNextImage(uint32_t* id); |
|
jeffbrown
2016/03/03 23:27:49
nit: out_id
Forrest Reiling
2016/03/04 21:04:27
Done.
|
| + |
| + // Releases an image back to the producer |
|
jeffbrown
2016/03/03 23:27:49
nit: period at end of sentences
Forrest Reiling
2016/03/04 21:04:27
Done.
|
| + void ReleaseImage(uint32_t id, mojo::gfx::PresentationStatus status); |
| + |
| + void SetSupportedImageProperties( |
|
jeffbrown
2016/03/03 23:27:49
delete this
Forrest Reiling
2016/03/04 21:04:27
Done.
|
| + 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 DisableFatalErrorsForTesting(); |
|
jeffbrown
2016/03/03 23:27:49
Consider removing this ForTesting() stuff if you c
Forrest Reiling
2016/03/04 21:04:27
Acknowledged.
|
| + |
| + 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_tracker_; |
| + 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_ |