diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-06 21:44:33 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-06 21:44:33 +0000 |
commit | 8fc5618676949b8bebd39f584bf193314b5eb566 (patch) | |
tree | 98b37da8c3b10c04087589c49e56d114bd7d504c /tools/gn/value_extractors.h | |
parent | 430248b7a336509b94b30df5fe6e982d9efb43f1 (diff) | |
download | chromium_src-8fc5618676949b8bebd39f584bf193314b5eb566.zip chromium_src-8fc5618676949b8bebd39f584bf193314b5eb566.tar.gz chromium_src-8fc5618676949b8bebd39f584bf193314b5eb566.tar.bz2 |
This is an ordered set tailored to GN's (simple) needs.
This vector is now used to store all config lists. Previously the code did a bunch of work to uniquify configs at certain points (in target.cc) but direct_dependent_configs still ended up with lots of duplicates.
Before this patch the chrome/browser target has 41098 direct_dependent_configs, and after this patch it has 7. Apparently we were also spending a lot of time on these. Before this patch Windows wall clock time was 1031ms, and after this patch it's 831ms. Linux was 834ms before and 593ms after.
Also fix minor build issues in base I noticed while working on this.
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/26537002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/value_extractors.h')
-rw-r--r-- | tools/gn/value_extractors.h | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/tools/gn/value_extractors.h b/tools/gn/value_extractors.h index 38c89ab..afda1d6 100644 --- a/tools/gn/value_extractors.h +++ b/tools/gn/value_extractors.h @@ -8,30 +8,15 @@ #include <string> #include <vector> -#include "tools/gn/target.h" -#include "tools/gn/value.h" +#include "tools/gn/label_ptr.h" +#include "tools/gn/unique_vector.h" class BuildSettings; class Err; class Label; class SourceDir; class SourceFile; - -// Sets the error and returns false on failure. -template<typename T, class Converter> -bool ListValueExtractor(const Value& value, std::vector<T>* dest, - Err* err, - const Converter& converter) { - if (!value.VerifyTypeIs(Value::LIST, err)) - return false; - const std::vector<Value>& input_list = value.list_value(); - dest->resize(input_list.size()); - for (size_t i = 0; i < input_list.size(); i++) { - if (!converter(input_list[i], &(*dest)[i], err)) - return false; - } - return true; -} +class Value; // On failure, returns false and sets the error. bool ExtractListOfStringValues(const Value& value, @@ -57,14 +42,23 @@ bool ExtractListOfRelativeDirs(const BuildSettings* build_settings, bool ExtractListOfLabels(const Value& value, const SourceDir& current_dir, const Label& current_toolchain, - LabelConfigVector* dest, - Err* err); -bool ExtractListOfLabels(const Value& value, - const SourceDir& current_dir, - const Label& current_toolchain, LabelTargetVector* dest, Err* err); +// Extracts the list of labels and their origins to the given vector. Only the +// labels are filled in, the ptr for each pair in the vector will be null. Sets +// an error and returns false if a label is maformed or there are duplicates. +bool ExtractListOfUniqueLabels(const Value& value, + const SourceDir& current_dir, + const Label& current_toolchain, + UniqueVector<LabelConfigPair>* dest, + Err* err); +bool ExtractListOfUniqueLabels(const Value& value, + const SourceDir& current_dir, + const Label& current_toolchain, + UniqueVector<LabelTargetPair>* dest, + Err* err); + bool ExtractRelativeFile(const BuildSettings* build_settings, const Value& value, const SourceDir& current_dir, |