| 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 #include "services/surfaces/surfaces_service_application.h" | 5 #include "services/surfaces/surfaces_service_application.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/display.h" | 7 #include "cc/surfaces/display.h" |
| 8 #include "mojo/application/application_runner_chromium.h" | 8 #include "mojo/application/application_runner_chromium.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "services/surfaces/display_factory_impl.h" |
| 10 #include "services/surfaces/surfaces_impl.h" | 11 #include "services/surfaces/surfaces_impl.h" |
| 11 | 12 |
| 12 namespace surfaces { | 13 namespace surfaces { |
| 13 | 14 |
| 14 SurfacesServiceApplication::SurfacesServiceApplication() | 15 SurfacesServiceApplication::SurfacesServiceApplication() |
| 15 : next_id_namespace_(1u), display_(nullptr) { | 16 : next_id_namespace_(1u), display_(nullptr) { |
| 16 } | 17 } |
| 17 | 18 |
| 18 SurfacesServiceApplication::~SurfacesServiceApplication() { | 19 SurfacesServiceApplication::~SurfacesServiceApplication() { |
| 19 } | 20 } |
| 20 | 21 |
| 21 void SurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { | 22 void SurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { |
| 22 tracing_.Initialize(app); | 23 tracing_.Initialize(app); |
| 23 scheduler_.reset(new SurfacesScheduler(this)); | 24 scheduler_.reset(new SurfacesScheduler(this)); |
| 24 } | 25 } |
| 25 | 26 |
| 26 bool SurfacesServiceApplication::ConfigureIncomingConnection( | 27 bool SurfacesServiceApplication::ConfigureIncomingConnection( |
| 27 mojo::ApplicationConnection* connection) { | 28 mojo::ApplicationConnection* connection) { |
| 28 connection->AddService(this); | 29 connection->AddService<mojo::DisplayFactory>(this); |
| 30 connection->AddService<mojo::Surface>(this); |
| 29 return true; | 31 return true; |
| 30 } | 32 } |
| 31 | 33 |
| 32 void SurfacesServiceApplication::Create( | 34 void SurfacesServiceApplication::Create( |
| 33 mojo::ApplicationConnection* connection, | 35 mojo::ApplicationConnection* connection, |
| 36 mojo::InterfaceRequest<mojo::DisplayFactory> request) { |
| 37 new DisplayFactoryImpl(&manager_, next_id_namespace_++, this, request.Pass()); |
| 38 } |
| 39 |
| 40 void SurfacesServiceApplication::Create( |
| 41 mojo::ApplicationConnection* connection, |
| 34 mojo::InterfaceRequest<mojo::Surface> request) { | 42 mojo::InterfaceRequest<mojo::Surface> request) { |
| 35 new SurfacesImpl(&manager_, next_id_namespace_++, this, request.Pass()); | 43 new SurfacesImpl(&manager_, next_id_namespace_++, this, request.Pass()); |
| 36 } | 44 } |
| 37 | 45 |
| 38 void SurfacesServiceApplication::OnVSyncParametersUpdated( | 46 void SurfacesServiceApplication::OnVSyncParametersUpdated( |
| 39 base::TimeTicks timebase, | 47 base::TimeTicks timebase, |
| 40 base::TimeDelta interval) { | 48 base::TimeDelta interval) { |
| 41 scheduler_->OnVSyncParametersUpdated(timebase, interval); | 49 scheduler_->OnVSyncParametersUpdated(timebase, interval); |
| 42 } | 50 } |
| 43 | 51 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 display_->Draw(); | 67 display_->Draw(); |
| 60 } | 68 } |
| 61 | 69 |
| 62 } // namespace surfaces | 70 } // namespace surfaces |
| 63 | 71 |
| 64 MojoResult MojoMain(MojoHandle shell_handle) { | 72 MojoResult MojoMain(MojoHandle shell_handle) { |
| 65 mojo::ApplicationRunnerChromium runner( | 73 mojo::ApplicationRunnerChromium runner( |
| 66 new surfaces::SurfacesServiceApplication); | 74 new surfaces::SurfacesServiceApplication); |
| 67 return runner.Run(shell_handle); | 75 return runner.Run(shell_handle); |
| 68 } | 76 } |
| OLD | NEW |