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

Side by Side Diff: tools/gn/target.cc

Issue 1464463003: Reduce the number of worker threads GN uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « tools/gn/scheduler.cc ('k') | tools/gn/trace.h » ('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 #include "tools/gn/target.h" 5 #include "tools/gn/target.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "tools/gn/config_values_extractors.h" 10 #include "tools/gn/config_values_extractors.h"
11 #include "tools/gn/deps_iterator.h" 11 #include "tools/gn/deps_iterator.h"
12 #include "tools/gn/filesystem_utils.h" 12 #include "tools/gn/filesystem_utils.h"
13 #include "tools/gn/scheduler.h" 13 #include "tools/gn/scheduler.h"
14 #include "tools/gn/substitution_writer.h" 14 #include "tools/gn/substitution_writer.h"
15 #include "tools/gn/trace.h"
15 16
16 namespace { 17 namespace {
17 18
18 typedef std::set<const Config*> ConfigSet; 19 typedef std::set<const Config*> ConfigSet;
19 20
20 // Merges the public configs from the given target to the given config list. 21 // Merges the public configs from the given target to the given config list.
21 void MergePublicConfigsFrom(const Target* from_target, 22 void MergePublicConfigsFrom(const Target* from_target,
22 UniqueVector<LabelConfigPair>* dest) { 23 UniqueVector<LabelConfigPair>* dest) {
23 const UniqueVector<LabelConfigPair>& pub = from_target->public_configs(); 24 const UniqueVector<LabelConfigPair>& pub = from_target->public_configs();
24 dest->Append(pub.begin(), pub.end()); 25 dest->Append(pub.begin(), pub.end());
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 150 }
150 151
151 const Target* Target::AsTarget() const { 152 const Target* Target::AsTarget() const {
152 return this; 153 return this;
153 } 154 }
154 155
155 bool Target::OnResolved(Err* err) { 156 bool Target::OnResolved(Err* err) {
156 DCHECK(output_type_ != UNKNOWN); 157 DCHECK(output_type_ != UNKNOWN);
157 DCHECK(toolchain_) << "Toolchain should have been set before resolving."; 158 DCHECK(toolchain_) << "Toolchain should have been set before resolving.";
158 159
160 ScopedTrace trace(TraceItem::TRACE_ON_RESOLVED, label());
161 trace.SetToolchain(settings()->toolchain_label());
162
159 // Copy our own dependent configs to the list of configs applying to us. 163 // Copy our own dependent configs to the list of configs applying to us.
160 configs_.Append(all_dependent_configs_.begin(), all_dependent_configs_.end()); 164 configs_.Append(all_dependent_configs_.begin(), all_dependent_configs_.end());
161 MergePublicConfigsFrom(this, &configs_); 165 MergePublicConfigsFrom(this, &configs_);
162 166
163 // Copy our own libs and lib_dirs to the final set. This will be from our 167 // Copy our own libs and lib_dirs to the final set. This will be from our
164 // target and all of our configs. We do this specially since these must be 168 // target and all of our configs. We do this specially since these must be
165 // inherited through the dependency tree (other flags don't work this way). 169 // inherited through the dependency tree (other flags don't work this way).
166 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) { 170 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) {
167 const ConfigValues& cur = iter.cur(); 171 const ConfigValues& cur = iter.cur();
168 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end()); 172 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end());
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return; // Not in output dir, this is OK. 545 return; // Not in output dir, this is OK.
542 546
543 // Tell the scheduler about unknown files. This will be noted for later so 547 // Tell the scheduler about unknown files. This will be noted for later so
544 // the list of files written by the GN build itself (often response files) 548 // the list of files written by the GN build itself (often response files)
545 // can be filtered out of this list. 549 // can be filtered out of this list.
546 OutputFile out_file(settings()->build_settings(), source); 550 OutputFile out_file(settings()->build_settings(), source);
547 std::set<const Target*> seen_targets; 551 std::set<const Target*> seen_targets;
548 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) 552 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets))
549 g_scheduler->AddUnknownGeneratedInput(this, source); 553 g_scheduler->AddUnknownGeneratedInput(this, source);
550 } 554 }
OLDNEW
« no previous file with comments | « tools/gn/scheduler.cc ('k') | tools/gn/trace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698