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_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | |
6 #define COMPONENTS_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "base/macros.h" | |
11 #include "cc/surfaces/surface_manager.h" | |
12 #include "components/surfaces/public/interfaces/display.mojom.h" | |
13 #include "components/surfaces/public/interfaces/surfaces.mojom.h" | |
14 #include "mojo/application/public/cpp/application_delegate.h" | |
15 #include "mojo/application/public/cpp/interface_factory.h" | |
16 #include "mojo/common/tracing_impl.h" | |
17 | |
18 namespace mojo { | |
19 class ApplicationConnection; | |
20 } | |
21 | |
22 namespace surfaces { | |
23 class DisplayImpl; | |
24 class SurfacesImpl; | |
25 class SurfacesScheduler; | |
26 | |
27 class SurfacesServiceApplication | |
28 : public mojo::ApplicationDelegate, | |
29 public mojo::InterfaceFactory<mojo::DisplayFactory>, | |
30 public mojo::InterfaceFactory<mojo::Surface> { | |
31 public: | |
32 SurfacesServiceApplication(); | |
33 ~SurfacesServiceApplication() override; | |
34 | |
35 // ApplicationDelegate implementation. | |
36 void Initialize(mojo::ApplicationImpl* app) override; | |
37 bool ConfigureIncomingConnection( | |
38 mojo::ApplicationConnection* connection) override; | |
39 | |
40 // InterfaceFactory<DisplayFactory> implementation. | |
41 void Create(mojo::ApplicationConnection* connection, | |
42 mojo::InterfaceRequest<mojo::DisplayFactory> request) override; | |
43 | |
44 // InterfaceFactory<Surface> implementation. | |
45 void Create(mojo::ApplicationConnection* connection, | |
46 mojo::InterfaceRequest<mojo::Surface> request) override; | |
47 | |
48 void DisplayCreated(DisplayImpl* display); | |
49 void DisplayDestroyed(DisplayImpl* display); | |
50 void SurfaceDestroyed(SurfacesImpl* surface); | |
51 | |
52 private: | |
53 cc::SurfaceManager manager_; | |
54 uint32_t next_id_namespace_; | |
55 scoped_ptr<SurfacesScheduler> scheduler_; | |
56 mojo::TracingImpl tracing_; | |
57 | |
58 // Since these two classes have non-owning pointers to |manager_|, need to | |
59 // destroy them if this class is destructed first. | |
60 std::set<DisplayImpl*> displays_; | |
61 std::set<SurfacesImpl*> surfaces_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(SurfacesServiceApplication); | |
64 }; | |
65 | |
66 } // namespace surfaces | |
67 | |
68 #endif // COMPONENTS_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | |
OLD | NEW |