Use events instead of method invokes for window state updates and others

This commit is contained in:
Simon Fels 2016-11-25 08:50:43 +01:00
commit a40fe51654
14 changed files with 152 additions and 133 deletions

View file

@ -21,16 +21,14 @@
#include "anbox/common/wait_handle.h"
#include <memory>
#include <vector>
#include <string>
namespace anbox {
namespace protobuf {
namespace rpc {
class Void;
class WindowStateUpdate;
} // namespace rpc
namespace bridge {
class WindowStateUpdate;
} // namespace bridge
} // namespace protobuf
namespace rpc {
class Channel;
@ -40,7 +38,27 @@ public:
PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channel);
void boot_finished();
void update_window_state(const anbox::protobuf::bridge::WindowStateUpdate &window_state);
struct WindowStateUpdate {
struct Window {
int display_id;
bool has_surface;
std::string package_name;
struct Frame {
int left;
int top;
int right;
int bottom;
};
Frame frame;
int task_id;
int stack_id;
};
std::vector<Window> updated_windows;
std::vector<Window> removed_windows;
};
void update_window_state(const WindowStateUpdate &state);
private:
template<typename Response>
@ -50,12 +68,7 @@ private:
bool success;
};
void handle_boot_finished_response(Request<protobuf::rpc::Void> *request);
void handle_update_window_state_response(Request<protobuf::rpc::Void> *request);
mutable std::mutex mutex_;
common::WaitHandle boot_finished_wait_handle_;
common::WaitHandle update_window_state_wait_handle_;
std::shared_ptr<rpc::Channel> rpc_channel_;
};