1*1a96fba6SXin Li /* 2*1a96fba6SXin Li * Copyright (C) 2015 The Android Open Source Project 3*1a96fba6SXin Li * 4*1a96fba6SXin Li * Licensed under the Apache License, Version 2.0 (the "License"); 5*1a96fba6SXin Li * you may not use this file except in compliance with the License. 6*1a96fba6SXin Li * You may obtain a copy of the License at 7*1a96fba6SXin Li * 8*1a96fba6SXin Li * http://www.apache.org/licenses/LICENSE-2.0 9*1a96fba6SXin Li * 10*1a96fba6SXin Li * Unless required by applicable law or agreed to in writing, software 11*1a96fba6SXin Li * distributed under the License is distributed on an "AS IS" BASIS, 12*1a96fba6SXin Li * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*1a96fba6SXin Li * See the License for the specific language governing permissions and 14*1a96fba6SXin Li * limitations under the License. 15*1a96fba6SXin Li */ 16*1a96fba6SXin Li 17*1a96fba6SXin Li #ifndef LIBBRILLO_BRILLO_BINDER_WATCHER_H_ 18*1a96fba6SXin Li #define LIBBRILLO_BRILLO_BINDER_WATCHER_H_ 19*1a96fba6SXin Li 20*1a96fba6SXin Li #include <memory> 21*1a96fba6SXin Li 22*1a96fba6SXin Li #include <base/files/file_descriptor_watcher_posix.h> 23*1a96fba6SXin Li #include <base/macros.h> 24*1a96fba6SXin Li 25*1a96fba6SXin Li namespace brillo { 26*1a96fba6SXin Li 27*1a96fba6SXin Li // Bridge between libbinder and brillo::MessageLoop. Construct at startup to 28*1a96fba6SXin Li // make the message loop watch for binder events and pass them to libbinder. 29*1a96fba6SXin Li class BinderWatcher final { 30*1a96fba6SXin Li public: 31*1a96fba6SXin Li BinderWatcher(); 32*1a96fba6SXin Li ~BinderWatcher(); 33*1a96fba6SXin Li 34*1a96fba6SXin Li // Initializes the object, returning true on success. 35*1a96fba6SXin Li bool Init(); 36*1a96fba6SXin Li 37*1a96fba6SXin Li private: 38*1a96fba6SXin Li std::unique_ptr<base::FileDescriptorWatcher::Controller> watcher_; 39*1a96fba6SXin Li 40*1a96fba6SXin Li DISALLOW_COPY_AND_ASSIGN(BinderWatcher); 41*1a96fba6SXin Li }; 42*1a96fba6SXin Li 43*1a96fba6SXin Li } // namespace brillo 44*1a96fba6SXin Li 45*1a96fba6SXin Li #endif // LIBBRILLO_BRILLO_BINDER_WATCHER_H_ 46