Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: tools/gn/target.h

Issue 26537002: Add a UniqueVector class to GN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: REview comments, remove npos Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/source_file.h ('k') | tools/gn/target.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/target.h
diff --git a/tools/gn/target.h b/tools/gn/target.h
index 572333d925f7086459139619a5e0eeba603327a3..f0301e9f1c4e8d01088198a9458353d3133254bf 100644
--- a/tools/gn/target.h
+++ b/tools/gn/target.h
@@ -20,6 +20,7 @@
#include "tools/gn/label_ptr.h"
#include "tools/gn/ordered_set.h"
#include "tools/gn/source_file.h"
+#include "tools/gn/unique_vector.h"
class InputFile;
class Settings;
@@ -105,38 +106,38 @@ class Target : public Item {
// List of configs that this class inherits settings from. Once a target is
// resolved, this will also list all- and direct-dependent configs.
- const LabelConfigVector& configs() const { return configs_; }
- LabelConfigVector& configs() { return configs_; }
+ const UniqueVector<LabelConfigPair>& configs() const { return configs_; }
+ UniqueVector<LabelConfigPair>& configs() { return configs_; }
// List of configs that all dependencies (direct and indirect) of this
// target get. These configs are not added to this target. Note that due
// to the way this is computed, there may be duplicates in this list.
- const LabelConfigVector& all_dependent_configs() const {
+ const UniqueVector<LabelConfigPair>& all_dependent_configs() const {
return all_dependent_configs_;
}
- LabelConfigVector& all_dependent_configs() {
+ UniqueVector<LabelConfigPair>& all_dependent_configs() {
return all_dependent_configs_;
}
// List of configs that targets depending directly on this one get. These
// configs are not added to this target.
- const LabelConfigVector& direct_dependent_configs() const {
+ const UniqueVector<LabelConfigPair>& direct_dependent_configs() const {
return direct_dependent_configs_;
}
- LabelConfigVector& direct_dependent_configs() {
+ UniqueVector<LabelConfigPair>& direct_dependent_configs() {
return direct_dependent_configs_;
}
// A list of a subset of deps where we'll re-export direct_dependent_configs
// as direct_dependent_configs of this target.
- const LabelTargetVector& forward_dependent_configs() const {
+ const UniqueVector<LabelTargetPair>& forward_dependent_configs() const {
return forward_dependent_configs_;
}
- LabelTargetVector& forward_dependent_configs() {
+ UniqueVector<LabelTargetPair>& forward_dependent_configs() {
return forward_dependent_configs_;
}
- const std::set<const Target*>& inherited_libraries() const {
+ const UniqueVector<const Target*>& inherited_libraries() const {
return inherited_libraries_;
}
@@ -157,7 +158,7 @@ class Target : public Item {
private:
// Pulls necessary information from dependencies to this one when all
// dependencies have been resolved.
- void PullDependentTargetInfo(std::set<const Config*>* unique_configs);
+ void PullDependentTargetInfo();
// These each pull specific things from dependencies to this one when all
// deps have been resolved.
@@ -190,10 +191,10 @@ class Target : public Item {
LabelTargetVector deps_;
LabelTargetVector datadeps_;
- LabelConfigVector configs_;
- LabelConfigVector all_dependent_configs_;
- LabelConfigVector direct_dependent_configs_;
- LabelTargetVector forward_dependent_configs_;
+ UniqueVector<LabelConfigPair> configs_;
+ UniqueVector<LabelConfigPair> all_dependent_configs_;
+ UniqueVector<LabelConfigPair> direct_dependent_configs_;
+ UniqueVector<LabelTargetPair> forward_dependent_configs_;
bool external_;
@@ -202,7 +203,7 @@ class Target : public Item {
// sets do not get pushed beyond static library boundaries, and neither
// source sets nor static libraries get pushed beyond sahred library
// boundaries.
- std::set<const Target*> inherited_libraries_;
+ UniqueVector<const Target*> inherited_libraries_;
// These libs and dirs are inherited from statically linked deps and all
// configs applying to this target.
@@ -219,4 +220,20 @@ class Target : public Item {
DISALLOW_COPY_AND_ASSIGN(Target);
};
+namespace BASE_HASH_NAMESPACE {
+
+#if defined(COMPILER_GCC)
+template<> struct hash<const Target*> {
+ std::size_t operator()(const Target* t) const {
+ return reinterpret_cast<std::size_t>(t);
+ }
+};
+#elif defined(COMPILER_MSVC)
+inline size_t hash_value(const Target* t) {
+ return reinterpret_cast<size_t>(t);
+}
+#endif // COMPILER...
+
+} // namespace BASE_HASH_NAMESPACE
+
#endif // TOOLS_GN_TARGET_H_
« no previous file with comments | « tools/gn/source_file.h ('k') | tools/gn/target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698