Commit c7e948b4 authored by jochen@chromium.org's avatar jochen@chromium.org

Fix stats counters

- intialize the V8 callbacks first thing, otherwise, the counters disable themselves
- don't use inline event handlers in the presence of a CSP
- on linux, the child processes need to use the parent's parent pid to derive the table name (the parent is the zygote, the parent's parent is the browser)

BUG=none
TEST=run chrome with --enable-stats-table, you should see lots of V8 stats, and you should be able to filter for e.g. V8


Review URL: https://chromiumcodereview.appspot.com/10690137

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146305 0039d316-1c4b-4281-b951-d872f2087c98
parent 5eaf2ff7
......@@ -69,12 +69,13 @@ h2 {
text-transform: lowercase;
}
</style>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://stats/stats.js"></script>
<script src="chrome://stats/strings.js"></script>
</head>
<body>
<div style="float: right">
<br>Filter: <input id="filter" type="text" value="" onkeyup="doFilter()">
<br>Filter: <input id="filter" type="text" value="">
</div>
<h1 class="lower">About Stats</h1>
<h2>Shhh! This page is secret!</h2><br/>
......
......@@ -51,7 +51,7 @@ function filterMatching(text, nodelist, functionToGetNameNode) {
/* Hides or shows counters based on the user's current filter selection. */
function doFilter() {
var filter = document.getElementById('filter');
var filter = $('filter');
var text = filter.value.toLowerCase();
var nodes = document.getElementsByName('counter');
filterMatching(text, nodes, getCounterNameFromCounterNode);
......@@ -108,7 +108,7 @@ function computeTimes() {
function onLoadWork() {
// This is the javascript code that processes the template:
var input = new JsEvalContext(templateData);
var output = document.getElementById('t');
var output = $('t');
jstProcess(input, output);
// Add handlers to dynamically created HTML elements.
......@@ -123,7 +123,10 @@ function onLoadWork() {
doColor();
removeNullValues();
computeTimes();
document.getElementById('filter').focus();
var filter = $('filter');
filter.onkeyup = doFilter;
filter.focus();
}
// The function should only be used as the event handler
......
......@@ -203,8 +203,11 @@ static base::ProcessId GetBrowserPid(const CommandLine& command_line) {
// for a few files including process_util_linux.cc.
LOG(ERROR) << "GetBrowserPid() not implemented for Android().";
#elif defined(OS_POSIX)
// On linux, we're in the zygote here; so we need the parent process' id.
browser_pid = base::GetParentProcessId(base::GetCurrentProcId());
// On linux, we're in a process forked from the zygote here; so we need the
// parent's parent process' id.
browser_pid =
base::GetParentProcessId(
base::GetParentProcessId(base::GetCurrentProcId()));
#endif
}
return browser_pid;
......
......@@ -185,6 +185,10 @@ RenderThreadImpl::RenderThreadImpl(const std::string& channel_name)
void RenderThreadImpl::Init() {
TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, "");
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
v8::V8::SetCreateHistogramFunction(CreateHistogram);
v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);
#if defined(OS_MACOSX) || defined(OS_ANDROID)
// On Mac and Android, the select popups are rendered by the browser.
WebKit::WebView::setUseExternalPopupMenus(true);
......@@ -481,10 +485,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
if (webkit_platform_support_.get())
return;
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
v8::V8::SetCreateHistogramFunction(CreateHistogram);
v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);
webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl);
WebKit::initialize(webkit_platform_support_.get());
......
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