From ba3658d2faf7d306c30a102bf56c7c0562789742 Mon Sep 17 00:00:00 2001 From: "junov@chromium.org" Date: Tue, 3 Apr 2012 21:42:59 +0000 Subject: Adding build-time option to enable the tracing of skia events in chrome://tracing BUG=121208 TEST=None Review URL: http://codereview.chromium.org/9965037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130469 0039d316-1c4b-4281-b951-d872f2087c98 --- skia/config/SkUserConfig.h | 16 ++++++++++++++++ skia/ext/skia_trace_shim.h | 18 ++++++++++++++++++ skia/skia.gyp | 1 + 3 files changed, 35 insertions(+) create mode 100644 skia/ext/skia_trace_shim.h diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index dd8d852..f8c237f 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h @@ -156,6 +156,18 @@ #define SK_SUPPORT_UNITTEST #endif +/* If your system embeds skia and has complex event logging, define this + symbol to name a file that maps the following macros to your system's + equivalents: + SK_TRACE_EVENT0(event) + SK_TRACE_EVENT1(event, name1, value1) + SK_TRACE_EVENT2(event, name1, value1, name2, value2) + src/utils/SkDebugTrace.h has a trivial implementation that writes to + the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, + SkTrace.h will define the above three macros to do nothing. +*/ +#undef SK_USER_TRACE_INCLUDE_FILE + /* If this is not defined, skia dithers gradients. Turning this on will make gradients look better, but might have a performance impact. When it's turned on, several webkit pixel tests will need to be rebaselined, too. @@ -237,6 +249,10 @@ typedef unsigned uint32_t; // assertion. #define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") +// Uncomment the following line to forward skia trace events to Chrome +// tracing. +// #define SK_USER_TRACE_INCLUDE_FILE "skia/ext/skia_trace_shim.h" + // ===== End Chrome-specific definitions ===== #endif diff --git a/skia/ext/skia_trace_shim.h b/skia/ext/skia_trace_shim.h new file mode 100644 index 0000000..16368fa --- /dev/null +++ b/skia/ext/skia_trace_shim.h @@ -0,0 +1,18 @@ +// Copyright (c) 2012 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 SKIA_EXT_SKIA_TRACE_SHIM_H_ +#define SKIA_EXT_SKIA_TRACE_SHIM_H_ +#pragma once + +#include "base/debug/trace_event.h" + +#define SK_TRACE_EVENT0(name) \ + TRACE_EVENT0("skia", name) +#define SK_TRACE_EVENT1(name, arg1_name, arg1_val) \ + TRACE_EVENT1("skia", name, arg1_name, arg1_val) +#define SK_TRACE_EVENT2(name, arg1_name, arg1_val, arg2_name, arg2_val) \ + TRACE_EVENT1("skia", name, arg1_name, arg1_val, arg2_name, arg2_val) + +#endif diff --git a/skia/skia.gyp b/skia/skia.gyp index bfaa698..6c81a56 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -719,6 +719,7 @@ 'ext/SkMemory_new_handler.cpp', 'ext/skia_sandbox_support_win.h', 'ext/skia_sandbox_support_win.cc', + 'ext/skia_trace_shim.h', 'ext/skia_utils_mac.mm', 'ext/skia_utils_mac.h', 'ext/skia_utils_win.cc', -- cgit v1.1