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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
index bacc777f952f5fc53aee6dd82fda39551e7b2ca9..ba21e38bd530f24e0d603d9a28199dc9b4781beb 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
- * @implements {WebInspector.OutputStream}
- * @implements {WebInspector.OutputStreamDelegate}
+ * @implements {Common.OutputStream}
+ * @implements {Bindings.OutputStreamDelegate}
* @unrestricted
*/
-WebInspector.TimelineLoader = class {
+Timeline.TimelineLoader = class {
/**
- * @param {!WebInspector.TracingModel} model
- * @param {!WebInspector.TimelineLifecycleDelegate} delegate
+ * @param {!SDK.TracingModel} model
+ * @param {!Timeline.TimelineLifecycleDelegate} delegate
*/
constructor(model, delegate) {
this._model = model;
@@ -18,25 +18,25 @@ WebInspector.TimelineLoader = class {
/** @type {?function()} */
this._canceledCallback = null;
- this._state = WebInspector.TimelineLoader.State.Initial;
+ this._state = Timeline.TimelineLoader.State.Initial;
this._buffer = '';
this._firstChunk = true;
this._loadedBytes = 0;
/** @type {number} */
this._totalSize;
- this._jsonTokenizer = new WebInspector.TextUtils.BalancedJSONTokenizer(this._writeBalancedJSON.bind(this), true);
+ this._jsonTokenizer = new Common.TextUtils.BalancedJSONTokenizer(this._writeBalancedJSON.bind(this), true);
}
/**
- * @param {!WebInspector.TracingModel} model
+ * @param {!SDK.TracingModel} model
* @param {!File} file
- * @param {!WebInspector.TimelineLifecycleDelegate} delegate
- * @return {!WebInspector.TimelineLoader}
+ * @param {!Timeline.TimelineLifecycleDelegate} delegate
+ * @return {!Timeline.TimelineLoader}
*/
static loadFromFile(model, file, delegate) {
- var loader = new WebInspector.TimelineLoader(model, delegate);
- var fileReader = WebInspector.TimelineLoader._createFileReader(file, loader);
+ var loader = new Timeline.TimelineLoader(model, delegate);
+ var fileReader = Timeline.TimelineLoader._createFileReader(file, loader);
loader._canceledCallback = fileReader.cancel.bind(fileReader);
loader._totalSize = file.size;
fileReader.start(loader);
@@ -44,24 +44,24 @@ WebInspector.TimelineLoader = class {
}
/**
- * @param {!WebInspector.TracingModel} model
+ * @param {!SDK.TracingModel} model
* @param {string} url
- * @param {!WebInspector.TimelineLifecycleDelegate} delegate
- * @return {!WebInspector.TimelineLoader}
+ * @param {!Timeline.TimelineLifecycleDelegate} delegate
+ * @return {!Timeline.TimelineLoader}
*/
static loadFromURL(model, url, delegate) {
- var stream = new WebInspector.TimelineLoader(model, delegate);
- WebInspector.ResourceLoader.loadAsStream(url, null, stream);
+ var stream = new Timeline.TimelineLoader(model, delegate);
+ Host.ResourceLoader.loadAsStream(url, null, stream);
return stream;
}
/**
* @param {!File} file
- * @param {!WebInspector.OutputStreamDelegate} delegate
- * @return {!WebInspector.ChunkedReader}
+ * @param {!Bindings.OutputStreamDelegate} delegate
+ * @return {!Bindings.ChunkedReader}
*/
static _createFileReader(file, delegate) {
- return new WebInspector.ChunkedFileReader(file, WebInspector.TimelineLoader.TransferChunkLengthBytes, delegate);
+ return new Bindings.ChunkedFileReader(file, Timeline.TimelineLoader.TransferChunkLengthBytes, delegate);
}
cancel() {
@@ -83,18 +83,18 @@ WebInspector.TimelineLoader = class {
if (!this._firstChunk)
this._delegate.loadingProgress(this._totalSize ? this._loadedBytes / this._totalSize : undefined);
- if (this._state === WebInspector.TimelineLoader.State.Initial) {
+ if (this._state === Timeline.TimelineLoader.State.Initial) {
if (chunk[0] === '{')
- this._state = WebInspector.TimelineLoader.State.LookingForEvents;
+ this._state = Timeline.TimelineLoader.State.LookingForEvents;
else if (chunk[0] === '[')
- this._state = WebInspector.TimelineLoader.State.ReadingEvents;
+ this._state = Timeline.TimelineLoader.State.ReadingEvents;
else {
- this._reportErrorAndCancelLoading(WebInspector.UIString('Malformed timeline data: Unknown JSON format'));
+ this._reportErrorAndCancelLoading(Common.UIString('Malformed timeline data: Unknown JSON format'));
return;
}
}
- if (this._state === WebInspector.TimelineLoader.State.LookingForEvents) {
+ if (this._state === Timeline.TimelineLoader.State.LookingForEvents) {
var objectName = '"traceEvents":';
var startPos = this._buffer.length - objectName.length;
this._buffer += chunk;
@@ -102,16 +102,16 @@ WebInspector.TimelineLoader = class {
if (pos === -1)
return;
chunk = this._buffer.slice(pos + objectName.length);
- this._state = WebInspector.TimelineLoader.State.ReadingEvents;
+ this._state = Timeline.TimelineLoader.State.ReadingEvents;
}
- if (this._state !== WebInspector.TimelineLoader.State.ReadingEvents)
+ if (this._state !== Timeline.TimelineLoader.State.ReadingEvents)
return;
if (this._jsonTokenizer.write(chunk))
return;
- this._state = WebInspector.TimelineLoader.State.SkippingTail;
+ this._state = Timeline.TimelineLoader.State.SkippingTail;
if (this._firstChunk) {
- this._reportErrorAndCancelLoading(WebInspector.UIString('Malformed timeline input, wrong JSON brackets balance'));
+ this._reportErrorAndCancelLoading(Common.UIString('Malformed timeline input, wrong JSON brackets balance'));
return;
}
}
@@ -133,9 +133,9 @@ WebInspector.TimelineLoader = class {
var items;
try {
- items = /** @type {!Array.<!WebInspector.TracingManager.EventPayload>} */ (JSON.parse(json));
+ items = /** @type {!Array.<!SDK.TracingManager.EventPayload>} */ (JSON.parse(json));
} catch (e) {
- this._reportErrorAndCancelLoading(WebInspector.UIString('Malformed timeline data: %s', e.toString()));
+ this._reportErrorAndCancelLoading(Common.UIString('Malformed timeline data: %s', e.toString()));
return;
}
@@ -143,7 +143,7 @@ WebInspector.TimelineLoader = class {
this._firstChunk = false;
this._model.reset();
if (this._looksLikeAppVersion(items[0])) {
- this._reportErrorAndCancelLoading(WebInspector.UIString('Legacy Timeline format is not supported.'));
+ this._reportErrorAndCancelLoading(Common.UIString('Legacy Timeline format is not supported.'));
return;
}
}
@@ -151,7 +151,7 @@ WebInspector.TimelineLoader = class {
try {
this._model.addEvents(items);
} catch (e) {
- this._reportErrorAndCancelLoading(WebInspector.UIString('Malformed timeline data: %s', e.toString()));
+ this._reportErrorAndCancelLoading(Common.UIString('Malformed timeline data: %s', e.toString()));
return;
}
}
@@ -161,7 +161,7 @@ WebInspector.TimelineLoader = class {
*/
_reportErrorAndCancelLoading(message) {
if (message)
- WebInspector.console.error(message);
+ Common.console.error(message);
this.cancel();
}
@@ -190,7 +190,7 @@ WebInspector.TimelineLoader = class {
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
*/
onChunkTransferred(reader) {
}
@@ -203,34 +203,34 @@ WebInspector.TimelineLoader = class {
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
* @param {!Event} event
*/
onError(reader, event) {
switch (event.target.error.name) {
case 'NotFoundError':
- this._reportErrorAndCancelLoading(WebInspector.UIString('File "%s" not found.', reader.fileName()));
+ this._reportErrorAndCancelLoading(Common.UIString('File "%s" not found.', reader.fileName()));
break;
case 'NotReadableError':
- this._reportErrorAndCancelLoading(WebInspector.UIString('File "%s" is not readable', reader.fileName()));
+ this._reportErrorAndCancelLoading(Common.UIString('File "%s" is not readable', reader.fileName()));
break;
case 'AbortError':
break;
default:
this._reportErrorAndCancelLoading(
- WebInspector.UIString('An error occurred while reading the file "%s"', reader.fileName()));
+ Common.UIString('An error occurred while reading the file "%s"', reader.fileName()));
}
}
};
-WebInspector.TimelineLoader.TransferChunkLengthBytes = 5000000;
+Timeline.TimelineLoader.TransferChunkLengthBytes = 5000000;
/**
* @enum {symbol}
*/
-WebInspector.TimelineLoader.State = {
+Timeline.TimelineLoader.State = {
Initial: Symbol('Initial'),
LookingForEvents: Symbol('LookingForEvents'),
ReadingEvents: Symbol('ReadingEvents'),
@@ -238,10 +238,10 @@ WebInspector.TimelineLoader.State = {
};
/**
- * @implements {WebInspector.OutputStreamDelegate}
+ * @implements {Bindings.OutputStreamDelegate}
* @unrestricted
*/
-WebInspector.TracingTimelineSaver = class {
+Timeline.TracingTimelineSaver = class {
/**
* @override
*/
@@ -256,19 +256,19 @@ WebInspector.TracingTimelineSaver = class {
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
*/
onChunkTransferred(reader) {
}
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
* @param {!Event} event
*/
onError(reader, event) {
var error = event.target.error;
- WebInspector.console.error(
- WebInspector.UIString('Failed to save timeline: %s (%s, %s)', error.message, error.name, error.code));
+ Common.console.error(
+ Common.UIString('Failed to save timeline: %s (%s, %s)', error.message, error.name, error.code));
}
};

Powered by Google App Engine
This is Rietveld 408576698