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 COMPONENTS_SURFACES_SURFACES_IMPL_H_ | 5 #ifndef COMPONENTS_SURFACES_SURFACES_IMPL_H_ |
6 #define COMPONENTS_SURFACES_SURFACES_IMPL_H_ | 6 #define COMPONENTS_SURFACES_SURFACES_IMPL_H_ |
7 | 7 |
8 #include "cc/surfaces/display_client.h" | 8 #include "cc/surfaces/display_client.h" |
9 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
10 #include "cc/surfaces/surface_factory_client.h" | 10 #include "cc/surfaces/surface_factory_client.h" |
11 #include "components/gpu/public/interfaces/command_buffer.mojom.h" | 11 #include "components/gpu/public/interfaces/command_buffer.mojom.h" |
12 #include "components/gpu/public/interfaces/viewport_parameter_listener.mojom.h" | 12 #include "components/gpu/public/interfaces/viewport_parameter_listener.mojom.h" |
13 #include "components/surfaces/public/interfaces/surfaces.mojom.h" | 13 #include "components/surfaces/public/interfaces/surfaces.mojom.h" |
14 #include "mojo/application/public/cpp/application_connection.h" | 14 #include "mojo/application/public/cpp/application_connection.h" |
15 #include "mojo/common/weak_binding_set.h" | 15 #include "mojo/common/weak_binding_set.h" |
16 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 16 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 class Display; | 19 class Display; |
20 } | 20 } |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 class ApplicationManager; | 23 class ApplicationManager; |
24 } | 24 } |
25 | 25 |
26 namespace surfaces { | 26 namespace surfaces { |
27 class SurfacesScheduler; | 27 class SurfacesScheduler; |
| 28 class SurfacesServiceApplication; |
28 | 29 |
29 class SurfacesImpl : public mojo::Surface, public cc::SurfaceFactoryClient { | 30 class SurfacesImpl : public mojo::Surface, public cc::SurfaceFactoryClient { |
30 public: | 31 public: |
31 SurfacesImpl(cc::SurfaceManager* manager, | 32 SurfacesImpl(SurfacesServiceApplication* application, |
| 33 cc::SurfaceManager* manager, |
32 uint32_t id_namespace, | 34 uint32_t id_namespace, |
33 SurfacesScheduler* scheduler, | 35 SurfacesScheduler* scheduler, |
34 mojo::InterfaceRequest<mojo::Surface> request); | 36 mojo::InterfaceRequest<mojo::Surface> request); |
35 | 37 |
36 ~SurfacesImpl() override; | 38 ~SurfacesImpl() override; |
37 | 39 |
38 // Surface implementation. | 40 // Surface implementation. |
39 void GetIdNamespace(const Surface::GetIdNamespaceCallback& callback) override; | 41 void GetIdNamespace(const Surface::GetIdNamespaceCallback& callback) override; |
40 void SetResourceReturner(mojo::ResourceReturnerPtr returner) override; | 42 void SetResourceReturner(mojo::ResourceReturnerPtr returner) override; |
41 void CreateSurface(uint32_t local_id) override; | 43 void CreateSurface(uint32_t local_id) override; |
42 void SubmitFrame(uint32_t local_id, | 44 void SubmitFrame(uint32_t local_id, |
43 mojo::FramePtr frame, | 45 mojo::FramePtr frame, |
44 const mojo::Closure& callback) override; | 46 const mojo::Closure& callback) override; |
45 void DestroySurface(uint32_t local_id) override; | 47 void DestroySurface(uint32_t local_id) override; |
46 | 48 |
47 // SurfaceFactoryClient implementation. | 49 // SurfaceFactoryClient implementation. |
48 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 50 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
49 | 51 |
50 cc::SurfaceFactory* factory() { return &factory_; } | 52 cc::SurfaceFactory* factory() { return &factory_; } |
51 | 53 |
52 private: | 54 private: |
53 cc::SurfaceId QualifyIdentifier(uint32_t local_id); | 55 cc::SurfaceId QualifyIdentifier(uint32_t local_id); |
54 | 56 |
| 57 SurfacesServiceApplication* application_; |
55 cc::SurfaceManager* manager_; | 58 cc::SurfaceManager* manager_; |
56 cc::SurfaceFactory factory_; | 59 cc::SurfaceFactory factory_; |
57 const uint32_t id_namespace_; | 60 const uint32_t id_namespace_; |
58 SurfacesScheduler* scheduler_; | 61 SurfacesScheduler* scheduler_; |
59 mojo::ScopedMessagePipeHandle command_buffer_handle_; | 62 mojo::ScopedMessagePipeHandle command_buffer_handle_; |
60 mojo::ResourceReturnerPtr returner_; | 63 mojo::ResourceReturnerPtr returner_; |
61 mojo::StrongBinding<Surface> binding_; | 64 mojo::StrongBinding<Surface> binding_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); | 66 DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); |
64 }; | 67 }; |
65 | 68 |
66 } // namespace surfaces | 69 } // namespace surfaces |
67 | 70 |
68 #endif // COMPONENTS_SURFACES_SURFACES_IMPL_H_ | 71 #endif // COMPONENTS_SURFACES_SURFACES_IMPL_H_ |
OLD | NEW |