recommend a EventHandler.Do() am: 2a95e590b6
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2095267 Change-Id: Id932c62693ec48b264d855a0cdf7559718f00b81 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
0ca2d0cb67
2 changed files with 8 additions and 1 deletions
|
@ -3648,7 +3648,7 @@ func (c *Context) SingletonName(singleton Singleton) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// WriteBuildFile writes the Ninja manifeset text for the generated build
|
||||
// WriteBuildFile writes the Ninja manifest text for the generated build
|
||||
// actions to w. If this is called before PrepareBuildActions successfully
|
||||
// completes then ErrBuildActionsNotReady is returned.
|
||||
func (c *Context) WriteBuildFile(w io.StringWriter) error {
|
||||
|
|
|
@ -62,6 +62,13 @@ func (h *EventHandler) Begin(name string) {
|
|||
h.scopeStartTimes = append(h.scopeStartTimes, _now())
|
||||
}
|
||||
|
||||
// Do wraps a function with calls to Begin() and End().
|
||||
func (h *EventHandler) Do(name string, f func()) {
|
||||
h.Begin(name)
|
||||
defer h.End(name)
|
||||
f()
|
||||
}
|
||||
|
||||
// End logs the end of an event. All events nested within this event must have
|
||||
// themselves been marked completed.
|
||||
func (h *EventHandler) End(name string) {
|
||||
|
|
Loading…
Reference in a new issue