| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_CC_OUTPUT_SURFACE_MOJO_H_ | 5 #ifndef MOJO_CC_OUTPUT_SURFACE_MOJO_H_ |
| 6 #define MOJO_CC_OUTPUT_SURFACE_MOJO_H_ | 6 #define MOJO_CC_OUTPUT_SURFACE_MOJO_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
| 10 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | 11 #include "components/view_manager/public/cpp/view_surface.h" |
| 12 #include "components/view_manager/public/cpp/view_surface_client.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 | 16 |
| 16 class OutputSurfaceMojoClient { | 17 class OutputSurfaceMojo : public cc::OutputSurface, |
| 18 public mojo::ViewSurfaceClient { |
| 17 public: | 19 public: |
| 18 virtual ~OutputSurfaceMojoClient() {} | 20 OutputSurfaceMojo(const scoped_refptr<cc::ContextProvider>& context_provider, |
| 19 | 21 scoped_ptr<mojo::ViewSurface> surface); |
| 20 virtual void DidCreateSurface(cc::SurfaceId id) = 0; | 22 ~OutputSurfaceMojo() override; |
| 21 }; | |
| 22 | |
| 23 class OutputSurfaceMojo : public cc::OutputSurface, | |
| 24 public mojo::ResourceReturner { | |
| 25 public: | |
| 26 OutputSurfaceMojo(OutputSurfaceMojoClient* client, | |
| 27 const scoped_refptr<cc::ContextProvider>& context_provider, | |
| 28 ScopedMessagePipeHandle surface_handle); | |
| 29 | |
| 30 // mojo::ResourceReturner implementation. | |
| 31 void ReturnResources(mojo::Array<ReturnedResourcePtr>) override; | |
| 32 | 23 |
| 33 // cc::OutputSurface implementation. | 24 // cc::OutputSurface implementation. |
| 34 void SwapBuffers(cc::CompositorFrame* frame) override; | 25 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 35 bool BindToClient(cc::OutputSurfaceClient* client) override; | 26 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 36 | 27 |
| 37 protected: | 28 private: |
| 38 ~OutputSurfaceMojo() override; | 29 // uip::SurfaceObserver implementation: |
| 30 void OnResourcesReturned( |
| 31 mojo::ViewSurface* surface, |
| 32 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
| 39 | 33 |
| 40 private: | 34 scoped_ptr<mojo::ViewSurface> surface_; |
| 41 void SetIdNamespace(uint32_t id_namespace); | |
| 42 | |
| 43 OutputSurfaceMojoClient* output_surface_mojo_client_; | |
| 44 ScopedMessagePipeHandle surface_handle_; | |
| 45 SurfacePtr surface_; | |
| 46 uint32_t id_namespace_; | |
| 47 uint32_t local_id_; | |
| 48 gfx::Size surface_size_; | |
| 49 mojo::Binding<mojo::ResourceReturner> binding_; | |
| 50 | 35 |
| 51 DISALLOW_COPY_AND_ASSIGN(OutputSurfaceMojo); | 36 DISALLOW_COPY_AND_ASSIGN(OutputSurfaceMojo); |
| 52 }; | 37 }; |
| 53 } | 38 } |
| 54 | 39 |
| 55 #endif // MOJO_CC_OUTPUT_SURFACE_MOJO_H_ | 40 #endif // MOJO_CC_OUTPUT_SURFACE_MOJO_H_ |
| OLD | NEW |