diff options
author | dgozman <dgozman@chromium.org> | 2016-03-22 10:57:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 17:58:58 +0000 |
commit | efc57ff133fe8722379d1f93d2accc4c8dfd4c7a (patch) | |
tree | 2d06d4887baf05b0d663cbc333f9da61a322741a /net | |
parent | b11b0f7d43111229446d89bd5910fc7de10a9d71 (diff) | |
download | chromium_src-efc57ff133fe8722379d1f93d2accc4c8dfd4c7a.zip chromium_src-efc57ff133fe8722379d1f93d2accc4c8dfd4c7a.tar.gz chromium_src-efc57ff133fe8722379d1f93d2accc4c8dfd4c7a.tar.bz2 |
Revert of Implement content_decoder_tool.cc to decode offline any resources. (patchset #4 id:60001 of https://codereview.chromium.org/1767653002/ )
Reason for revert:
Broke iOS build: https://build.chromium.org/p/chromium.mac/builders/iOS_Device/builds/44002
Original issue's description:
> Implement content_decoder_tool.cc to decode offline any resources.
>
> Sandwich is going to use the HTMLPreloadScanner to get all the
> resources to prefetch instead of using the Clovis' dependency
> graph. However resources in the chrome HTTP cache or in the WPR
> archive are stored as transport layer content, implying that they
> might be stored using a compression algorithm, according to the
> Content-Encoding response header.
>
> This tools enable us to decode any resources using the same very
> code path used in chrome, implying that we will be able to
> uncompressed absolutely all resources that chrome can and is
> advertising in its Accept-Encoding request header.
>
> BUG=582080
>
> Committed: https://crrev.com/4dc1dc6668a87620574dd43392046c3691914da2
> Cr-Commit-Position: refs/heads/master@{#382599}
TBR=pasko@chromium.org,gavinp@chromium.org,gabadie@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=582080
Review URL: https://codereview.chromium.org/1827483002
Cr-Commit-Position: refs/heads/master@{#382606}
Diffstat (limited to 'net')
-rw-r--r-- | net/net.gyp | 12 | ||||
-rw-r--r-- | net/tools/content_decoder_tool/content_decoder_tool.cc | 91 |
2 files changed, 0 insertions, 103 deletions
diff --git a/net/net.gyp b/net/net.gyp index 1ecfc35..661a019 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -791,18 +791,6 @@ ], }, { - 'target_name': 'content_decoder_tool', - 'type': 'executable', - 'dependencies': [ - '../base/base.gyp:base', - 'net', - ], - 'sources': [ - 'tools/content_decoder_tool/content_decoder_tool.cc', - 'filter/mock_filter_context.cc', - ], - }, - { 'target_name': 'dump_cache', 'type': 'executable', 'dependencies': [ diff --git a/net/tools/content_decoder_tool/content_decoder_tool.cc b/net/tools/content_decoder_tool/content_decoder_tool.cc deleted file mode 100644 index 89646eb..0000000 --- a/net/tools/content_decoder_tool/content_decoder_tool.cc +++ /dev/null @@ -1,91 +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 <iostream> - -#include "base/command_line.h" -#include "net/base/io_buffer.h" -#include "net/filter/filter.h" -#include "net/filter/mock_filter_context.h" - -using net::Filter; - -namespace { - -// Print the command line help. -void PrintHelp(const char* command_line_name) { - std::cout << command_line_name << " content_encoding [content_encoding]..." - << std::endl - << std::endl; - std::cout << "Decodes the stdin into the stdout using an content_encoding " - << "list given in arguments. This list is expected to be the " - << "Content-Encoding HTTP response header's value split by ','." - << std::endl; -} - -} // namespace - -int main(int argc, char* argv[]) { - base::CommandLine::Init(argc, argv); - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - - std::vector<std::string> content_encodings; -#if defined(OS_WIN) - base::CommandLine::StringVector wide_args = command_line.GetArgs(); - for (const auto& arg : wide_args) - content_encodings.push_back(base::WideToUTF8(arg)); -#else - content_encodings = command_line.GetArgs(); -#endif - - if (content_encodings.size() == 0) { - PrintHelp(argv[0]); - return 1; - } - - std::vector<Filter::FilterType> filter_types; - for (const auto& content_encoding : content_encodings) { - Filter::FilterType filter_type = - Filter::ConvertEncodingToType(content_encoding); - if (filter_type == Filter::FILTER_TYPE_UNSUPPORTED) { - std::cerr << "Unsupported decoder '" << content_encoding << "'." - << std::endl; - return 1; - } - filter_types.push_back(filter_type); - } - - net::MockFilterContext filter_context; - scoped_ptr<Filter> filter(Filter::Factory(filter_types, filter_context)); - if (!filter) { - std::cerr << "Couldn't create the decoder." << std::endl; - return 1; - } - - net::IOBuffer* pre_filter_buf = filter->stream_buffer(); - int pre_filter_buf_len = filter->stream_buffer_size(); - while (std::cin) { - std::cin.read(pre_filter_buf->data(), pre_filter_buf_len); - int pre_filter_data_len = std::cin.gcount(); - filter->FlushStreamBuffer(pre_filter_data_len); - - while (true) { - int kPostFilterBufLen = 4096; - char post_filter_buf[kPostFilterBufLen]; - int post_filter_data_len = kPostFilterBufLen; - Filter::FilterStatus filter_status = - filter->ReadData(post_filter_buf, &post_filter_data_len); - std::cout.write(post_filter_buf, post_filter_data_len); - if (filter_status == Filter::FILTER_ERROR) { - std::cerr << "Couldn't decode stdin." << std::endl; - return 1; - } else if (filter_status != Filter::FILTER_OK) { - break; - } - } - } - - return 0; -} |