Skip to content

Commit

Permalink
Use HandlerCallbackPtr<T> instead of std::unique_ptr<HandlerCallback<…
Browse files Browse the repository at this point in the history
…T>> (part 2)

Summary:
This is a follow-up of {D55937714} with some cases missed from the original codemod because of whitespaces not being accounted for in the regex. Like the parent diff, this is a no-op.

```
$ codemod -m '(std::)?unique_ptr\s*<\s*(apache::thrift::)?HandlerCallback\s*<(.*?)>\s*' '\2HandlerCallbackPtr<\3'
```

Reviewed By: thedavekwon

Differential Revision: D55983582

fbshipit-source-id: 3181ad2a96a4ed24355a6148cd18d37dbdb0e3e6
  • Loading branch information
praihan authored and facebook-github-bot committed Apr 11, 2024
1 parent 97c6e32 commit e8d1870
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
12 changes: 4 additions & 8 deletions thrift/lib/cpp2/test/InteractionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,7 @@ TEST(InteractionCodegenTest, FactoryHandlerCallback) {
THRIFT_FLAG_SET_MOCK(enable_resource_pools_for_interaction, true);
struct HandlerResult : apache::thrift::ServiceHandler<Calculator> {
void async_tm_newAddition(
std::unique_ptr<
apache::thrift::HandlerCallback<TileAndResponse<AdditionIf, void>>>
apache::thrift::HandlerCallbackPtr<TileAndResponse<AdditionIf, void>>
cb) override {
auto handler =
std::make_unique<SemiCalculatorHandler::SemiAdditionHandler>();
Expand Down Expand Up @@ -1385,8 +1384,7 @@ TEST(InteractionCodegenTest, FactoryHandlerCallback) {

struct HandlerComplete : apache::thrift::ServiceHandler<Calculator> {
void async_tm_newAddition(
std::unique_ptr<
apache::thrift::HandlerCallback<TileAndResponse<AdditionIf, void>>>
apache::thrift::HandlerCallbackPtr<TileAndResponse<AdditionIf, void>>
cb) override {
auto handler =
std::make_unique<SemiCalculatorHandler::SemiAdditionHandler>();
Expand Down Expand Up @@ -1420,8 +1418,7 @@ TEST(InteractionCodegenTest, FactoryHandlerCallback) {

struct HandlerException : apache::thrift::ServiceHandler<Calculator> {
void async_tm_newAddition(
std::unique_ptr<
apache::thrift::HandlerCallback<TileAndResponse<AdditionIf, void>>>
apache::thrift::HandlerCallbackPtr<TileAndResponse<AdditionIf, void>>
cb) override {
cb->exception(std::runtime_error("foo"));
}
Expand All @@ -1435,8 +1432,7 @@ TEST(InteractionCodegenTest, FactoryHandlerCallback) {

struct HandlerDrop : apache::thrift::ServiceHandler<Calculator> {
void async_tm_newAddition(
std::unique_ptr<
apache::thrift::HandlerCallback<TileAndResponse<AdditionIf, void>>>
apache::thrift::HandlerCallbackPtr<TileAndResponse<AdditionIf, void>>
cb) override {
(void)cb; // oops!
}
Expand Down
3 changes: 1 addition & 2 deletions thrift/lib/cpp2/test/server/ThriftServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3097,8 +3097,7 @@ class ServerResponseEnqueuedInterface : public TestInterface {
: responseEnqueuedBaton_(responseEnqueuedBaton) {}

void async_eb_eventBaseAsync(
std::unique_ptr<
apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>
apache::thrift::HandlerCallbackPtr<std::unique_ptr<::std::string>>
callback) override {
// Since `eventBaseAsync` is a `thread = 'eb'` method, this runs on
// the IO thread, and we can guarantee that the baton is posted
Expand Down
5 changes: 2 additions & 3 deletions thrift/lib/cpp2/transport/rocket/server/test/FdSocketTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ struct ServerResponseEnqueuedInterface : public TestInterface {
: sendQueue_(sendQueue), responseEnqueuedBaton_(responseEnqueuedBaton) {}

void async_eb_eventBaseAsync(
std::unique_ptr<
apache::thrift::HandlerCallback<std::unique_ptr<std::string>>>
callback) override {
apache::thrift::HandlerCallbackPtr<std::unique_ptr<std::string>> callback)
override {
MessagePair resPair;
CHECK(sendQueue_->read(resPair));
auto& [outData, outFds] = resPair;
Expand Down
3 changes: 1 addition & 2 deletions thrift/test/IOBufPtrTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class IOBufPtrTestService
: public apache::thrift::ServiceHandler<IOBufPtrTestService> {
public:
void async_tm_combine(
std::unique_ptr<
apache::thrift::HandlerCallback<std::unique_ptr<IOBufPtr>>> callback,
apache::thrift::HandlerCallbackPtr<std::unique_ptr<IOBufPtr>> callback,
std::unique_ptr<Request> req) override;
};

Expand Down

0 comments on commit e8d1870

Please sign in to comment.