summaryrefslogtreecommitdiffstats
path: root/android_webview/common
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 15:39:17 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 15:39:17 +0000
commit560288155dfb9d41b75b722301063ef55c61fe89 (patch)
treecbff7d5c7d548aa7b07fac2d69b334857feb41a1 /android_webview/common
parent79c9d51b343bb842edc03d720167642c44d52acc (diff)
downloadchromium_src-560288155dfb9d41b75b722301063ef55c61fe89.zip
chromium_src-560288155dfb9d41b75b722301063ef55c61fe89.tar.gz
chromium_src-560288155dfb9d41b75b722301063ef55c61fe89.tar.bz2
[Android WebView] Add DevTools Timeline instrumentation for embedder callbacks
This allows displaying time spent in WebView callbacks code, which can affect loading and page displaying times. BUG=344871 Review URL: https://codereview.chromium.org/171793006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252919 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/common')
-rw-r--r--android_webview/common/devtools_instrumentation.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/android_webview/common/devtools_instrumentation.h b/android_webview/common/devtools_instrumentation.h
new file mode 100644
index 0000000..822ffc1
--- /dev/null
+++ b/android_webview/common/devtools_instrumentation.h
@@ -0,0 +1,39 @@
+// Copyright 2014 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.
+
+#ifndef ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_
+#define ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_
+
+#include "base/debug/trace_event.h"
+
+namespace android_webview {
+namespace devtools_instrumentation {
+
+namespace internal {
+const char kCategory[] = "Java,devtools";
+const char kEmbedderCallback[] = "EmbedderCallback";
+const char kCallbackNameArgument[] = "callbackName";
+} // namespace internal
+
+class ScopedEmbedderCallbackTask {
+ public:
+ ScopedEmbedderCallbackTask(const char* callback_name) {
+ TRACE_EVENT_BEGIN1(internal::kCategory,
+ internal::kEmbedderCallback,
+ internal::kCallbackNameArgument,
+ callback_name);
+ }
+ ~ScopedEmbedderCallbackTask() {
+ TRACE_EVENT_END0(internal::kCategory,
+ internal::kEmbedderCallback);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedEmbedderCallbackTask);
+};
+
+} // namespace devtools_instrumentation
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_