diff options
author | huangs <huangs@chromium.org> | 2015-09-08 11:27:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-08 18:28:18 +0000 |
commit | 558063b7f257e2cbd545e8c465cd0b51803c24f5 (patch) | |
tree | 70547d799b45ec21d085fc019bbb4ff19e7f2957 /courgette | |
parent | 6cc5dbbc5fc7b3e505f1d13488810eda479dd0a6 (diff) | |
download | chromium_src-558063b7f257e2cbd545e8c465cd0b51803c24f5.zip chromium_src-558063b7f257e2cbd545e8c465cd0b51803c24f5.tar.gz chromium_src-558063b7f257e2cbd545e8c465cd0b51803c24f5.tar.bz2 |
Revert of [Courgette] Adding CourgetteConfig singleton and --experimental flag. (patchset #5 id:80001 of https://chromiumcodereview.appspot.com/1306193004/ )
Reason for revert:
The original CL assumes Courgette had to deal with forward/backward compatibility issues.
Turns out that (as seen in http://crbug.com/459505):
- Courgette executable is shipped with new releases.
- This allows Courgette workflow to proceed without being tied down to legacy.
These new (to huangs@) facts render the original CL redundant.
Original issue's description:
> [Courgette] Adding CourgetteConfig singleton and --experimental flag.
>
> This prepare for upcoming experiments to reduce patch size. We want to
> avoid disrupting existing functionality.
>
> Committed: https://crrev.com/fc0511d9067759336f42d04e918e8a3ce0b84376
> Cr-Commit-Position: refs/heads/master@{#346746}
TBR=wfh@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1323263007
Cr-Commit-Position: refs/heads/master@{#347746}
Diffstat (limited to 'courgette')
-rw-r--r-- | courgette/BUILD.gn | 2 | ||||
-rw-r--r-- | courgette/courgette.gyp | 2 | ||||
-rw-r--r-- | courgette/courgette_config.cc | 34 | ||||
-rw-r--r-- | courgette/courgette_config.h | 39 | ||||
-rw-r--r-- | courgette/courgette_tool.cc | 6 | ||||
-rw-r--r-- | courgette/ensemble_apply.cc | 7 | ||||
-rw-r--r-- | courgette/ensemble_create.cc | 7 |
7 files changed, 4 insertions, 93 deletions
diff --git a/courgette/BUILD.gn b/courgette/BUILD.gn index 2deef9c2..1ebd2ee 100644 --- a/courgette/BUILD.gn +++ b/courgette/BUILD.gn @@ -12,8 +12,6 @@ static_library("courgette_lib") { "assembly_program.cc", "assembly_program.h", "courgette.h", - "courgette_config.cc", - "courgette_config.h", "crc.cc", "crc.h", "difference_estimator.cc", diff --git a/courgette/courgette.gyp b/courgette/courgette.gyp index 5ece6e9..8ff08bc 100644 --- a/courgette/courgette.gyp +++ b/courgette/courgette.gyp @@ -12,8 +12,6 @@ 'assembly_program.cc', 'assembly_program.h', 'courgette.h', - 'courgette_config.cc', - 'courgette_config.h', 'crc.cc', 'crc.h', 'difference_estimator.cc', diff --git a/courgette/courgette_config.cc b/courgette/courgette_config.cc deleted file mode 100644 index b92e43a..0000000 --- a/courgette/courgette_config.cc +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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 "courgette/courgette_config.h" - -#include "base/command_line.h" -#include "courgette/ensemble.h" - -namespace courgette { - -namespace { - -static const uint32 kExperimentalVersion = 0xDEADBEEF; - -} // namespace - -// static -CourgetteConfig* CourgetteConfig::GetInstance() { - return Singleton<CourgetteConfig>::get(); -} - -uint32 CourgetteConfig::ensemble_version() const { - return is_experimental_ ? kExperimentalVersion : CourgettePatchFile::kVersion; -} - -void CourgetteConfig::Initialize(const base::CommandLine& command_line) { - is_experimental_ = command_line.HasSwitch("experimental"); -} - -CourgetteConfig::CourgetteConfig() : is_experimental_(false) { -} - -} // namespace courgette diff --git a/courgette/courgette_config.h b/courgette/courgette_config.h deleted file mode 100644 index cbcfc22..0000000 --- a/courgette/courgette_config.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 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. - -#ifndef COURGETTE_COURGETTE_CONFIG_H_ -#define COURGETTE_COURGETTE_CONFIG_H_ - -#include "base/macros.h" -#include "base/memory/singleton.h" - -namespace base { -class CommandLine; -} // namespace base - -namespace courgette { - -// A singleton class to hold global configurations for Courgette, mainly for -// experimental purposes. -class CourgetteConfig { - public: - static CourgetteConfig* GetInstance(); - - void Initialize(const base::CommandLine& command_line); - - bool is_experimental() const { return is_experimental_; } - - uint32 ensemble_version() const; - - private: - bool is_experimental_; - - CourgetteConfig(); - - friend struct DefaultSingletonTraits<CourgetteConfig>; -}; - -} // namespace courgette - -#endif // COURGETTE_COURGETTE_CONFIG_H_ diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index eb3e823..962e078 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -15,7 +15,6 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "courgette/courgette.h" -#include "courgette/courgette_config.h" #include "courgette/streams.h" #include "courgette/third_party/bsdiff.h" @@ -430,7 +429,6 @@ int main(int argc, const char* argv[]) { base::CommandLine::Init(argc, argv); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - courgette::CourgetteConfig::GetInstance()->Initialize(command_line); logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_ALL; @@ -472,10 +470,6 @@ int main(int argc, const char* argv[]) { " -supported -asm, -dis, -disadj, -gen or -apply, -genbsdiff" " or -applybsdiff."); - if (courgette::CourgetteConfig::GetInstance()->is_experimental()) { - fprintf(stderr, "Experimental flag enabled. Do not use in production.\n"); - } - while (repeat_count-- > 0) { if (cmd_sup) { if (values.size() != 1) diff --git a/courgette/ensemble_apply.cc b/courgette/ensemble_apply.cc index 62297fd..121fae8 100644 --- a/courgette/ensemble_apply.cc +++ b/courgette/ensemble_apply.cc @@ -10,7 +10,6 @@ #include "base/files/file_util.h" #include "base/files/memory_mapped_file.h" #include "base/logging.h" -#include "courgette/courgette_config.h" #include "courgette/crc.h" #include "courgette/patcher_x86_32.h" #include "courgette/region.h" @@ -97,9 +96,7 @@ Status EnsemblePatchApplication::ReadHeader(SourceStream* header_stream) { if (!header_stream->ReadVarint32(&version)) return C_BAD_ENSEMBLE_VERSION; - uint32 expected_ensemble_version = - CourgetteConfig::GetInstance()->ensemble_version(); - if (version != expected_ensemble_version) + if (version != CourgettePatchFile::kVersion) return C_BAD_ENSEMBLE_VERSION; if (!header_stream->ReadVarint32(&source_checksum_)) @@ -429,4 +426,4 @@ Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, return C_OK; } -} // namespace courgette +} // namespace diff --git a/courgette/ensemble_create.cc b/courgette/ensemble_create.cc index a0c2e0b..ea5873c 100644 --- a/courgette/ensemble_create.cc +++ b/courgette/ensemble_create.cc @@ -21,7 +21,6 @@ #include "base/logging.h" #include "base/time/time.h" -#include "courgette/courgette_config.h" #include "courgette/crc.h" #include "courgette/difference_estimator.h" #include "courgette/region.h" @@ -436,10 +435,8 @@ Status GenerateEnsemblePatch(SourceStream* base, // // Final output stream has a header followed by a StreamSet. // - uint32 ensemble_version = - CourgetteConfig::GetInstance()->ensemble_version(); if (!final_patch->WriteVarint32(CourgettePatchFile::kMagic) || - !final_patch->WriteVarint32(ensemble_version) || + !final_patch->WriteVarint32(CourgettePatchFile::kVersion) || !final_patch->WriteVarint32(CalculateCrc(old_region.start(), old_region.length())) || !final_patch->WriteVarint32(CalculateCrc(new_region.start(), @@ -455,4 +452,4 @@ Status GenerateEnsemblePatch(SourceStream* base, return C_OK; } -} // namespace courgette +} // namespace |