Gut QuicClientPushPromiseIndex.
Delegate interface will be removed in a separate CL, and the class will be
removed in yet another CL.
PiperOrigin-RevId: 571096643
diff --git a/build/source_list.bzl b/build/source_list.bzl
index d4ee29d..a5f0c9c 100644
--- a/build/source_list.bzl
+++ b/build/source_list.bzl
@@ -560,7 +560,6 @@
"quic/core/http/http_decoder.cc",
"quic/core/http/http_encoder.cc",
"quic/core/http/quic_client_promised_info.cc",
- "quic/core/http/quic_client_push_promise_index.cc",
"quic/core/http/quic_header_list.cc",
"quic/core/http/quic_headers_stream.cc",
"quic/core/http/quic_receive_control_stream.cc",
@@ -1189,7 +1188,6 @@
"quic/core/http/http_decoder_test.cc",
"quic/core/http/http_encoder_test.cc",
"quic/core/http/http_frames_test.cc",
- "quic/core/http/quic_client_push_promise_index_test.cc",
"quic/core/http/quic_header_list_test.cc",
"quic/core/http/quic_headers_stream_test.cc",
"quic/core/http/quic_receive_control_stream_test.cc",
diff --git a/build/source_list.gni b/build/source_list.gni
index 733583e..b9af29c 100644
--- a/build/source_list.gni
+++ b/build/source_list.gni
@@ -560,7 +560,6 @@
"src/quiche/quic/core/http/http_decoder.cc",
"src/quiche/quic/core/http/http_encoder.cc",
"src/quiche/quic/core/http/quic_client_promised_info.cc",
- "src/quiche/quic/core/http/quic_client_push_promise_index.cc",
"src/quiche/quic/core/http/quic_header_list.cc",
"src/quiche/quic/core/http/quic_headers_stream.cc",
"src/quiche/quic/core/http/quic_receive_control_stream.cc",
@@ -1190,7 +1189,6 @@
"src/quiche/quic/core/http/http_decoder_test.cc",
"src/quiche/quic/core/http/http_encoder_test.cc",
"src/quiche/quic/core/http/http_frames_test.cc",
- "src/quiche/quic/core/http/quic_client_push_promise_index_test.cc",
"src/quiche/quic/core/http/quic_header_list_test.cc",
"src/quiche/quic/core/http/quic_headers_stream_test.cc",
"src/quiche/quic/core/http/quic_receive_control_stream_test.cc",
diff --git a/build/source_list.json b/build/source_list.json
index 71f291f..f8b86d4 100644
--- a/build/source_list.json
+++ b/build/source_list.json
@@ -559,7 +559,6 @@
"quiche/quic/core/http/http_decoder.cc",
"quiche/quic/core/http/http_encoder.cc",
"quiche/quic/core/http/quic_client_promised_info.cc",
- "quiche/quic/core/http/quic_client_push_promise_index.cc",
"quiche/quic/core/http/quic_header_list.cc",
"quiche/quic/core/http/quic_headers_stream.cc",
"quiche/quic/core/http/quic_receive_control_stream.cc",
@@ -1189,7 +1188,6 @@
"quiche/quic/core/http/http_decoder_test.cc",
"quiche/quic/core/http/http_encoder_test.cc",
"quiche/quic/core/http/http_frames_test.cc",
- "quiche/quic/core/http/quic_client_push_promise_index_test.cc",
"quiche/quic/core/http/quic_header_list_test.cc",
"quiche/quic/core/http/quic_headers_stream_test.cc",
"quiche/quic/core/http/quic_receive_control_stream_test.cc",
diff --git a/quiche/quic/core/http/quic_client_promised_info.cc b/quiche/quic/core/http/quic_client_promised_info.cc
index 54369b8..bc1dabe 100644
--- a/quiche/quic/core/http/quic_client_promised_info.cc
+++ b/quiche/quic/core/http/quic_client_promised_info.cc
@@ -120,10 +120,4 @@
return FinalValidation();
}
-void QuicClientPromisedInfo::Cancel() {
- // Don't fire OnRendezvousResult() for client initiated cancel.
- client_request_delegate_ = nullptr;
- Reset(QUIC_STREAM_CANCELLED);
-}
-
} // namespace quic
diff --git a/quiche/quic/core/http/quic_client_promised_info.h b/quiche/quic/core/http/quic_client_promised_info.h
index 84fbf4f..2adfc38 100644
--- a/quiche/quic/core/http/quic_client_promised_info.h
+++ b/quiche/quic/core/http/quic_client_promised_info.h
@@ -27,8 +27,7 @@
// stream from the time a PUSH_PROMISE is received until rendezvous
// between the promised response and the corresponding client request
// is complete.
-class QUICHE_EXPORT QuicClientPromisedInfo
- : public QuicClientPushPromiseIndex::TryHandle {
+class QUICHE_EXPORT QuicClientPromisedInfo {
public:
// Interface to QuicSpdyClientStream
QuicClientPromisedInfo(QuicSpdyClientSessionBase* session, QuicStreamId id,
@@ -51,8 +50,6 @@
const spdy::Http2HeaderBlock& headers,
QuicClientPushPromiseIndex::Delegate* delegate);
- void Cancel() override;
-
void Reset(QuicRstStreamErrorCode error_code);
// Client requests are initially associated to promises by matching
diff --git a/quiche/quic/core/http/quic_client_push_promise_index.cc b/quiche/quic/core/http/quic_client_push_promise_index.cc
deleted file mode 100644
index 00ac30a..0000000
--- a/quiche/quic/core/http/quic_client_push_promise_index.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "quiche/quic/core/http/quic_client_push_promise_index.h"
-
-#include <string>
-
-#include "quiche/quic/core/http/quic_client_promised_info.h"
-#include "quiche/quic/core/http/spdy_server_push_utils.h"
-
-namespace quic {
-
-QuicClientPushPromiseIndex::QuicClientPushPromiseIndex() {}
-
-QuicClientPushPromiseIndex::~QuicClientPushPromiseIndex() {}
-
-QuicClientPushPromiseIndex::TryHandle::~TryHandle() {}
-
-QuicClientPromisedInfo* QuicClientPushPromiseIndex::GetPromised(
- const std::string& url) {
- auto it = promised_by_url_.find(url);
- if (it == promised_by_url_.end()) {
- return nullptr;
- }
- return it->second;
-}
-
-QuicAsyncStatus QuicClientPushPromiseIndex::Try(
- const spdy::Http2HeaderBlock& request,
- QuicClientPushPromiseIndex::Delegate* delegate, TryHandle** handle) {
- std::string url(SpdyServerPushUtils::GetPromisedUrlFromHeaders(request));
- auto it = promised_by_url_.find(url);
- if (it != promised_by_url_.end()) {
- QuicClientPromisedInfo* promised = it->second;
- QuicAsyncStatus rv = promised->HandleClientRequest(request, delegate);
- if (rv == QUIC_PENDING) {
- *handle = promised;
- }
- return rv;
- }
- return QUIC_FAILURE;
-}
-
-} // namespace quic
diff --git a/quiche/quic/core/http/quic_client_push_promise_index.h b/quiche/quic/core/http/quic_client_push_promise_index.h
index 2492c23..740c1a5 100644
--- a/quiche/quic/core/http/quic_client_push_promise_index.h
+++ b/quiche/quic/core/http/quic_client_push_promise_index.h
@@ -5,8 +5,6 @@
#ifndef QUICHE_QUIC_CORE_HTTP_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_
#define QUICHE_QUIC_CORE_HTTP_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_
-#include <string>
-
#include "quiche/quic/core/http/quic_spdy_client_session_base.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/platform/api/quic_export.h"
@@ -14,12 +12,7 @@
namespace quic {
-// QuicClientPushPromiseIndex is the interface to support rendezvous
-// between client requests and resources delivered via server push.
-// The same index can be shared across multiple sessions (e.g. for the
-// same browser users profile), since cross-origin pushes are allowed
-// (subject to authority constraints).
-
+// TODO(b/171463363): Remove.
class QUICHE_EXPORT QuicClientPushPromiseIndex {
public:
// Delegate is used to complete the rendezvous that began with
@@ -47,51 +40,6 @@
// retry purposes.
virtual void OnRendezvousResult(QuicSpdyStream* stream) = 0;
};
-
- class QUICHE_EXPORT TryHandle {
- public:
- // Cancel the request.
- virtual void Cancel() = 0;
-
- protected:
- TryHandle() {}
- TryHandle(const TryHandle&) = delete;
- TryHandle& operator=(const TryHandle&) = delete;
- ~TryHandle();
- };
-
- QuicClientPushPromiseIndex();
- QuicClientPushPromiseIndex(const QuicClientPushPromiseIndex&) = delete;
- QuicClientPushPromiseIndex& operator=(const QuicClientPushPromiseIndex&) =
- delete;
- virtual ~QuicClientPushPromiseIndex();
-
- // Called by client code, used to enforce affinity between requests
- // for promised streams and the session the promise came from.
- QuicClientPromisedInfo* GetPromised(const std::string& url);
-
- // Called by client code, to initiate rendezvous between a request
- // and a server push stream. If |request|'s url is in the index,
- // rendezvous will be attempted and may complete immediately or
- // asynchronously. If the matching promise and response headers
- // have already arrived, the delegate's methods will fire
- // recursively from within |Try()|. Returns |QUIC_SUCCESS| if the
- // rendezvous was a success. Returns |QUIC_FAILURE| if there was no
- // matching promise, or if there was but the rendezvous has failed.
- // Returns QUIC_PENDING if a matching promise was found, but the
- // rendezvous needs to complete asynchronously because the promised
- // response headers are not yet available. If result is
- // QUIC_PENDING, then |*handle| will set so that the caller may
- // cancel the request if need be. The caller does not inherit
- // ownership of |*handle|, and it ceases to be valid if the caller
- // invokes |handle->Cancel()| or if |delegate->OnReponse()| fires.
- QuicAsyncStatus Try(const spdy::Http2HeaderBlock& request, Delegate* delegate,
- TryHandle** handle);
-
- QuicPromisedByUrlMap* promised_by_url() { return &promised_by_url_; }
-
- private:
- QuicPromisedByUrlMap promised_by_url_;
};
} // namespace quic
diff --git a/quiche/quic/core/http/quic_client_push_promise_index_test.cc b/quiche/quic/core/http/quic_client_push_promise_index_test.cc
deleted file mode 100644
index 58104fd..0000000
--- a/quiche/quic/core/http/quic_client_push_promise_index_test.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "quiche/quic/core/http/quic_client_push_promise_index.h"
-
-#include <string>
-
-#include "quiche/quic/core/http/quic_spdy_client_session.h"
-#include "quiche/quic/core/http/spdy_server_push_utils.h"
-#include "quiche/quic/platform/api/quic_test.h"
-#include "quiche/quic/test_tools/crypto_test_utils.h"
-#include "quiche/quic/test_tools/mock_quic_client_promised_info.h"
-#include "quiche/quic/test_tools/quic_spdy_session_peer.h"
-#include "quiche/quic/test_tools/quic_test_utils.h"
-
-using testing::_;
-using testing::Return;
-using testing::StrictMock;
-
-namespace quic {
-namespace test {
-namespace {
-
-class MockQuicSpdyClientSession : public QuicSpdyClientSession {
- public:
- explicit MockQuicSpdyClientSession(
- const ParsedQuicVersionVector& supported_versions,
- QuicConnection* connection,
- QuicClientPushPromiseIndex* push_promise_index)
- : QuicSpdyClientSession(DefaultQuicConfig(), supported_versions,
- connection,
- QuicServerId("example.com", 443, false),
- &crypto_config_, push_promise_index),
- crypto_config_(crypto_test_utils::ProofVerifierForTesting()) {}
- MockQuicSpdyClientSession(const MockQuicSpdyClientSession&) = delete;
- MockQuicSpdyClientSession& operator=(const MockQuicSpdyClientSession&) =
- delete;
- ~MockQuicSpdyClientSession() override {}
-
- private:
- QuicCryptoClientConfig crypto_config_;
-};
-
-class QuicClientPushPromiseIndexTest : public QuicTest {
- public:
- QuicClientPushPromiseIndexTest()
- : connection_(new StrictMock<MockQuicConnection>(
- &helper_, &alarm_factory_, Perspective::IS_CLIENT)),
- session_(connection_->supported_versions(), connection_, &index_),
- promised_(&session_,
- GetNthServerInitiatedUnidirectionalStreamId(
- connection_->transport_version(), 0),
- url_) {
- request_[":path"] = "/bar";
- request_[":authority"] = "www.google.com";
- request_[":method"] = "GET";
- request_[":scheme"] = "https";
- url_ = SpdyServerPushUtils::GetPromisedUrlFromHeaders(request_);
- }
-
- MockQuicConnectionHelper helper_;
- MockAlarmFactory alarm_factory_;
- StrictMock<MockQuicConnection>* connection_;
- MockQuicSpdyClientSession session_;
- QuicClientPushPromiseIndex index_;
- spdy::Http2HeaderBlock request_;
- std::string url_;
- MockQuicClientPromisedInfo promised_;
- QuicClientPushPromiseIndex::TryHandle* handle_;
-};
-
-TEST_F(QuicClientPushPromiseIndexTest, TryRequestSuccess) {
- (*index_.promised_by_url())[url_] = &promised_;
- EXPECT_CALL(promised_, HandleClientRequest(_, _))
- .WillOnce(Return(QUIC_SUCCESS));
- EXPECT_EQ(index_.Try(request_, nullptr, &handle_), QUIC_SUCCESS);
-}
-
-TEST_F(QuicClientPushPromiseIndexTest, TryRequestPending) {
- (*index_.promised_by_url())[url_] = &promised_;
- EXPECT_CALL(promised_, HandleClientRequest(_, _))
- .WillOnce(Return(QUIC_PENDING));
- EXPECT_EQ(index_.Try(request_, nullptr, &handle_), QUIC_PENDING);
-}
-
-TEST_F(QuicClientPushPromiseIndexTest, TryRequestFailure) {
- (*index_.promised_by_url())[url_] = &promised_;
- EXPECT_CALL(promised_, HandleClientRequest(_, _))
- .WillOnce(Return(QUIC_FAILURE));
- EXPECT_EQ(index_.Try(request_, nullptr, &handle_), QUIC_FAILURE);
-}
-
-TEST_F(QuicClientPushPromiseIndexTest, TryNoPromise) {
- EXPECT_EQ(index_.Try(request_, nullptr, &handle_), QUIC_FAILURE);
-}
-
-TEST_F(QuicClientPushPromiseIndexTest, GetNoPromise) {
- EXPECT_EQ(index_.GetPromised(url_), nullptr);
-}
-
-TEST_F(QuicClientPushPromiseIndexTest, GetPromise) {
- (*index_.promised_by_url())[url_] = &promised_;
- EXPECT_EQ(index_.GetPromised(url_), &promised_);
-}
-
-} // namespace
-} // namespace test
-} // namespace quic