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