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
3 // found in the LICENSE file.
5 #include "mojo/services/test_service/test_service_application.h"
9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/utility/run_loop.h"
11 #include "mojo/services/test_service/test_service_impl.h"
12 #include "mojo/services/test_service/test_time_service_impl.h"
17 TestServiceApplication::TestServiceApplication() : ref_count_(0) {
20 TestServiceApplication::~TestServiceApplication() {
23 bool TestServiceApplication::ConfigureIncomingConnection(
24 ApplicationConnection* connection) {
25 connection->AddService<TestService>(this);
26 connection->AddService<TestTimeService>(this);
30 void TestServiceApplication::Create(ApplicationConnection* connection,
31 InterfaceRequest<TestService> request) {
32 BindToRequest(new TestServiceImpl(connection, this), &request);
35 void TestServiceApplication::Create(ApplicationConnection* connection,
36 InterfaceRequest<TestTimeService> request) {
37 BindToRequest(new TestTimeServiceImpl(connection), &request);
40 void TestServiceApplication::AddRef() {
41 assert(ref_count_ >= 0);
45 void TestServiceApplication::ReleaseRef() {
46 assert(ref_count_ > 0);
49 RunLoop::current()->Quit();
55 ApplicationDelegate* ApplicationDelegate::Create() {
56 return new mojo::test::TestServiceApplication();