Loading system/common/message_loop_thread.h +42 −1 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ #include <unistd.h> #include <future> #include <memory> #include <string> #include <thread> #include "abstract_message_loop.h" #include "gd/common/contextual_callback.h" #include "gd/common/i_postable_context.h" namespace bluetooth { Loading Loading @@ -172,6 +172,47 @@ class MessageLoopThread final : public IPostableContext { */ void Post(base::OnceClosure closure) override; template <typename Functor, typename... Args> common::ContextualOnceCallback<common::MakeUnboundRunType<Functor, Args...>> BindOnce(Functor&& functor, Args&&... args) { return common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, Args...>>( common::BindOnce(std::forward<Functor>(functor), std::forward<Args>(args)...), this); } template <typename Functor, typename T, typename... Args> common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, T, Args...>> BindOnceOn(T* obj, Functor&& functor, Args&&... args) { return common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, T, Args...>>( common::BindOnce(std::forward<Functor>(functor), common::Unretained(obj), std::forward<Args>(args)...), this); } template <typename Functor, typename... Args> common::ContextualCallback<common::MakeUnboundRunType<Functor, Args...>> Bind( Functor&& functor, Args&&... args) { return common::ContextualCallback< common::MakeUnboundRunType<Functor, Args...>>( common::Bind(std::forward<Functor>(functor), std::forward<Args>(args)...), this); } template <typename Functor, typename T, typename... Args> common::ContextualCallback<common::MakeUnboundRunType<Functor, T, Args...>> BindOn(T* obj, Functor&& functor, Args&&... args) { return common::ContextualCallback< common::MakeUnboundRunType<Functor, T, Args...>>( common::Bind(std::forward<Functor>(functor), common::Unretained(obj), std::forward<Args>(args)...), this); } private: /** * Static method to run the thread Loading system/gd/common/contextual_callback.h +3 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ #pragma once #include "common/bind.h" #include "common/callback.h" #include "common/i_postable_context.h" #include "bind.h" #include "callback.h" #include "i_postable_context.h" namespace bluetooth { namespace common { Loading Loading
system/common/message_loop_thread.h +42 −1 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ #include <unistd.h> #include <future> #include <memory> #include <string> #include <thread> #include "abstract_message_loop.h" #include "gd/common/contextual_callback.h" #include "gd/common/i_postable_context.h" namespace bluetooth { Loading Loading @@ -172,6 +172,47 @@ class MessageLoopThread final : public IPostableContext { */ void Post(base::OnceClosure closure) override; template <typename Functor, typename... Args> common::ContextualOnceCallback<common::MakeUnboundRunType<Functor, Args...>> BindOnce(Functor&& functor, Args&&... args) { return common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, Args...>>( common::BindOnce(std::forward<Functor>(functor), std::forward<Args>(args)...), this); } template <typename Functor, typename T, typename... Args> common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, T, Args...>> BindOnceOn(T* obj, Functor&& functor, Args&&... args) { return common::ContextualOnceCallback< common::MakeUnboundRunType<Functor, T, Args...>>( common::BindOnce(std::forward<Functor>(functor), common::Unretained(obj), std::forward<Args>(args)...), this); } template <typename Functor, typename... Args> common::ContextualCallback<common::MakeUnboundRunType<Functor, Args...>> Bind( Functor&& functor, Args&&... args) { return common::ContextualCallback< common::MakeUnboundRunType<Functor, Args...>>( common::Bind(std::forward<Functor>(functor), std::forward<Args>(args)...), this); } template <typename Functor, typename T, typename... Args> common::ContextualCallback<common::MakeUnboundRunType<Functor, T, Args...>> BindOn(T* obj, Functor&& functor, Args&&... args) { return common::ContextualCallback< common::MakeUnboundRunType<Functor, T, Args...>>( common::Bind(std::forward<Functor>(functor), common::Unretained(obj), std::forward<Args>(args)...), this); } private: /** * Static method to run the thread Loading
system/gd/common/contextual_callback.h +3 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ #pragma once #include "common/bind.h" #include "common/callback.h" #include "common/i_postable_context.h" #include "bind.h" #include "callback.h" #include "i_postable_context.h" namespace bluetooth { namespace common { Loading