Implement RPC for window state synchronization
This commit is contained in:
parent
f7820e1f65
commit
0f5006493b
11 changed files with 89 additions and 78 deletions
|
|
@ -55,7 +55,7 @@ void PlatformApiStub::handle_boot_finished_response(Request<protobuf::rpc::Void>
|
|||
boot_finished_wait_handle_.result_received();
|
||||
}
|
||||
|
||||
void PlatformApiStub::update_window_state() {
|
||||
void PlatformApiStub::update_window_state(const anbox::protobuf::bridge::WindowStateUpdate &window_state) {
|
||||
auto c = std::make_shared<Request<protobuf::rpc::Void>>();
|
||||
|
||||
ALOGI("Updating window state");
|
||||
|
|
@ -65,11 +65,9 @@ void PlatformApiStub::update_window_state() {
|
|||
update_window_state_wait_handle_.expect_result();
|
||||
}
|
||||
|
||||
protobuf::rpc::Void message;
|
||||
|
||||
rpc_channel_->call_method(
|
||||
"update_window_state",
|
||||
&message, c->response.get(),
|
||||
&window_state, c->response.get(),
|
||||
google::protobuf::NewCallback(this, &PlatformApiStub::handle_update_window_state_response, c.get()));
|
||||
|
||||
update_window_state_wait_handle_.wait_for_all();
|
||||
|
|
@ -78,28 +76,4 @@ void PlatformApiStub::update_window_state() {
|
|||
void PlatformApiStub::handle_update_window_state_response(Request<protobuf::rpc::Void> *request) {
|
||||
update_window_state_wait_handle_.result_received();
|
||||
}
|
||||
|
||||
void PlatformApiStub::remove_window() {
|
||||
auto c = std::make_shared<Request<protobuf::rpc::Void>>();
|
||||
|
||||
ALOGI("Remove window");
|
||||
|
||||
{
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
remove_window_wait_handle_.expect_result();
|
||||
}
|
||||
|
||||
protobuf::rpc::Void message;
|
||||
|
||||
rpc_channel_->call_method(
|
||||
"remove_window",
|
||||
&message, c->response.get(),
|
||||
google::protobuf::NewCallback(this, &PlatformApiStub::handle_remove_window_response, c.get()));
|
||||
|
||||
remove_window_wait_handle_.wait_for_all();
|
||||
}
|
||||
|
||||
void PlatformApiStub::handle_remove_window_response(Request<protobuf::rpc::Void> *request) {
|
||||
update_window_state_wait_handle_.result_received();
|
||||
}
|
||||
} // namespace anbox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue