Removes OnAbortStream() from the visitor interface, as OnCloseStream() serves the same purpose.

PiperOrigin-RevId: 370694387
Change-Id: I03f0d97469f2f2d4f64a275777916ecc3ff1441a
diff --git a/http2/adapter/http2_visitor_interface.h b/http2/adapter/http2_visitor_interface.h
index 765e9f4..a14f434 100644
--- a/http2/adapter/http2_visitor_interface.h
+++ b/http2/adapter/http2_visitor_interface.h
@@ -34,7 +34,7 @@
 //     - OnHeaderForStream()
 //     - OnEndHeadersForStream()
 //     - OnRstStream()
-//     - OnAbortStream()
+//     - OnCloseStream()
 //
 //   Request closed mid-stream, e.g., with error code NO_ERROR:
 //     - OnBeginHeadersForStream()
@@ -43,8 +43,7 @@
 //     - OnRstStream()
 //     - OnCloseStream()
 //
-// More details are at RFC 7540 (go/http2spec), and more examples are at
-// http://google3/net/http2/server/lib/internal/h2/nghttp2/nghttp2_server_adapter_test.cc.
+// More details are at RFC 7540 (go/http2spec).
 class Http2VisitorInterface {
  public:
   Http2VisitorInterface(const Http2VisitorInterface&) = delete;
@@ -97,18 +96,12 @@
   virtual void OnEndStream(Http2StreamId stream_id) = 0;
 
   // Called when the connection receives a RST_STREAM for a stream. This call
-  // will be followed by either OnCloseStream() or OnAbortStream().
+  // will be followed by either OnCloseStream().
   virtual void OnRstStream(Http2StreamId stream_id,
                            Http2ErrorCode error_code) = 0;
 
-  // Called when a stream is closed with error code NO_ERROR. Compare with
-  // OnAbortStream().
-  virtual void OnCloseStream(Http2StreamId stream_id) = 0;
-
-  // Called when a stream is aborted, i.e., closed for the reason indicated by
-  // the given |error_code|, where error_code != NO_ERROR. Compare with
-  // OnCloseStream().
-  virtual void OnAbortStream(Http2StreamId stream_id,
+  // Called when a stream is closed.
+  virtual void OnCloseStream(Http2StreamId stream_id,
                              Http2ErrorCode error_code) = 0;
 
   // Called when the connection receives a PRIORITY frame.
diff --git a/http2/adapter/mock_http2_visitor.h b/http2/adapter/mock_http2_visitor.h
index a5c8371..378faea 100644
--- a/http2/adapter/mock_http2_visitor.h
+++ b/http2/adapter/mock_http2_visitor.h
@@ -52,10 +52,8 @@
               (Http2StreamId stream_id, Http2ErrorCode error_code),
               (override));
 
-  MOCK_METHOD(void, OnCloseStream, (Http2StreamId stream_id), (override));
-
   MOCK_METHOD(void,
-              OnAbortStream,
+              OnCloseStream,
               (Http2StreamId stream_id, Http2ErrorCode error_code),
               (override));
 
diff --git a/http2/adapter/nghttp2_callbacks.cc b/http2/adapter/nghttp2_callbacks.cc
index b54c915..dc4962a 100644
--- a/http2/adapter/nghttp2_callbacks.cc
+++ b/http2/adapter/nghttp2_callbacks.cc
@@ -161,11 +161,7 @@
                    uint32_t error_code,
                    void* user_data) {
   auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
-  if (error_code == static_cast<uint32_t>(Http2ErrorCode::NO_ERROR)) {
-    visitor->OnCloseStream(stream_id);
-  } else {
-    visitor->OnAbortStream(stream_id, ToHttp2ErrorCode(error_code));
-  }
+  visitor->OnCloseStream(stream_id, ToHttp2ErrorCode(error_code));
   return 0;
 }
 
diff --git a/http2/adapter/nghttp2_session_test.cc b/http2/adapter/nghttp2_session_test.cc
index a369752..bfb54bf 100644
--- a/http2/adapter/nghttp2_session_test.cc
+++ b/http2/adapter/nghttp2_session_test.cc
@@ -157,7 +157,7 @@
   EXPECT_CALL(visitor_, OnBeginDataForStream(1, 26));
   EXPECT_CALL(visitor_, OnDataForStream(1, "This is the response body."));
   EXPECT_CALL(visitor_, OnRstStream(3, Http2ErrorCode::INTERNAL_ERROR));
-  EXPECT_CALL(visitor_, OnAbortStream(3, Http2ErrorCode::INTERNAL_ERROR));
+  EXPECT_CALL(visitor_, OnCloseStream(3, Http2ErrorCode::INTERNAL_ERROR));
   EXPECT_CALL(visitor_,
               OnGoAway(5, Http2ErrorCode::ENHANCE_YOUR_CALM, "calm down!!"));
   const ssize_t stream_result = session.ProcessBytes(stream_frames);
@@ -168,9 +168,9 @@
 
   EXPECT_CALL(visitor_, OnBeginDataForStream(1, 0));
   EXPECT_CALL(visitor_, OnEndStream(1));
-  EXPECT_CALL(visitor_, OnCloseStream(1));
+  EXPECT_CALL(visitor_, OnCloseStream(1, Http2ErrorCode::NO_ERROR));
   EXPECT_CALL(visitor_, OnRstStream(5, Http2ErrorCode::REFUSED_STREAM));
-  EXPECT_CALL(visitor_, OnAbortStream(5, Http2ErrorCode::REFUSED_STREAM));
+  EXPECT_CALL(visitor_, OnCloseStream(5, Http2ErrorCode::REFUSED_STREAM));
   session.ProcessBytes(TestFrameSequence()
                            .Data(1, "", true)
                            .RstStream(5, Http2ErrorCode::REFUSED_STREAM)
@@ -245,7 +245,7 @@
   EXPECT_CALL(visitor_, OnEndHeadersForStream(3));
   EXPECT_CALL(visitor_, OnEndStream(3));
   EXPECT_CALL(visitor_, OnRstStream(3, Http2ErrorCode::CANCEL));
-  EXPECT_CALL(visitor_, OnAbortStream(3, Http2ErrorCode::CANCEL));
+  EXPECT_CALL(visitor_, OnCloseStream(3, Http2ErrorCode::CANCEL));
   EXPECT_CALL(visitor_, OnPing(47, false));
 
   const ssize_t result = session.ProcessBytes(frames);
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc
index f434c3c..2582544 100644
--- a/http2/adapter/oghttp2_session.cc
+++ b/http2/adapter/oghttp2_session.cc
@@ -137,7 +137,7 @@
 void OgHttp2Session::OnRstStream(spdy::SpdyStreamId stream_id,
                                  spdy::SpdyErrorCode error_code) {
   visitor_.OnRstStream(stream_id, TranslateErrorCode(error_code));
-  visitor_.OnAbortStream(stream_id, TranslateErrorCode(error_code));
+  visitor_.OnCloseStream(stream_id, TranslateErrorCode(error_code));
 }
 
 void OgHttp2Session::OnSettings() {
diff --git a/http2/adapter/oghttp2_session_test.cc b/http2/adapter/oghttp2_session_test.cc
index 7de1514..5896c72 100644
--- a/http2/adapter/oghttp2_session_test.cc
+++ b/http2/adapter/oghttp2_session_test.cc
@@ -65,7 +65,7 @@
   EXPECT_CALL(visitor, OnBeginDataForStream(1, 26));
   EXPECT_CALL(visitor, OnDataForStream(1, "This is the response body."));
   EXPECT_CALL(visitor, OnRstStream(3, Http2ErrorCode::INTERNAL_ERROR));
-  EXPECT_CALL(visitor, OnAbortStream(3, Http2ErrorCode::INTERNAL_ERROR));
+  EXPECT_CALL(visitor, OnCloseStream(3, Http2ErrorCode::INTERNAL_ERROR));
   EXPECT_CALL(visitor, OnGoAway(5, Http2ErrorCode::ENHANCE_YOUR_CALM, ""));
   const ssize_t stream_result = session.ProcessBytes(stream_frames);
   EXPECT_EQ(stream_frames.size(), stream_result);
@@ -131,7 +131,7 @@
   EXPECT_CALL(visitor, OnEndHeadersForStream(3));
   EXPECT_CALL(visitor, OnEndStream(3));
   EXPECT_CALL(visitor, OnRstStream(3, Http2ErrorCode::CANCEL));
-  EXPECT_CALL(visitor, OnAbortStream(3, Http2ErrorCode::CANCEL));
+  EXPECT_CALL(visitor, OnCloseStream(3, Http2ErrorCode::CANCEL));
   EXPECT_CALL(visitor, OnPing(47, false));
 
   const ssize_t result = session.ProcessBytes(frames);