• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "RemoteState.h"
18 
19 namespace android {
20 namespace automotive {
21 namespace computepipe {
22 namespace router {
23 namespace V1_0 {
24 namespace implementation {
25 
markDead()26 void RemoteState::markDead() {
27     std::lock_guard<std::mutex> lock(mStateLock);
28     mAlive = false;
29 }
30 
isAlive()31 bool RemoteState::isAlive() {
32     std::lock_guard<std::mutex> lock(mStateLock);
33     return mAlive;
34 }
35 
binderDied()36 void RemoteMonitor::binderDied() {
37     auto state = mState.lock();
38     if (state != nullptr) {
39         state->markDead();
40     }
41 }
42 
BinderDiedCallback(void * cookie)43 void RemoteMonitor::BinderDiedCallback(void* cookie) {
44     auto monitor = static_cast<RemoteMonitor*>(cookie);
45     monitor->binderDied();
46 }
47 }  // namespace implementation
48 }  // namespace V1_0
49 }  // namespace router
50 }  // namespace computepipe
51 }  // namespace automotive
52 }  // namespace android
53