| OLD | NEW |
| 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 package chromiumbuildstats | 5 package chromiumbuildstats |
| 6 | 6 |
| 7 // ninja_log.go provides /ninja_log endpoints. | 7 // ninja_log.go provides /ninja_log endpoints. |
| 8 | 8 |
| 9 import ( | 9 import ( |
| 10 "bufio" | 10 "bufio" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 <td>{{$step.Out}} | 106 <td>{{$step.Out}} |
| 107 </tr> | 107 </tr> |
| 108 {{end}} | 108 {{end}} |
| 109 </table> | 109 </table> |
| 110 </html> | 110 </html> |
| 111 `)) | 111 `)) |
| 112 | 112 |
| 113 traceViewerTmpl = traceviewer.Must(traceviewer.Parse("tmpl/trace-viewer.
html")) | 113 traceViewerTmpl = traceviewer.Must(traceviewer.Parse("tmpl/trace-viewer.
html")) |
| 114 ) | 114 ) |
| 115 | 115 |
| 116 //go:generate ../../third_party/catapult/tracing/bin/trace2html tmpl/dummy.json
--output=tmpl/trace-viewer.html |
| 117 |
| 116 func init() { | 118 func init() { |
| 117 http.Handle("/ninja_log/", http.StripPrefix("/ninja_log/", http.HandlerF
unc(ninjaLogHandler))) | 119 http.Handle("/ninja_log/", http.StripPrefix("/ninja_log/", http.HandlerF
unc(ninjaLogHandler))) |
| 118 } | 120 } |
| 119 | 121 |
| 120 // ninjaLogHandler handles /<path>/<format> for ninja_log file in gs://chrome-go
ma-log/<path> | 122 // ninjaLogHandler handles /<path>/<format> for ninja_log file in gs://chrome-go
ma-log/<path> |
| 121 func ninjaLogHandler(w http.ResponseWriter, req *http.Request) { | 123 func ninjaLogHandler(w http.ResponseWriter, req *http.Request) { |
| 122 if req.URL.Path == "" { | 124 if req.URL.Path == "" { |
| 123 ninjalogForm(w, req) | 125 ninjalogForm(w, req) |
| 124 return | 126 return |
| 125 } | 127 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 traces := ninjalog.ToTraces(flow, 1) | 326 traces := ninjalog.ToTraces(flow, 1) |
| 325 b, err := traceViewerTmpl.HTML(logPath, traces) | 327 b, err := traceViewerTmpl.HTML(logPath, traces) |
| 326 if err != nil { | 328 if err != nil { |
| 327 return err | 329 return err |
| 328 } | 330 } |
| 329 w.Header().Set("Content-Type", "text/html; charset=utf-8") | 331 w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| 330 w.WriteHeader(http.StatusOK) | 332 w.WriteHeader(http.StatusOK) |
| 331 _, err = w.Write(b) | 333 _, err = w.Write(b) |
| 332 return err | 334 return err |
| 333 } | 335 } |
| OLD | NEW |