Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(830)

Unified Diff: chrome/browser/resources/gpu_internals/tracing_controller.js

Issue 6677166: More about:gpu tracing improvements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/gpu_internals/timeline_view.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/gpu_internals/tracing_controller.js
diff --git a/chrome/browser/resources/gpu_internals/tracing_controller.js b/chrome/browser/resources/gpu_internals/tracing_controller.js
index 8d7471ba887bf7c4b34168bc074b993b629e8d8f..abf9873ec7e3f43f11af3ca20e58e810cb250025 100644
--- a/chrome/browser/resources/gpu_internals/tracing_controller.js
+++ b/chrome/browser/resources/gpu_internals/tracing_controller.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -30,6 +30,9 @@ cr.define('gpu', function() {
this.overlay_.appendChild(stopButton);
this.traceEvents_ = [];
+
+ this.onKeydownBoundToThis_ = this.onKeydown_.bind(this);
+ this.onKeypressBoundToThis_ = this.onKeypress_.bind(this);
}
TracingController.prototype = {
@@ -63,15 +66,21 @@ cr.define('gpu', function() {
e.numEvents = this.traceEvents_.length;
this.dispatchEvent(e);
- var self = this;
- window.addEventListener('keypress', function f(e) {
- if (e.keyIdentifier == 'Enter') {
- window.removeEventListener('keypress', f);
- self.endTracing();
- }
- });
+ window.addEventListener('keypress', this.onKeypressBoundToThis_);
+ window.addEventListener('keydown', this.onKeydownBoundToThis_);
+ },
+
+ onKeydown_: function(e) {
+ if (e.keyCode == 27) {
+ this.endTracing();
+ }
},
+ onKeypress_: function(e) {
+ if (e.keyIdentifier == 'Enter') {
+ this.endTracing();
+ }
+ },
/**
* Checks whether tracing is enabled
*/
@@ -100,12 +109,15 @@ cr.define('gpu', function() {
endTracing: function() {
if (!this.tracingEnabled_) throw new Error('Tracing not begun.');
+ window.removeEventListener('keydown', this.onKeydownBoundToThis_);
+ window.removeEventListener('keypress', this.onKeypressBoundToThis_);
+
console.log('Finishing trace');
if (!browserBridge.debugMode) {
chrome.send('endTracingAsync');
} else {
var events = window.getTimelineTestData1 ?
- getTimelineTestData1() : [];
+ getTimelineTestData1() : [];
this.onTraceDataCollected(events);
window.setTimeout(this.onEndTracingComplete.bind(this), 250);
}
« no previous file with comments | « chrome/browser/resources/gpu_internals/timeline_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698