Commit 06e7cc19 authored by Changwan Ryu's avatar Changwan Ryu Committed by Commit Bot

Clean-up after moving ScopedSysTraceEvent to base

This should be landed after the upstream fix
https://chromium-review.googlesource.com/c/chromium/src/+/1730313
and the downstream fix
https://chrome-internal-review.googlesource.com/c/clank/internal/apps/+/1560327
land.

Bug: 817644
Change-Id: I66a986374804b8e6642275ee08c2412458c12258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730781Reviewed-by: default avatarNate Fischer <ntfschr@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683644}
parent 145520c8
...@@ -865,7 +865,6 @@ android_library("android_webview_java") { ...@@ -865,7 +865,6 @@ android_library("android_webview_java") {
"java/src/org/chromium/android_webview/OverScrollGlow.java", "java/src/org/chromium/android_webview/OverScrollGlow.java",
"java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java", "java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java",
"java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java", "java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java",
"java/src/org/chromium/android_webview/ScopedSysTraceEvent.java",
"java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java", "java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java",
"java/src/org/chromium/android_webview/SslUtil.java", "java/src/org/chromium/android_webview/SslUtil.java",
"java/src/org/chromium/android_webview/VariationsSeedLoader.java", "java/src/org/chromium/android_webview/VariationsSeedLoader.java",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.android_webview;
import android.os.Trace;
// TODO(changwan): remove this file once downstream change lands.
/**
* An alternative to @{TraceEvent} that allows us to trace events before native
* initialization.
*
* Note that TraceEvent / EarlyTraceEvent cannot be used before native initialization since
* it directly purges to the kernel debug message but that method does not allow tracing events
* to be written *after* the event occurrence.
*/
public class ScopedSysTraceEvent implements AutoCloseable {
/**
* Factory used to support the "try with resource" construct.
* Note that currently this is the only allowed pattern. However, this requires heap allocation
* so we may consider calling Trace.beginSection() / endSection() directly if it should be used
* repeatedly.
*
* @param name Trace event name.
* @return a {@ScopedSysTraceEvent}, or null if tracing is not enabled.
*/
public static ScopedSysTraceEvent scoped(String name) {
return new ScopedSysTraceEvent(name);
}
/**
* Constructor used to support the "try with resource" construct.
*/
private ScopedSysTraceEvent(String name) {
Trace.beginSection(name);
}
@Override
public void close() {
Trace.endSection();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment