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