blob: 54b2ff297b59d7c510147c245623e63072fd80cc [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBBRILLO_BRILLO_BINDER_WATCHER_H_
#define LIBBRILLO_BRILLO_BINDER_WATCHER_H_
#include <memory>
#include <base/files/file_descriptor_watcher_posix.h>
#include <base/macros.h>
namespace brillo {
// Bridge between libbinder and brillo::MessageLoop. Construct at startup to
// make the message loop watch for binder events and pass them to libbinder.
class BinderWatcher final {
public:
BinderWatcher();
~BinderWatcher();
// Initializes the object, returning true on success.
bool Init();
private:
std::unique_ptr<base::FileDescriptorWatcher::Controller> watcher_;
DISALLOW_COPY_AND_ASSIGN(BinderWatcher);
};
} // namespace brillo
#endif // LIBBRILLO_BRILLO_BINDER_WATCHER_H_