Commit 5d9e4016 authored by tyoshino's avatar tyoshino Committed by Commit bot

Remove unused class BufferedPeer

R=jochen@chromium.org
BUG=none

Review-Url: https://codereview.chromium.org/2572513004
Cr-Commit-Position: refs/heads/master@{#438788}
parent cf43a3b2
...@@ -115,51 +115,6 @@ void ProcessResponseInfo(const content::ResourceResponseInfo& info_in, ...@@ -115,51 +115,6 @@ void ProcessResponseInfo(const content::ResourceResponseInfo& info_in,
info_out->headers = new_headers; info_out->headers = new_headers;
} }
////////////////////////////////////////////////////////////////////////////////
// BufferedPeer
BufferedPeer::BufferedPeer(std::unique_ptr<content::RequestPeer> peer,
const std::string& mime_type)
: SecurityFilterPeer(std::move(peer)), mime_type_(mime_type) {}
BufferedPeer::~BufferedPeer() {
}
void BufferedPeer::OnReceivedResponse(
const content::ResourceResponseInfo& info) {
ProcessResponseInfo(info, &response_info_, mime_type_);
}
void BufferedPeer::OnReceivedData(std::unique_ptr<ReceivedData> data) {
data_.append(data->payload(), data->length());
}
void BufferedPeer::OnCompletedRequest(int error_code,
bool was_ignored_by_handler,
bool stale_copy_in_cache,
const base::TimeTicks& completion_time,
int64_t total_transfer_size,
int64_t encoded_body_size) {
// Give sub-classes a chance at altering the data.
if (error_code != net::OK || !DataReady()) {
// Pretend we failed to load the resource.
original_peer_->OnReceivedResponse(response_info_);
original_peer_->OnCompletedRequest(net::ERR_ABORTED, false,
stale_copy_in_cache, completion_time,
total_transfer_size, encoded_body_size);
return;
}
original_peer_->OnReceivedResponse(response_info_);
if (!data_.empty()) {
original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
data_.data(), data_.size()));
}
original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
stale_copy_in_cache, completion_time,
total_transfer_size, encoded_body_size);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ReplaceContentPeer // ReplaceContentPeer
......
...@@ -50,40 +50,6 @@ class SecurityFilterPeer : public content::RequestPeer { ...@@ -50,40 +50,6 @@ class SecurityFilterPeer : public content::RequestPeer {
DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer);
}; };
// The BufferedPeer reads all the data of the request into an internal buffer.
// Subclasses should implement DataReady() to process the data as necessary.
class BufferedPeer : public SecurityFilterPeer {
public:
BufferedPeer(std::unique_ptr<content::RequestPeer> peer,
const std::string& mime_type);
~BufferedPeer() override;
// content::RequestPeer Implementation.
void OnReceivedResponse(const content::ResourceResponseInfo& info) override;
void OnReceivedData(std::unique_ptr<ReceivedData> data) override;
void OnCompletedRequest(int error_code,
bool was_ignored_by_handler,
bool stale_copy_in_cache,
const base::TimeTicks& completion_time,
int64_t total_transfer_size,
int64_t encoded_body_size) override;
protected:
// Invoked when the entire request has been processed before the data is sent
// to the original peer, giving an opportunity to subclasses to process the
// data in data_. If this method returns true, the data is fed to the
// original peer, if it returns false, an error is sent instead.
virtual bool DataReady() = 0;
content::ResourceResponseInfo response_info_;
std::string data_;
private:
std::string mime_type_;
DISALLOW_COPY_AND_ASSIGN(BufferedPeer);
};
// The ReplaceContentPeer cancels the request and serves the provided data as // The ReplaceContentPeer cancels the request and serves the provided data as
// content instead. // content instead.
// TODO(jcampan): For now the resource is still being fetched, but ignored, as // TODO(jcampan): For now the resource is still being fetched, but ignored, as
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment