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

Side by Side Diff: tools/gn/target_generator.h

Issue 56433003: GN threading refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TOOLS_GN_TARGET_GENERATOR_H_ 5 #ifndef TOOLS_GN_TARGET_GENERATOR_H_
6 #define TOOLS_GN_TARGET_GENERATOR_H_ 6 #define TOOLS_GN_TARGET_GENERATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "tools/gn/source_dir.h" 13 #include "tools/gn/source_dir.h"
14 #include "tools/gn/target.h" 14 #include "tools/gn/target.h"
15 15
16 class BuildSettings; 16 class BuildSettings;
17 class Err; 17 class Err;
18 class FunctionCallNode;
18 class Location; 19 class Location;
19 class Scope; 20 class Scope;
20 class Token;
21 class Value; 21 class Value;
22 22
23 // Fills the variables in a Target object from a Scope (the result of a script 23 // Fills the variables in a Target object from a Scope (the result of a script
24 // execution). Target-type-specific derivations of this class will be used 24 // execution). Target-type-specific derivations of this class will be used
25 // for each different type of function call. This class implements the common 25 // for each different type of function call. This class implements the common
26 // behavior. 26 // behavior.
27 class TargetGenerator { 27 class TargetGenerator {
28 public: 28 public:
29 TargetGenerator(Target* target, 29 TargetGenerator(Target* target,
30 Scope* scope, 30 Scope* scope,
31 const Token& function_token, 31 const FunctionCallNode* function_call,
32 Err* err); 32 Err* err);
33 ~TargetGenerator(); 33 ~TargetGenerator();
34 34
35 void Run(); 35 void Run();
36 36
37 // The function token is the token of the function name of the generator for 37 // The function call is the parse tree node that invoked the target.
38 // this target. err() will be set on failure. 38 // err() will be set on failure.
39 static void GenerateTarget(Scope* scope, 39 static void GenerateTarget(Scope* scope,
40 const Token& function_token, 40 const FunctionCallNode* function_call,
41 const std::vector<Value>& args, 41 const std::vector<Value>& args,
42 const std::string& output_type, 42 const std::string& output_type,
43 Err* err); 43 Err* err);
44 44
45 protected: 45 protected:
46 // Derived classes implement this to do type-specific generation. 46 // Derived classes implement this to do type-specific generation.
47 virtual void DoRun() = 0; 47 virtual void DoRun() = 0;
48 48
49 const BuildSettings* GetBuildSettings() const; 49 const BuildSettings* GetBuildSettings() const;
50 50
51 void FillSources(); 51 void FillSources();
52 void FillSourcePrereqs(); 52 void FillSourcePrereqs();
53 void FillConfigs(); 53 void FillConfigs();
54 void FillExternal(); 54 void FillExternal();
55 void FillOutputs(); 55 void FillOutputs();
56 56
57 // Sets the current toolchain as a dependecy of this target. All targets with
58 // a dependency on the toolchain should call this function.
59 void SetToolchainDependency();
60
61 Target* target_; 57 Target* target_;
62 Scope* scope_; 58 Scope* scope_;
63 const Token& function_token_; 59 const FunctionCallNode* function_call_;
64 Err* err_; 60 Err* err_;
65 61
66 private: 62 private:
67 void FillDependentConfigs(); // Includes all types of dependent configs. 63 void FillDependentConfigs(); // Includes all types of dependent configs.
68 void FillData(); 64 void FillData();
69 void FillDependencies(); // Includes data dependencies. 65 void FillDependencies(); // Includes data dependencies.
70 void FillGypFile(); 66 void FillGypFile();
71 void FillHardDep(); 67 void FillHardDep();
72 68
73 // Reads configs/deps from the given var name, and uses the given setting on 69 // Reads configs/deps from the given var name, and uses the given setting on
74 // the target to save them. 70 // the target to save them.
75 void FillGenericConfigs(const char* var_name, LabelConfigVector* dest); 71 void FillGenericConfigs(const char* var_name, LabelConfigVector* dest);
76 void FillGenericDeps(const char* var_name, LabelTargetVector* dest); 72 void FillGenericDeps(const char* var_name, LabelTargetVector* dest);
77 73
78 void FillForwardDependentConfigs(); 74 void FillForwardDependentConfigs();
79 75
80 DISALLOW_COPY_AND_ASSIGN(TargetGenerator); 76 DISALLOW_COPY_AND_ASSIGN(TargetGenerator);
81 }; 77 };
82 78
83 #endif // TOOLS_GN_TARGET_GENERATOR_H_ 79 #endif // TOOLS_GN_TARGET_GENERATOR_H_
OLDNEW
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698