Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c381ee0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Replace usage of base::Callback with std::function"

parents c596830f 40e78443
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -26,13 +26,10 @@ cc_defaults {
        "-Werror",
        "-Werror",
        "-Wno-unused-parameter",
        "-Wno-unused-parameter",


        // for libchrome
        "-Wno-sign-promo",
    ],
    ],
    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
    shared_libs: [
    shared_libs: [
        "libbinder",
        "libbinder",
        "libchrome",
        "libutils",
        "libutils",
    ],
    ],
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@


#include <binderwrapper/binder_wrapper.h>
#include <binderwrapper/binder_wrapper.h>


#include <base/logging.h>
#include <android-base/logging.h>


#include "real_binder_wrapper.h"
#include "real_binder_wrapper.h"


+1 −2
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
#ifndef SYSTEM_CORE_INCLUDE_BINDERWRAPPER_BINDER_TEST_BASE_H_
#ifndef SYSTEM_CORE_INCLUDE_BINDERWRAPPER_BINDER_TEST_BASE_H_
#define SYSTEM_CORE_INCLUDE_BINDERWRAPPER_BINDER_TEST_BASE_H_
#define SYSTEM_CORE_INCLUDE_BINDERWRAPPER_BINDER_TEST_BASE_H_


#include <base/macros.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>


namespace android {
namespace android {
@@ -37,7 +36,7 @@ class BinderTestBase : public ::testing::Test {
  StubBinderWrapper* binder_wrapper_;  // Not owned.
  StubBinderWrapper* binder_wrapper_;  // Not owned.


 private:
 private:
  DISALLOW_COPY_AND_ASSIGN(BinderTestBase);
   BinderTestBase(const BinderTestBase&) = delete;
};
};


}  // namespace android
}  // namespace android
+3 −4
Original line number Original line Diff line number Diff line
@@ -19,9 +19,9 @@


#include <sys/types.h>
#include <sys/types.h>


#include <functional>
#include <string>
#include <string>


#include <base/callback.h>
#include <utils/StrongPointer.h>
#include <utils/StrongPointer.h>


namespace android {
namespace android {
@@ -68,9 +68,8 @@ class BinderWrapper {


  // Registers |callback| to be invoked when |binder| dies. If another callback
  // Registers |callback| to be invoked when |binder| dies. If another callback
  // is currently registered for |binder|, it will be replaced.
  // is currently registered for |binder|, it will be replaced.
  virtual bool RegisterForDeathNotifications(
  virtual bool RegisterForDeathNotifications(const sp<IBinder>& binder,
      const sp<IBinder>& binder,
                                             const std::function<void()>&) = 0;
      const ::base::Closure& callback) = 0;


  // Unregisters the callback, if any, for |binder|.
  // Unregisters the callback, if any, for |binder|.
  virtual bool UnregisterForDeathNotifications(const sp<IBinder>& binder) = 0;
  virtual bool UnregisterForDeathNotifications(const sp<IBinder>& binder) = 0;
+3 −4
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@
#include <string>
#include <string>
#include <vector>
#include <vector>


#include <base/macros.h>
#include <binder/Binder.h>
#include <binder/Binder.h>
#include <binder/IBinder.h>
#include <binder/IBinder.h>
#include <binderwrapper/binder_wrapper.h>
#include <binderwrapper/binder_wrapper.h>
@@ -98,7 +97,7 @@ class StubBinderWrapper : public BinderWrapper {
                       const sp<IBinder>& binder) override;
                       const sp<IBinder>& binder) override;
  sp<BBinder> CreateLocalBinder() override;
  sp<BBinder> CreateLocalBinder() override;
  bool RegisterForDeathNotifications(const sp<IBinder>& binder,
  bool RegisterForDeathNotifications(const sp<IBinder>& binder,
                                     const ::base::Closure& callback) override;
                                     const std::function<void()>& callback) override;
  bool UnregisterForDeathNotifications(const sp<IBinder>& binder) override;
  bool UnregisterForDeathNotifications(const sp<IBinder>& binder) override;
  uid_t GetCallingUid() override;
  uid_t GetCallingUid() override;
  pid_t GetCallingPid() override;
  pid_t GetCallingPid() override;
@@ -119,13 +118,13 @@ class StubBinderWrapper : public BinderWrapper {


  // Map from binder handle to the callback that should be invoked on binder
  // Map from binder handle to the callback that should be invoked on binder
  // death.
  // death.
  std::map<sp<IBinder>, ::base::Closure> death_callbacks_;
  std::map<sp<IBinder>, std::function<void()>> death_callbacks_;


  // Values to return from GetCallingUid() and GetCallingPid();
  // Values to return from GetCallingUid() and GetCallingPid();
  uid_t calling_uid_;
  uid_t calling_uid_;
  pid_t calling_pid_;
  pid_t calling_pid_;


  DISALLOW_COPY_AND_ASSIGN(StubBinderWrapper);
  StubBinderWrapper(const StubBinderWrapper&) = delete;
};
};


}  // namespace android
}  // namespace android
Loading