summaryrefslogtreecommitdiffstats
path: root/tools/gn/template.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 19:40:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 19:40:36 +0000
commita8e8af9e020e5bc84b4a745c96d2b739943dd503 (patch)
tree50e5a9a3bcddde113012e3d0e56da245072d8980 /tools/gn/template.cc
parentd153be9ae32539dbb7dcc609f901726f3cd5776a (diff)
downloadchromium_src-a8e8af9e020e5bc84b4a745c96d2b739943dd503.zip
chromium_src-a8e8af9e020e5bc84b4a745c96d2b739943dd503.tar.gz
chromium_src-a8e8af9e020e5bc84b4a745c96d2b739943dd503.tar.bz2
Make GN template objects reference counted.
Tis prevents expensive copies and also a recursive blow-up if there are many templates in a row. In this case, each template holds a closure which includes all previous templates, which rapidly blows up memory. Since this class is already immutable, we can use them on multiple threads as long as the refcounting itself is thread safe. BUG=368869 R=scottmg@chromium.org Review URL: https://codereview.chromium.org/269163002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/template.cc')
-rw-r--r--tools/gn/template.cc6
1 files changed, 0 insertions, 6 deletions
diff --git a/tools/gn/template.cc b/tools/gn/template.cc
index 11dcf1f..29a6b09 100644
--- a/tools/gn/template.cc
+++ b/tools/gn/template.cc
@@ -24,12 +24,6 @@ Template::Template(scoped_ptr<Scope> scope, const FunctionCallNode* def)
Template::~Template() {
}
-scoped_ptr<Template> Template::Clone() const {
- // We can make a new closure from our closure to copy it.
- return scoped_ptr<Template>(
- new Template(closure_->MakeClosure(), definition_));
-}
-
Value Template::Invoke(Scope* scope,
const FunctionCallNode* invocation,
const std::vector<Value>& args,