Loading system/btif/include/btif_common.h +6 −6 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ #include <stdlib.h> #include <base/bind.h> #include <base/location.h> #include <base/message_loop/message_loop.h> #include <base/tracked_objects.h> #include <hardware/bluetooth.h> #include "bt_types.h" Loading Loading @@ -175,7 +175,7 @@ typedef struct { ******************************************************************************/ extern bt_status_t do_in_jni_thread(base::OnceClosure task); extern bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, extern bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task); extern bool is_on_jni_thread(); extern base::MessageLoop* get_jni_message_loop(); Loading @@ -184,11 +184,11 @@ extern base::MessageLoop* get_jni_message_loop(); * thread */ template <typename R, typename... Args> base::Callback<R(Args...)> jni_thread_wrapper( const tracked_objects::Location& from_here, base::Callback<R(Args...)> cb) { base::Callback<R(Args...)> jni_thread_wrapper(const base::Location& from_here, base::Callback<R(Args...)> cb) { return base::Bind( [](const tracked_objects::Location& from_here, base::Callback<R(Args...)> cb, Args... args) { [](const base::Location& from_here, base::Callback<R(Args...)> cb, Args... args) { do_in_jni_thread(from_here, base::Bind(cb, std::forward<Args>(args)...)); }, Loading system/btif/src/btif_core.cc +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, * This function posts a task into the btif message loop, that executes it in * the JNI message loop. **/ bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { if (!jni_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": Post task to task runner failed!"; Loading system/btif/src/btif_hearing_aid.cc +5 −4 Original line number Diff line number Diff line Loading @@ -37,11 +37,12 @@ using bluetooth::hearing_aid::HearingAidInterface; // template specialization template <> base::Callback<void()> jni_thread_wrapper( const tracked_objects::Location& from_here, base::Callback<void()> cb) { base::Callback<void()> jni_thread_wrapper(const base::Location& from_here, base::Callback<void()> cb) { return base::Bind( [](const tracked_objects::Location& from_here, base::Callback<void()> cb) { do_in_jni_thread(from_here, cb); }, [](const base::Location& from_here, base::Callback<void()> cb) { do_in_jni_thread(from_here, cb); }, from_here, std::move(cb)); } Loading system/btif/src/btif_profile_queue.cc +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "btif_profile_queue.h" #include <base/bind.h> #include <base/callback.h> #include <base/logging.h> #include <base/strings/stringprintf.h> #include <string.h> Loading system/btif/test/btif_profile_queue_test.cc +5 −3 Original line number Diff line number Diff line Loading @@ -15,12 +15,14 @@ * limitations under the License. * ******************************************************************************/ #include "btif/include/btif_profile_queue.h" #include <gtest/gtest.h> #include <base/bind.h> #include <base/callback.h> #include <base/location.h> #include "base/location.h" #include "btif/include/btif_profile_queue.h" #include "stack_manager.h" #include "types/raw_address.h" Loading @@ -33,7 +35,7 @@ bool get_stack_is_running(void) { return sStackRunning; } static stack_manager_t sStackManager = {nullptr, nullptr, nullptr, nullptr, get_stack_is_running}; const stack_manager_t* stack_manager_get_interface() { return &sStackManager; } bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { std::move(task).Run(); return BT_STATUS_SUCCESS; Loading Loading
system/btif/include/btif_common.h +6 −6 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ #include <stdlib.h> #include <base/bind.h> #include <base/location.h> #include <base/message_loop/message_loop.h> #include <base/tracked_objects.h> #include <hardware/bluetooth.h> #include "bt_types.h" Loading Loading @@ -175,7 +175,7 @@ typedef struct { ******************************************************************************/ extern bt_status_t do_in_jni_thread(base::OnceClosure task); extern bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, extern bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task); extern bool is_on_jni_thread(); extern base::MessageLoop* get_jni_message_loop(); Loading @@ -184,11 +184,11 @@ extern base::MessageLoop* get_jni_message_loop(); * thread */ template <typename R, typename... Args> base::Callback<R(Args...)> jni_thread_wrapper( const tracked_objects::Location& from_here, base::Callback<R(Args...)> cb) { base::Callback<R(Args...)> jni_thread_wrapper(const base::Location& from_here, base::Callback<R(Args...)> cb) { return base::Bind( [](const tracked_objects::Location& from_here, base::Callback<R(Args...)> cb, Args... args) { [](const base::Location& from_here, base::Callback<R(Args...)> cb, Args... args) { do_in_jni_thread(from_here, base::Bind(cb, std::forward<Args>(args)...)); }, Loading
system/btif/src/btif_core.cc +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, * This function posts a task into the btif message loop, that executes it in * the JNI message loop. **/ bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { if (!jni_thread.DoInThread(from_here, std::move(task))) { LOG(ERROR) << __func__ << ": Post task to task runner failed!"; Loading
system/btif/src/btif_hearing_aid.cc +5 −4 Original line number Diff line number Diff line Loading @@ -37,11 +37,12 @@ using bluetooth::hearing_aid::HearingAidInterface; // template specialization template <> base::Callback<void()> jni_thread_wrapper( const tracked_objects::Location& from_here, base::Callback<void()> cb) { base::Callback<void()> jni_thread_wrapper(const base::Location& from_here, base::Callback<void()> cb) { return base::Bind( [](const tracked_objects::Location& from_here, base::Callback<void()> cb) { do_in_jni_thread(from_here, cb); }, [](const base::Location& from_here, base::Callback<void()> cb) { do_in_jni_thread(from_here, cb); }, from_here, std::move(cb)); } Loading
system/btif/src/btif_profile_queue.cc +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "btif_profile_queue.h" #include <base/bind.h> #include <base/callback.h> #include <base/logging.h> #include <base/strings/stringprintf.h> #include <string.h> Loading
system/btif/test/btif_profile_queue_test.cc +5 −3 Original line number Diff line number Diff line Loading @@ -15,12 +15,14 @@ * limitations under the License. * ******************************************************************************/ #include "btif/include/btif_profile_queue.h" #include <gtest/gtest.h> #include <base/bind.h> #include <base/callback.h> #include <base/location.h> #include "base/location.h" #include "btif/include/btif_profile_queue.h" #include "stack_manager.h" #include "types/raw_address.h" Loading @@ -33,7 +35,7 @@ bool get_stack_is_running(void) { return sStackRunning; } static stack_manager_t sStackManager = {nullptr, nullptr, nullptr, nullptr, get_stack_is_running}; const stack_manager_t* stack_manager_get_interface() { return &sStackManager; } bt_status_t do_in_jni_thread(const tracked_objects::Location& from_here, bt_status_t do_in_jni_thread(const base::Location& from_here, base::OnceClosure task) { std::move(task).Run(); return BT_STATUS_SUCCESS; Loading