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

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

Issue 2148093002: GN: Use the correct defaults for templates invoked via target(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TEMPLATE_H_ 5 #ifndef TOOLS_GN_TEMPLATE_H_
6 #define TOOLS_GN_TEMPLATE_H_ 6 #define TOOLS_GN_TEMPLATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 // execute the template in parallel. 26 // execute the template in parallel.
27 class Template : public base::RefCountedThreadSafe<Template> { 27 class Template : public base::RefCountedThreadSafe<Template> {
28 public: 28 public:
29 // Makes a new closure based on the given scope. 29 // Makes a new closure based on the given scope.
30 Template(const Scope* scope, const FunctionCallNode* def); 30 Template(const Scope* scope, const FunctionCallNode* def);
31 31
32 // Takes ownership of a previously-constructed closure. 32 // Takes ownership of a previously-constructed closure.
33 Template(std::unique_ptr<Scope> closure, const FunctionCallNode* def); 33 Template(std::unique_ptr<Scope> closure, const FunctionCallNode* def);
34 34
35 // Invoke the template. The values correspond to the state of the code 35 // Invoke the template. The values correspond to the state of the code
36 // invoking the template. 36 // invoking the template. The template name needs to be supplied since the
37 // template object itself doesn't know what name the calling code is using
38 // to refer to it (this is used to set defaults).
37 Value Invoke(Scope* scope, 39 Value Invoke(Scope* scope,
38 const FunctionCallNode* invocation, 40 const FunctionCallNode* invocation,
41 const std::string& template_name,
39 const std::vector<Value>& args, 42 const std::vector<Value>& args,
40 BlockNode* block, 43 BlockNode* block,
41 Err* err) const; 44 Err* err) const;
42 45
43 // Returns the location range where this template was defined. 46 // Returns the location range where this template was defined.
44 LocationRange GetDefinitionRange() const; 47 LocationRange GetDefinitionRange() const;
45 48
46 private: 49 private:
47 friend class base::RefCountedThreadSafe<Template>; 50 friend class base::RefCountedThreadSafe<Template>;
48 51
49 Template(); 52 Template();
50 ~Template(); 53 ~Template();
51 54
52 std::unique_ptr<Scope> closure_; 55 std::unique_ptr<Scope> closure_;
53 const FunctionCallNode* definition_; 56 const FunctionCallNode* definition_;
54 }; 57 };
55 58
56 #endif // TOOLS_GN_TEMPLATE_H_ 59 #endif // TOOLS_GN_TEMPLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698