Chromium Code Reviews| 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 mojo::gfx::ImagePipe { | |
| 16 public: | |
| 17 ImagePipeConsumerEndpoint( | |
| 18 mojo::InterfaceRequest<mojo::gfx::ImagePipe> request, | |
| 19 mojo::gfx::SupportedImagePropertiesPtr supported_properties, | |
| 20 ImagePipeConsumerDelegate* delegate); | |
| 21 ~ImagePipeConsumerEndpoint() override; | |
| 22 | |
| 23 // Different methods for selecting images out of the pipe based on various | |
| 24 // selection policies. If no images are available that match the selection | |
| 25 // criteria the calls will return false otherwise they will write the selected | |
| 26 // id into their id argument and return true | |
| 27 | |
| 28 // Aquire the Image presented least recently (queue like behavior). | |
| 29 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.
| |
| 30 | |
| 31 // Releases an image back to the producer | |
| 32 void ReleaseImage(uint32_t id, mojo::gfx::PresentationStatus status); | |
| 33 | |
| 34 void SetSupportedImageProperties( | |
| 35 mojo::gfx::SupportedImagePropertiesPtr supported_properties); | |
| 36 | |
| 37 // For testing only, makes fatal errors not quite fatal, which allows tests | |
| 38 // to cause a fatal error and check that it was caught correctly without | |
| 39 // dying a horrible death in the process. If you are using this for something | |
| 40 // other than testing you are probably doing something very wrong. | |
| 41 void DisableFatalErrors(); | |
| 42 | |
| 43 private: | |
| 44 void CloseEndpoint(); | |
| 45 | |
| 46 // Inherited from mojo::gfx::ImagePipe, see image_pipe.mojom for comments | |
| 47 void AddImage(mojo::gfx::ImagePtr image, uint32_t id) override; | |
| 48 void RemoveImage(uint32_t id) override; | |
| 49 void PresentImage(uint32_t id, const PresentImageCallback& callback) override; | |
| 50 void FlushImages() override; | |
| 51 void GetSupportedImageProperties( | |
| 52 const GetSupportedImagePropertiesCallback& callback) override; | |
| 53 | |
| 54 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
| |
| 55 ImagePipeConsumerDelegate* delegate_; | |
| 56 mojo::gfx::SupportedImagePropertiesPtr supported_properties_; | |
| 57 bool supported_properties_dirty_; | |
| 58 GetSupportedImagePropertiesCallback supported_properties_callback_; | |
| 59 bool supported_properties_callback_pending_; | |
| 60 | |
| 61 mojo::Binding<mojo::gfx::ImagePipe> image_pipe_binding_; | |
| 62 | |
| 63 MOJO_DISALLOW_COPY_AND_ASSIGN(ImagePipeConsumerEndpoint); | |
| 64 }; | |
| 65 | |
| 66 } // namespace image_pipe | |
| 67 | |
| 68 #endif // MOJO_SERVICES_GFX_IMAGES_INTERFACES_IMAGE_PIPE_CONSUMER_ENDPOINT_H_ | |
| OLD | NEW |