Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: services/surfaces/surfaces_service_application.cc

Issue 807733002: Split surface id and simplify connecting to surfaces service (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_service_impl.h" 12 #include "services/surfaces/surfaces_service_impl.h"
12 13
13 namespace surfaces { 14 namespace surfaces {
14 15
15 SurfacesServiceApplication::SurfacesServiceApplication() 16 SurfacesServiceApplication::SurfacesServiceApplication()
16 : next_id_namespace_(1u), display_(nullptr) { 17 : next_id_namespace_(1u), display_(nullptr) {
17 } 18 }
18 19
19 SurfacesServiceApplication::~SurfacesServiceApplication() { 20 SurfacesServiceApplication::~SurfacesServiceApplication() {
20 } 21 }
21 22
22 void SurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { 23 void SurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) {
23 mojo::TracingImpl::Create(app); 24 mojo::TracingImpl::Create(app);
24 scheduler_.reset(new SurfacesScheduler(this)); 25 scheduler_.reset(new SurfacesScheduler(this));
25 } 26 }
26 27
27 bool SurfacesServiceApplication::ConfigureIncomingConnection( 28 bool SurfacesServiceApplication::ConfigureIncomingConnection(
28 mojo::ApplicationConnection* connection) { 29 mojo::ApplicationConnection* connection) {
29 connection->AddService(this); 30 connection->AddService<mojo::SurfacesService>(this);
31 connection->AddService<mojo::Surface>(this);
30 return true; 32 return true;
31 } 33 }
32 34
33 void SurfacesServiceApplication::Create( 35 void SurfacesServiceApplication::Create(
34 mojo::ApplicationConnection* connection, 36 mojo::ApplicationConnection* connection,
35 mojo::InterfaceRequest<mojo::SurfacesService> request) { 37 mojo::InterfaceRequest<mojo::SurfacesService> request) {
36 new SurfacesServiceImpl(&manager_, &next_id_namespace_, this, request.Pass()); 38 new SurfacesServiceImpl(&manager_, &next_id_namespace_, this, request.Pass());
37 } 39 }
38 40
41 void SurfacesServiceApplication::Create(
42 mojo::ApplicationConnection* connection,
43 mojo::InterfaceRequest<mojo::Surface> request) {
44 new SurfacesImpl(&manager_, next_id_namespace_++, this, request.Pass());
45 }
46
39 void SurfacesServiceApplication::OnVSyncParametersUpdated( 47 void SurfacesServiceApplication::OnVSyncParametersUpdated(
40 base::TimeTicks timebase, 48 base::TimeTicks timebase,
41 base::TimeDelta interval) { 49 base::TimeDelta interval) {
42 scheduler_->OnVSyncParametersUpdated(timebase, interval); 50 scheduler_->OnVSyncParametersUpdated(timebase, interval);
43 } 51 }
44 52
45 void SurfacesServiceApplication::FrameSubmitted() { 53 void SurfacesServiceApplication::FrameSubmitted() {
46 scheduler_->SetNeedsDraw(); 54 scheduler_->SetNeedsDraw();
47 } 55 }
48 56
(...skipping 11 matching lines...) Expand all
60 display_->Draw(); 68 display_->Draw();
61 } 69 }
62 70
63 } // namespace surfaces 71 } // namespace surfaces
64 72
65 MojoResult MojoMain(MojoHandle shell_handle) { 73 MojoResult MojoMain(MojoHandle shell_handle) {
66 mojo::ApplicationRunnerChromium runner( 74 mojo::ApplicationRunnerChromium runner(
67 new surfaces::SurfacesServiceApplication); 75 new surfaces::SurfacesServiceApplication);
68 return runner.Run(shell_handle); 76 return runner.Run(shell_handle);
69 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698