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

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

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Support explicit pools in actions Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/pool.h" 5 #include "tools/gn/pool.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 Pool::~Pool() {} 11 Pool::~Pool() {}
12 12
13 Pool* Pool::AsPool() { 13 Pool* Pool::AsPool() {
14 return this; 14 return this;
15 } 15 }
16 16
17 const Pool* Pool::AsPool() const { 17 const Pool* Pool::AsPool() const {
18 return this; 18 return this;
19 } 19 }
20 20
21 std::string Pool::GetNinjaName(const Label& default_toolchain) const { 21 std::string Pool::GetNinjaName(const Label& default_toolchain) const {
22 bool include_toolchain = label().toolchain_dir() != default_toolchain.dir() || 22 bool include_toolchain = label().toolchain_dir() != default_toolchain.dir() ||
23 label().toolchain_name() != default_toolchain.name(); 23 label().toolchain_name() != default_toolchain.name();
24 return GetNinjaName(include_toolchain); 24 return GetNinjaName(include_toolchain);
25 } 25 }
26 26
27 std::string Pool::GetNinjaName(bool include_toolchain) const { 27 std::string Pool::GetNinjaName(bool include_toolchain) const {
28 if (console_)
29 return "console";
30
28 std::ostringstream buffer; 31 std::ostringstream buffer;
29 if (include_toolchain) { 32 if (include_toolchain) {
30 DCHECK(label().toolchain_dir().is_source_absolute()); 33 DCHECK(label().toolchain_dir().is_source_absolute());
31 std::string toolchain_dir = label().toolchain_dir().value(); 34 std::string toolchain_dir = label().toolchain_dir().value();
32 for (std::string::size_type i = 2; i < toolchain_dir.size(); ++i) { 35 for (std::string::size_type i = 2; i < toolchain_dir.size(); ++i) {
33 buffer << (toolchain_dir[i] == '/' ? '_' : toolchain_dir[i]); 36 buffer << (toolchain_dir[i] == '/' ? '_' : toolchain_dir[i]);
34 } 37 }
35 buffer << label().toolchain_name() << "_"; 38 buffer << label().toolchain_name() << "_";
36 } 39 }
37 40
38 DCHECK(label().dir().is_source_absolute()); 41 DCHECK(label().dir().is_source_absolute());
39 std::string label_dir = label().dir().value(); 42 std::string label_dir = label().dir().value();
40 for (std::string::size_type i = 2; i < label_dir.size(); ++i) { 43 for (std::string::size_type i = 2; i < label_dir.size(); ++i) {
41 buffer << (label_dir[i] == '/' ? '_' : label_dir[i]); 44 buffer << (label_dir[i] == '/' ? '_' : label_dir[i]);
42 } 45 }
43 buffer << label().name(); 46 buffer << label().name();
44 return buffer.str(); 47 return buffer.str();
45 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698