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

Unified Diff: tools/gn/header_checker.h

Issue 500423003: Enhance GN diagnostic tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use patterns for gn check 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/gn.gyp ('k') | tools/gn/header_checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/header_checker.h
diff --git a/tools/gn/header_checker.h b/tools/gn/header_checker.h
index bdfbb551624b029ff6f45fd98b3cd62c3c676276..c90c67a83277b669d00d41c3fdddf1ec13a1cdb4 100644
--- a/tools/gn/header_checker.h
+++ b/tools/gn/header_checker.h
@@ -33,10 +33,14 @@ class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> {
HeaderChecker(const BuildSettings* build_settings,
const std::vector<const Target*>& targets);
- // This assumes that the current thread already has a message loop. On
- // error, fills the given vector with the errors and returns false. Returns
+ // Runs the check. The targets in to_check will be checked. If this list is
+ // empty, all targets will be checked.
+ //
+ // This assumes that the current thread already has a message loop. On
+ // error, fills the given vector with the errors and returns false. Returns
// true on success.
- bool Run(std::vector<Err>* errors);
+ bool Run(const std::vector<const Target*>& to_check,
+ std::vector<Err>* errors);
private:
friend class base::RefCountedThreadSafe<HeaderChecker>;
@@ -57,12 +61,16 @@ class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> {
};
typedef std::vector<TargetInfo> TargetVector;
+ typedef std::map<SourceFile, TargetVector> FileMap;
+
+ // Backend for Run() that takes the list of files to check. The errors_ list
+ // will be populate on failure.
+ void RunCheckOverFiles(const FileMap& flies);
void DoWork(const Target* target, const SourceFile& file);
- // Adds the sources and public files from the given target to the file_map_.
- // Not threadsafe! Called only during init.
- void AddTargetToFileMap(const Target* target);
+ // Adds the sources and public files from the given target to the given map.
+ static void AddTargetToFileMap(const Target* target, FileMap* dest);
// Returns true if the given file is in the output directory.
bool IsFileInOuputDir(const SourceFile& file) const;
@@ -133,7 +141,6 @@ class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> {
const BuildSettings* build_settings_;
// Maps source files to targets it appears in (usually just one target).
- typedef std::map<SourceFile, TargetVector> FileMap;
FileMap file_map_;
// Locked variables ----------------------------------------------------------
« no previous file with comments | « tools/gn/gn.gyp ('k') | tools/gn/header_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698