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

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

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: specify ownership in the Bind call Created 6 years, 5 months 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 | Annotate | Revision Log
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 "mojo/services/surfaces/surfaces_service_application.h" 5 #include "mojo/services/surfaces/surfaces_service_application.h"
6 6
7 #include "cc/surfaces/display.h" 7 #include "cc/surfaces/display.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace surfaces { 10 namespace surfaces {
11 11
12 SurfacesServiceApplication::SurfacesServiceApplication() 12 SurfacesServiceApplication::SurfacesServiceApplication()
13 : next_id_namespace_(1u), display_(NULL) { 13 : next_id_namespace_(1u), display_(NULL) {
14 } 14 }
15 15
16 SurfacesServiceApplication::~SurfacesServiceApplication() { 16 SurfacesServiceApplication::~SurfacesServiceApplication() {
17 } 17 }
18 18
19 bool SurfacesServiceApplication::ConfigureIncomingConnection( 19 bool SurfacesServiceApplication::ConfigureIncomingConnection(
20 ApplicationConnection* connection) { 20 ApplicationConnection* connection) {
21 connection->AddService<SurfacesImpl, SurfacesImpl::Context>(this); 21 connection->AddServiceProvider(this);
22 return true; 22 return true;
23 } 23 }
24 24
25 cc::SurfaceManager* SurfacesServiceApplication::Manager() { 25 void SurfacesServiceApplication::BindToRequest(
26 return &manager_; 26 ApplicationConnection* connection,
27 } 27 InterfaceRequest<Surface> request) {
28 28 mojo::BindToRequest(new SurfacesImpl(&manager_, next_id_namespace_++, this),
29 uint32_t SurfacesServiceApplication::IdNamespace() { 29 &request);
30 return next_id_namespace_++;
31 } 30 }
32 31
33 void SurfacesServiceApplication::FrameSubmitted() { 32 void SurfacesServiceApplication::FrameSubmitted() {
34 if (display_) 33 if (display_)
35 display_->Draw(); 34 display_->Draw();
36 } 35 }
37 36
38 void SurfacesServiceApplication::SetDisplay(cc::Display* display) { 37 void SurfacesServiceApplication::SetDisplay(cc::Display* display) {
39 display_ = display; 38 display_ = display;
40 } 39 }
41 40
42 } // namespace surfaces 41 } // namespace surfaces
43 42
44 // static 43 // static
45 ApplicationDelegate* ApplicationDelegate::Create() { 44 ApplicationDelegate* ApplicationDelegate::Create() {
46 return new surfaces::SurfacesServiceApplication; 45 return new surfaces::SurfacesServiceApplication;
47 } 46 }
48 47
49 } // namespace mojo 48 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698