Commit b29a608b authored by nduca@chromium.org's avatar nduca@chromium.org

- Fix stale references to gpu namesapce in about:tracing.

- Use flexbox on toplevel div so timeline fills window
- Fix overlay_test, which was regressing
- Shrink "title" header to h3 and reduce padding
- Send gpuInfo and clientInfo to tracing_controller so saved files get those fields

Review URL: http://codereview.chromium.org/7497049

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96246 0039d316-1c4b-4281-b951-d872f2087c98
parent ce043951
......@@ -20,12 +20,18 @@ html, body, #main-tabs {
}
body {
display: -webkit-box;
-webkit-box-orient: vertical;
cursor: default;
font-family: sans-serif;
padding: 0;
margin: 0;
}
#tracing-title {
margin: 1px;
}
#debug-div {
display: -webkit-box;
position: fixed;
......@@ -34,10 +40,6 @@ body {
border: 1px solid red;
}
tabbox tabpanels {
padding: 1px;
}
</style>
<link rel="stylesheet" href="tracing/overlay.css">
<link rel="stylesheet" href="tracing/profiling_view.css">
......@@ -57,7 +59,7 @@ tabbox tabpanels {
<body>
<div id="debug-div">
</div>
<h1 i18n-content="tracingTitle">TITLE</h1>
<h3 id="tracing-title" i18n-content="tracingTitle">TITLE</h3>
<div id="profiling-view">
</div>
<script src="chrome://resources/js/i18n_template.js"></script>
......
......@@ -27,7 +27,7 @@ var sandbox = document.getElementById('sandbox');
var overlay;
function testShowHideUnparented() {
overlay = new gpu.Overlay();
overlay = new tracing.Overlay();
overlay.innerHTML =
'<h3>Hello</h3>B1:<button>foo</button></p>B2:<button>blah</button>';
overlay.visible = true;
......@@ -38,7 +38,7 @@ function testShowHideUnparented() {
}
function testShowHideParented() {
overlay = new gpu.Overlay();
overlay = new tracing.Overlay();
overlay.innerHTML =
'<h3>Hello</h3>B1:<button>foo</button></p>B2:<button>blah</button>';
document.body.appendChild(overlay);
......
......@@ -208,7 +208,7 @@ cr.define('tracing', function() {
// Create tracks.
this.tracks_.textContent = '';
var threads = model.getAllThreads();
threads.sort(gpu.TimelineThread.compare);
threads.sort(tracing.TimelineThread.compare);
for (var tI = 0; tI < threads.length; tI++) {
var thread = threads[tI];
var track = new TimelineThreadTrack();
......
......@@ -415,7 +415,7 @@ cr.define('tracing', function() {
* @private
*/
indexOfSlice_: function(slice) {
var index = gpu.findLowIndexInSortedArray(this.slices_,
var index = tracing.findLowIndexInSortedArray(this.slices_,
function(x) { return x.start; },
slice.start);
while (index < this.slices_.length &&
......
......@@ -36,11 +36,15 @@ cr.define('tracing', function() {
this.onKeydownBoundToThis_ = this.onKeydown_.bind(this);
this.onKeypressBoundToThis_ = this.onKeypress_.bind(this);
chrome.send('tracingControllerInitialized');
}
TracingController.prototype = {
__proto__: cr.EventTarget.prototype,
gpuInfo_: undefined,
clientInfo_: undefined,
tracingEnabled_: false,
tracingEnding_: false,
......@@ -109,6 +113,21 @@ cr.define('tracing', function() {
this.endTracing();
}
},
/**
* Called from gpu c++ code when ClientInfo is updated.
*/
onClientInfoUpdate: function(clientInfo) {
this.clientInfo_ = clientInfo;
},
/**
* Called from gpu c++ code when GPU Info is updated.
*/
onGpuInfoUpdate: function(gpuInfo) {
this.gpuInfo_ = gpuInfo;
},
/**
* Checks whether tracing is enabled
*/
......@@ -208,8 +227,8 @@ cr.define('tracing', function() {
beginSaveTraceFile: function(traceEvents) {
var data = {
traceEvents: traceEvents,
clientInfo: browserBridge.clientInfo,
gpuInfo: browserBridge.gpuInfo
clientInfo: this.clientInfo_,
gpuInfo: this.gpuInfo_
};
chrome.send('saveTraceFile', [JSON.stringify(data)]);
},
......
......@@ -64,18 +64,13 @@ class TracingMessageHandler
virtual void OnTraceBufferPercentFullReply(float percent_full);
// Messages.
void OnBrowserBridgeInitialized(const ListValue* list);
void OnCallAsync(const ListValue* list);
void OnTracingControllerInitialized(const ListValue* list);
void OnBeginTracing(const ListValue* list);
void OnEndTracingAsync(const ListValue* list);
void OnBeginRequestBufferPercentFull(const ListValue* list);
void OnLoadTraceFile(const ListValue* list);
void OnSaveTraceFile(const ListValue* list);
// Submessages dispatched from OnCallAsync.
Value* OnRequestClientInfo(const ListValue* list);
Value* OnRequestLogMessages(const ListValue* list);
// Callbacks.
void OnGpuInfoUpdate();
......@@ -174,11 +169,9 @@ void TracingMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
web_ui_->RegisterMessageCallback(
"browserBridgeInitialized",
NewCallback(this, &TracingMessageHandler::OnBrowserBridgeInitialized));
web_ui_->RegisterMessageCallback(
"callAsync",
NewCallback(this, &TracingMessageHandler::OnCallAsync));
"tracingControllerInitialized",
NewCallback(this,
&TracingMessageHandler::OnTracingControllerInitialized));
web_ui_->RegisterMessageCallback(
"beginTracing",
NewCallback(this, &TracingMessageHandler::OnBeginTracing));
......@@ -197,54 +190,8 @@ void TracingMessageHandler::RegisterMessages() {
NewCallback(this, &TracingMessageHandler::OnSaveTraceFile));
}
void TracingMessageHandler::OnCallAsync(const ListValue* args) {
DCHECK_GE(args->GetSize(), static_cast<size_t>(2));
// unpack args into requestId, submessage and submessageArgs
bool ok;
Value* requestId;
ok = args->Get(0, &requestId);
DCHECK(ok);
std::string submessage;
ok = args->GetString(1, &submessage);
DCHECK(ok);
ListValue* submessageArgs = new ListValue();
for (size_t i = 2; i < args->GetSize(); ++i) {
Value* arg;
ok = args->Get(i, &arg);
DCHECK(ok);
Value* argCopy = arg->DeepCopy();
submessageArgs->Append(argCopy);
}
// call the submessage handler
Value* ret = NULL;
if (submessage == "requestClientInfo") {
ret = OnRequestClientInfo(submessageArgs);
} else if (submessage == "requestLogMessages") {
ret = OnRequestLogMessages(submessageArgs);
} else { // unrecognized submessage
NOTREACHED();
delete submessageArgs;
return;
}
delete submessageArgs;
// call BrowserBridge.onCallAsyncReply with result
if (ret) {
web_ui_->CallJavascriptFunction("browserBridge.onCallAsyncReply",
*requestId,
*ret);
delete ret;
} else {
web_ui_->CallJavascriptFunction("browserBridge.onCallAsyncReply",
*requestId);
}
}
void TracingMessageHandler::OnBrowserBridgeInitialized(const ListValue* args) {
void TracingMessageHandler::OnTracingControllerInitialized(
const ListValue* args) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!gpu_info_update_callback_);
......@@ -261,43 +208,35 @@ void TracingMessageHandler::OnBrowserBridgeInitialized(const ListValue* args) {
// Run callback immediately in case the info is ready and no update in the
// future.
OnGpuInfoUpdate();
}
Value* TracingMessageHandler::OnRequestClientInfo(const ListValue* list) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DictionaryValue* dict = new DictionaryValue();
chrome::VersionInfo version_info;
// Send the client info to the tracingController
{
scoped_ptr<DictionaryValue> dict(new DictionaryValue());
chrome::VersionInfo version_info;
if (!version_info.is_valid()) {
DLOG(ERROR) << "Unable to create chrome::VersionInfo";
} else {
// We have everything we need to send the right values.
dict->SetString("version", version_info.Version());
dict->SetString("cl", version_info.LastChange());
dict->SetString("version_mod",
chrome::VersionInfo::GetVersionStringModifier());
dict->SetString("official",
l10n_util::GetStringUTF16(
version_info.IsOfficialBuild() ?
IDS_ABOUT_VERSION_OFFICIAL :
IDS_ABOUT_VERSION_UNOFFICIAL));
dict->SetString("command_line",
CommandLine::ForCurrentProcess()->GetCommandLineString());
}
if (!version_info.is_valid()) {
DLOG(ERROR) << "Unable to create chrome::VersionInfo";
} else {
// We have everything we need to send the right values.
dict->SetString("version", version_info.Version());
dict->SetString("cl", version_info.LastChange());
dict->SetString("version_mod",
chrome::VersionInfo::GetVersionStringModifier());
dict->SetString("official",
l10n_util::GetStringUTF16(
version_info.IsOfficialBuild() ?
IDS_ABOUT_VERSION_OFFICIAL :
IDS_ABOUT_VERSION_UNOFFICIAL));
dict->SetString("command_line",
CommandLine::ForCurrentProcess()->GetCommandLineString());
dict->SetString("blacklist_version",
GpuDataManager::GetInstance()->GetBlacklistVersion());
web_ui_->CallJavascriptFunction("tracingController.onClientInfoUpdate",
*dict);
}
dict->SetString("blacklist_version",
GpuDataManager::GetInstance()->GetBlacklistVersion());
return dict;
}
Value* TracingMessageHandler::OnRequestLogMessages(const ListValue*) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return gpu_data_manager_->log_messages().DeepCopy();
}
void TracingMessageHandler::OnBeginRequestBufferPercentFull(
......@@ -316,7 +255,7 @@ void TracingMessageHandler::OnGpuInfoUpdate() {
gpu_info_val->Set("featureStatus", feature_status);
// Send GPU Info to javascript.
web_ui_->CallJavascriptFunction("browserBridge.onGpuInfoUpdate",
web_ui_->CallJavascriptFunction("tracingController.onGpuInfoUpdate",
*(gpu_info_val.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