| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 | |
| 5 #ifndef COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_IMPL_H_ | |
| 6 #define COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_IMPL_H_ | |
| 7 | |
| 8 #include "cc/surfaces/display_client.h" | |
| 9 #include "cc/surfaces/surface_factory.h" | |
| 10 #include "cc/surfaces/surface_factory_client.h" | |
| 11 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" | |
| 12 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | |
| 13 #include "components/view_manager/surfaces/surfaces_state.h" | |
| 14 #include "mojo/application/public/cpp/application_connection.h" | |
| 15 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | |
| 16 | |
| 17 namespace cc { | |
| 18 class Display; | |
| 19 } | |
| 20 | |
| 21 namespace mojo { | |
| 22 class ApplicationManager; | |
| 23 } | |
| 24 | |
| 25 namespace surfaces { | |
| 26 | |
| 27 class SurfacesDelegate; | |
| 28 class SurfacesScheduler; | |
| 29 | |
| 30 class SurfacesImpl : public mojo::Surface, public cc::SurfaceFactoryClient { | |
| 31 public: | |
| 32 SurfacesImpl(SurfacesDelegate* surfaces_delegate, | |
| 33 const scoped_refptr<SurfacesState>& state, | |
| 34 mojo::InterfaceRequest<mojo::Surface> request); | |
| 35 | |
| 36 // Closes the connection and destroys |this| object. | |
| 37 void CloseConnection(); | |
| 38 | |
| 39 // Surface implementation. | |
| 40 void GetIdNamespace(const Surface::GetIdNamespaceCallback& callback) override; | |
| 41 void SetResourceReturner(mojo::ResourceReturnerPtr returner) override; | |
| 42 void CreateSurface(uint32_t local_id) override; | |
| 43 void SubmitCompositorFrame(uint32_t local_id, | |
| 44 mojo::CompositorFramePtr frame, | |
| 45 const mojo::Closure& callback) override; | |
| 46 void DestroySurface(uint32_t local_id) override; | |
| 47 | |
| 48 // SurfaceFactoryClient implementation. | |
| 49 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 50 | |
| 51 cc::SurfaceFactory* factory() { return &factory_; } | |
| 52 | |
| 53 private: | |
| 54 ~SurfacesImpl() override; | |
| 55 | |
| 56 cc::SurfaceId QualifyIdentifier(uint32_t local_id); | |
| 57 | |
| 58 SurfacesDelegate* delegate_; | |
| 59 // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated | |
| 60 // by the Surfaces service, and the low 32-bits are generated by the process | |
| 61 // that requested the Surface. | |
| 62 scoped_refptr<SurfacesState> state_; | |
| 63 // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated | |
| 64 // by the Surfaces service, and the low 32-bits are generated by the process | |
| 65 // that requested the Surface. | |
| 66 const uint32_t id_namespace_; | |
| 67 cc::SurfaceFactory factory_; | |
| 68 mojo::ScopedMessagePipeHandle command_buffer_handle_; | |
| 69 mojo::ResourceReturnerPtr returner_; | |
| 70 mojo::Binding<Surface> binding_; | |
| 71 bool connection_closed_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); | |
| 74 }; | |
| 75 | |
| 76 } // namespace surfaces | |
| 77 | |
| 78 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_IMPL_H_ | |
| OLD | NEW |