blob: 074e2e8dedba300e308eef502b43142c7101ee5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/services/test_service/test_service_application.h"
#include <assert.h>
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/utility/run_loop.h"
#include "mojo/services/test_service/test_service_impl.h"
#include "mojo/services/test_service/test_time_service_impl.h"
namespace mojo {
namespace test {
TestServiceApplication::TestServiceApplication() : ref_count_(0) {
}
TestServiceApplication::~TestServiceApplication() {
}
bool TestServiceApplication::ConfigureIncomingConnection(
ApplicationConnection* connection) {
connection->AddService<TestService>(this);
connection->AddService<TestTimeService>(this);
return true;
}
void TestServiceApplication::Create(ApplicationConnection* connection,
InterfaceRequest<TestService> request) {
BindToRequest(new TestServiceImpl(connection, this), &request);
}
void TestServiceApplication::Create(ApplicationConnection* connection,
InterfaceRequest<TestTimeService> request) {
BindToRequest(new TestTimeServiceImpl(connection), &request);
}
void TestServiceApplication::AddRef() {
assert(ref_count_ >= 0);
ref_count_++;
}
void TestServiceApplication::ReleaseRef() {
assert(ref_count_ > 0);
ref_count_--;
if (ref_count_ <= 0)
RunLoop::current()->Quit();
}
} // namespace test
// static
ApplicationDelegate* ApplicationDelegate::Create() {
return new mojo::test::TestServiceApplication();
}
} // namespace mojo
|