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 SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | 5 #ifndef SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ |
6 #define SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | 6 #define SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
11 #include "mojo/public/cpp/application/application_delegate.h" | 11 #include "mojo/public/cpp/application/application_delegate.h" |
12 #include "mojo/public/cpp/application/interface_factory.h" | 12 #include "mojo/public/cpp/application/interface_factory.h" |
13 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" | |
14 #include "services/surfaces/surfaces_impl.h" | 13 #include "services/surfaces/surfaces_impl.h" |
15 #include "services/surfaces/surfaces_scheduler.h" | 14 #include "services/surfaces/surfaces_scheduler.h" |
16 | 15 |
17 namespace mojo { | 16 namespace mojo { |
18 class ApplicationConnection; | 17 class ApplicationConnection; |
19 } | 18 } |
20 | 19 |
21 namespace surfaces { | 20 namespace surfaces { |
22 | 21 |
23 class SurfacesServiceApplication | 22 class SurfacesServiceApplication |
24 : public mojo::ApplicationDelegate, | 23 : public mojo::ApplicationDelegate, |
25 public mojo::InterfaceFactory<mojo::SurfacesService>, | |
26 public mojo::InterfaceFactory<mojo::Surface>, | 24 public mojo::InterfaceFactory<mojo::Surface>, |
27 public SurfacesImpl::Client, | 25 public SurfacesImpl::Client, |
28 public SurfacesScheduler::Client { | 26 public SurfacesScheduler::Client { |
29 public: | 27 public: |
30 SurfacesServiceApplication(); | 28 SurfacesServiceApplication(); |
31 ~SurfacesServiceApplication() override; | 29 ~SurfacesServiceApplication() override; |
32 | 30 |
33 // ApplicationDelegate implementation. | 31 // ApplicationDelegate implementation. |
34 void Initialize(mojo::ApplicationImpl* app) override; | 32 void Initialize(mojo::ApplicationImpl* app) override; |
35 bool ConfigureIncomingConnection( | 33 bool ConfigureIncomingConnection( |
36 mojo::ApplicationConnection* connection) override; | 34 mojo::ApplicationConnection* connection) override; |
37 | 35 |
38 // InterfaceFactory<SurfacesServicee> implementation. | |
39 void Create(mojo::ApplicationConnection* connection, | |
40 mojo::InterfaceRequest<mojo::SurfacesService> request) override; | |
41 | |
42 // InterfaceFactory<Surface> implementation. | 36 // InterfaceFactory<Surface> implementation. |
43 void Create(mojo::ApplicationConnection* connection, | 37 void Create(mojo::ApplicationConnection* connection, |
44 mojo::InterfaceRequest<mojo::Surface> request) override; | 38 mojo::InterfaceRequest<mojo::Surface> request) override; |
45 | 39 |
46 // SurfacesImpl::Client implementation. | 40 // SurfacesImpl::Client implementation. |
47 void OnVSyncParametersUpdated(base::TimeTicks timebase, | 41 void OnVSyncParametersUpdated(base::TimeTicks timebase, |
48 base::TimeDelta interval) override; | 42 base::TimeDelta interval) override; |
49 void FrameSubmitted() override; | 43 void FrameSubmitted() override; |
50 void SetDisplay(cc::Display*) override; | 44 void SetDisplay(cc::Display*) override; |
51 void OnDisplayBeingDestroyed(cc::Display* display) override; | 45 void OnDisplayBeingDestroyed(cc::Display* display) override; |
52 | 46 |
53 // SurfacesScheduler::Client | 47 // SurfacesScheduler::Client |
54 void Draw() override; | 48 void Draw() override; |
55 | 49 |
56 private: | 50 private: |
57 cc::SurfaceManager manager_; | 51 cc::SurfaceManager manager_; |
58 uint32_t next_id_namespace_; | 52 uint32_t next_id_namespace_; |
59 cc::Display* display_; | 53 cc::Display* display_; |
60 scoped_ptr<SurfacesScheduler> scheduler_; | 54 scoped_ptr<SurfacesScheduler> scheduler_; |
61 | 55 |
62 DISALLOW_COPY_AND_ASSIGN(SurfacesServiceApplication); | 56 DISALLOW_COPY_AND_ASSIGN(SurfacesServiceApplication); |
63 }; | 57 }; |
64 | 58 |
65 } // namespace surfaces | 59 } // namespace surfaces |
66 | 60 |
67 #endif // SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ | 61 #endif // SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ |
OLD | NEW |