OLD | NEW |
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/trace.h" | 5 #include "tools/gn/trace.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <vector> | 10 #include <vector> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 ScopedTrace::~ScopedTrace() { | 141 ScopedTrace::~ScopedTrace() { |
142 Done(); | 142 Done(); |
143 } | 143 } |
144 | 144 |
145 void ScopedTrace::SetToolchain(const Label& label) { | 145 void ScopedTrace::SetToolchain(const Label& label) { |
146 if (item_) | 146 if (item_) |
147 item_->set_toolchain(label.GetUserVisibleName(false)); | 147 item_->set_toolchain(label.GetUserVisibleName(false)); |
148 } | 148 } |
149 | 149 |
150 void ScopedTrace::SetCommandLine(const CommandLine& cmdline) { | 150 void ScopedTrace::SetCommandLine(const base::CommandLine& cmdline) { |
151 if (item_) | 151 if (item_) |
152 item_->set_cmdline(FilePathToUTF8(cmdline.GetArgumentsString())); | 152 item_->set_cmdline(FilePathToUTF8(cmdline.GetArgumentsString())); |
153 } | 153 } |
154 | 154 |
155 void ScopedTrace::Done() { | 155 void ScopedTrace::Done() { |
156 if (!done_) { | 156 if (!done_) { |
157 done_ = true; | 157 done_ = true; |
158 if (trace_log) { | 158 if (trace_log) { |
159 item_->set_end(base::TimeTicks::HighResNow()); | 159 item_->set_end(base::TimeTicks::HighResNow()); |
160 AddTrace(item_); | 160 AddTrace(item_); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 out << "}"; | 313 out << "}"; |
314 } | 314 } |
315 | 315 |
316 out << "]}"; | 316 out << "]}"; |
317 | 317 |
318 std::string out_str = out.str(); | 318 std::string out_str = out.str(); |
319 base::WriteFile(file_name, out_str.data(), | 319 base::WriteFile(file_name, out_str.data(), |
320 static_cast<int>(out_str.size())); | 320 static_cast<int>(out_str.size())); |
321 } | 321 } |
OLD | NEW |