Rename CancerStickCastle to RoboCaller.
The name was chosen because just like a real-world robocaller
[https://en.wikipedia.org/wiki/Robocall], webrtc::RoboCaller will
call multiple recipients and give all of them the same message,
without giving them the chance to reply.
Change-Id: Ia95f4543b15b48fa6388a50706e489dfccc19f71
Bug: webrtc:11943
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184621
Commit-Queue: Lahiru Ginnaliya Gamathige <glahiru@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32152}
diff --git a/BUILD.gn b/BUILD.gn
index d3e8f36..cec97c5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -539,7 +539,7 @@
"call:fake_network_pipe_unittests",
"p2p:libstunprober_unittests",
"p2p:rtc_p2p_unittests",
- "rtc_base:cancer_stick_castle_unittests",
+ "rtc_base:robo_caller_unittests",
"rtc_base:rtc_base_approved_unittests",
"rtc_base:rtc_base_unittests",
"rtc_base:rtc_json_unittests",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index d72bca3..4e33aa5 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -48,10 +48,10 @@
deps = [ "system:assume" ]
}
-rtc_source_set("cancer_stick_castle") {
+rtc_source_set("robo_caller") {
sources = [
- "cancer_stick_castle.cc",
- "cancer_stick_castle.h",
+ "robo_caller.cc",
+ "robo_caller.h",
]
deps = [
":untyped_function",
@@ -1073,13 +1073,13 @@
]
}
-rtc_library("cancer_stick_castle_unittests") {
+rtc_library("robo_caller_unittests") {
testonly = true
- sources = [ "cancer_stick_castle_unittest.cc" ]
+ sources = [ "robo_caller_unittest.cc" ]
deps = [
- ":cancer_stick_castle",
":gunit_helpers",
+ ":robo_caller",
":rtc_base",
"../api:function_view",
"../test:test_support",
diff --git a/rtc_base/cancer_stick_castle.cc b/rtc_base/robo_caller.cc
similarity index 61%
rename from rtc_base/cancer_stick_castle.cc
rename to rtc_base/robo_caller.cc
index 59288d7..a97687a 100644
--- a/rtc_base/cancer_stick_castle.cc
+++ b/rtc_base/robo_caller.cc
@@ -8,24 +8,24 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "rtc_base/cancer_stick_castle.h"
+#include "rtc_base/robo_caller.h"
namespace webrtc {
-namespace cancer_stick_castle_impl {
+namespace robo_caller_impl {
-CancerStickCastleReceivers::CancerStickCastleReceivers() = default;
-CancerStickCastleReceivers::~CancerStickCastleReceivers() = default;
+RoboCallerReceivers::RoboCallerReceivers() = default;
+RoboCallerReceivers::~RoboCallerReceivers() = default;
-void CancerStickCastleReceivers::AddReceiverImpl(UntypedFunction* f) {
+void RoboCallerReceivers::AddReceiverImpl(UntypedFunction* f) {
receivers_.push_back(std::move(*f));
}
-void CancerStickCastleReceivers::Foreach(
+void RoboCallerReceivers::Foreach(
rtc::FunctionView<void(UntypedFunction&)> fv) {
for (auto& r : receivers_) {
fv(r);
}
}
-} // namespace cancer_stick_castle_impl
+} // namespace robo_caller_impl
} // namespace webrtc
diff --git a/rtc_base/cancer_stick_castle.h b/rtc_base/robo_caller.h
similarity index 69%
rename from rtc_base/cancer_stick_castle.h
rename to rtc_base/robo_caller.h
index 930e289..f88bf6d 100644
--- a/rtc_base/cancer_stick_castle.h
+++ b/rtc_base/robo_caller.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef RTC_BASE_CANCER_STICK_CASTLE_H_
-#define RTC_BASE_CANCER_STICK_CASTLE_H_
+#ifndef RTC_BASE_ROBO_CALLER_H_
+#define RTC_BASE_ROBO_CALLER_H_
#include <utility>
#include <vector>
@@ -19,17 +19,16 @@
#include "rtc_base/untyped_function.h"
namespace webrtc {
-namespace cancer_stick_castle_impl {
+namespace robo_caller_impl {
-class CancerStickCastleReceivers {
+class RoboCallerReceivers {
public:
- CancerStickCastleReceivers();
- CancerStickCastleReceivers(const CancerStickCastleReceivers&) = delete;
- CancerStickCastleReceivers& operator=(const CancerStickCastleReceivers&) =
- delete;
- CancerStickCastleReceivers(CancerStickCastleReceivers&&) = delete;
- CancerStickCastleReceivers& operator=(CancerStickCastleReceivers&&) = delete;
- ~CancerStickCastleReceivers();
+ RoboCallerReceivers();
+ RoboCallerReceivers(const RoboCallerReceivers&) = delete;
+ RoboCallerReceivers& operator=(const RoboCallerReceivers&) = delete;
+ RoboCallerReceivers(RoboCallerReceivers&&) = delete;
+ RoboCallerReceivers& operator=(RoboCallerReceivers&&) = delete;
+ ~RoboCallerReceivers();
void AddReceiver(UntypedFunction&& f) {
AddReceiverImpl(&f);
@@ -45,7 +44,7 @@
std::vector<UntypedFunction> receivers_;
};
-} // namespace cancer_stick_castle_impl
+} // namespace robo_caller_impl
// A collection of receivers (callable objects) that can be called all at once.
// Optimized for minimal binary size.
@@ -58,13 +57,13 @@
// if they wish to stay in the CSC and another value if they wish to be removed.
// It depends on what's convenient for the callers...
template <typename... ArgT>
-class CancerStickCastle {
+class RoboCaller {
public:
- CancerStickCastle() = default;
- CancerStickCastle(const CancerStickCastle&) = delete;
- CancerStickCastle& operator=(const CancerStickCastle&) = delete;
- CancerStickCastle(CancerStickCastle&&) = delete;
- CancerStickCastle& operator=(CancerStickCastle&&) = delete;
+ RoboCaller() = default;
+ RoboCaller(const RoboCaller&) = delete;
+ RoboCaller& operator=(const RoboCaller&) = delete;
+ RoboCaller(RoboCaller&&) = delete;
+ RoboCaller& operator=(RoboCaller&&) = delete;
// Adds a new receiver. The receiver (a callable object or a function pointer)
// must be movable, but need not be copyable. Its call signature should be
@@ -83,9 +82,9 @@
}
private:
- cancer_stick_castle_impl::CancerStickCastleReceivers receivers_;
+ robo_caller_impl::RoboCallerReceivers receivers_;
};
} // namespace webrtc
-#endif // RTC_BASE_CANCER_STICK_CASTLE_H_
+#endif // RTC_BASE_ROBO_CALLER_H_
diff --git a/rtc_base/cancer_stick_castle_unittest.cc b/rtc_base/robo_caller_unittest.cc
similarity index 72%
rename from rtc_base/cancer_stick_castle_unittest.cc
rename to rtc_base/robo_caller_unittest.cc
index 2c993b0..cc20a7a 100644
--- a/rtc_base/cancer_stick_castle_unittest.cc
+++ b/rtc_base/robo_caller_unittest.cc
@@ -12,21 +12,21 @@
#include "api/function_view.h"
#include "rtc_base/bind.h"
-#include "rtc_base/cancer_stick_castle.h"
+#include "rtc_base/robo_caller.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
-TEST(CancerStickCastle, NoRecieverSingleMessageTest) {
- CancerStickCastle<std::string> c;
+TEST(RoboCaller, NoRecieverSingleMessageTest) {
+ RoboCaller<std::string> c;
c.Send("message");
}
-TEST(CancerStickCastle, MultipleParameterMessageTest) {
- CancerStickCastle<const std::string&, std::string, std::string&&, int, int*,
- std::string&>
+TEST(RoboCaller, MultipleParameterMessageTest) {
+ RoboCaller<const std::string&, std::string, std::string&&, int, int*,
+ std::string&>
c;
std::string str = "messege";
int i = 10;
@@ -34,14 +34,14 @@
c.Send(str, "message1", "message0", 123, &i, str);
}
-TEST(CancerStickCastle, NoParameterMessageTest) {
- CancerStickCastle<> c;
+TEST(RoboCaller, NoParameterMessageTest) {
+ RoboCaller<> c;
c.Send();
}
-TEST(CancerStickCastle, ReferenceTest) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, ReferenceTest) {
+ RoboCaller<int&> c;
int index = 1;
c.AddReceiver([](int& index) { index++; });
@@ -50,8 +50,8 @@
EXPECT_EQ(index, 2);
}
-TEST(CancerStickCastle, ConstReferenceTest) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, ConstReferenceTest) {
+ RoboCaller<int&> c;
int i = 0;
int index = 1;
@@ -61,8 +61,8 @@
EXPECT_EQ(i, 1);
}
-TEST(CancerStickCastle, PointerTest) {
- CancerStickCastle<int*> c;
+TEST(RoboCaller, PointerTest) {
+ RoboCaller<int*> c;
int index = 1;
c.AddReceiver([](int* index) { (*index)++; });
@@ -75,8 +75,8 @@
a++;
}
-TEST(CancerStickCastle, FunctionPtrTest) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, FunctionPtrTest) {
+ RoboCaller<int&> c;
int index = 1;
c.AddReceiver(PlusOne);
@@ -95,8 +95,8 @@
void operator()(int& a) { a = 1; }
};
-TEST(CancerStickCastle, LargeNonTrivialTest) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, LargeNonTrivialTest) {
+ RoboCaller<int&> c;
int i = 0;
static_assert(sizeof(LargeNonTrivial) > 16, "");
c.AddReceiver(LargeNonTrivial());
@@ -112,8 +112,8 @@
void operator()(int& x) { x = 1; }
};
-TEST(CancerStickCastle, LargeTrivial) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, LargeTrivial) {
+ RoboCaller<int&> c;
LargeTrivial lt;
int i = 0;
@@ -131,8 +131,8 @@
void operator()(int& a) { a = 1; }
};
-TEST(CancerStickCastle, OnlyNonTriviallyMoveConstructible) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, OnlyNonTriviallyMoveConstructible) {
+ RoboCaller<int&> c;
int i = 0;
c.AddReceiver(OnlyNonTriviallyConstructible());
@@ -141,8 +141,8 @@
EXPECT_EQ(i, 1);
}
-TEST(CancerStickCastle, MultipleReceiverSendTest) {
- CancerStickCastle<int&> c;
+TEST(RoboCaller, MultipleReceiverSendTest) {
+ RoboCaller<int&> c;
std::function<void(int&)> plus = PlusOne;
int index = 1;