Chromium Code Reviews| Index: Source/devtools/front_end/PowerProfiler.js |
| diff --git a/Source/devtools/front_end/RequestHTMLView.js b/Source/devtools/front_end/PowerProfiler.js |
| old mode 100644 |
| new mode 100755 |
| similarity index 54% |
| copy from Source/devtools/front_end/RequestHTMLView.js |
| copy to Source/devtools/front_end/PowerProfiler.js |
| index 63facf378fd0cebd10b6aada235dae0913554ac7..aabbb3d5aa364ff32da2ba79d4cd1ae3be2efbd7 |
| --- a/Source/devtools/front_end/RequestHTMLView.js |
| +++ b/Source/devtools/front_end/PowerProfiler.js |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2011 Google Inc. All rights reserved. |
| + * Copyright (C) 2013 Intel Inc. All rights reserved. |
|
alph
2014/02/13 11:59:47
There's a new much shorter copyright header.
Pan
2014/02/24 09:49:47
thanks, the shorter one introduced :)
|
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| @@ -30,43 +30,59 @@ |
| /** |
| * @constructor |
| - * @extends {WebInspector.RequestView} |
| - * @param {WebInspector.NetworkRequest} request |
| - * @param {string} dataURL |
| + * @extends {WebInspector.Object} |
| */ |
| -WebInspector.RequestHTMLView = function(request, dataURL) |
| +WebInspector.PowerProfiler = function() |
| { |
| - WebInspector.RequestView.call(this, request); |
| - this._dataURL = dataURL; |
| - this.element.addStyleClass("html"); |
| + WebInspector.Object.call(this); |
| + this._dispatcher = new WebInspector.PowerDispatcher(this); |
| } |
| -WebInspector.RequestHTMLView.prototype = { |
| - hasContent: function() |
| +WebInspector.PowerProfiler.EventTypes = { |
| + PowerEventRecorded: "PowerEventRecorded", |
| + PowerProfileSupportStatus: "PowerProfileSupportStatus" |
| +} |
| + |
| + |
| +WebInspector.PowerProfiler.prototype = { |
| + |
| + startProfile: function () |
| { |
| - return true; |
| + InspectorFrontendHost.startPowerProfile(); |
| }, |
| - wasShown: function() |
| + stopProfile: function () |
| { |
| - this._createIFrame(); |
| + InspectorFrontendHost.stopPowerProfile(); |
| }, |
| - willHide: function(parentElement) |
| + checkStatus: function () |
| { |
| - this.element.removeChildren(); |
| + InspectorFrontendHost.checkPowerProfileSupportedStatus(); |
| }, |
| - _createIFrame: function() |
| + __proto__: WebInspector.Object.prototype |
| +} |
| + |
| +/** |
| + * @constructor |
| + * @implements {WebInspector.PowerEventDispatcher} |
| + */ |
| +WebInspector.PowerDispatcher = function(profiler) |
| +{ |
| + this._profiler = profiler; |
| + InspectorBackend.registerPowerDispatcher(this); |
| +} |
| + |
| +WebInspector.PowerDispatcher.prototype = { |
| + PowerEventsReceived: function(events) |
| { |
| - // We need to create iframe again each time because contentDocument |
| - // is deleted when iframe is removed from its parent. |
| - this.element.removeChildren(); |
| - var iframe = document.createElement("iframe"); |
| - iframe.setAttribute("sandbox", ""); // Forbid to run JavaScript and set unique origin. |
| - iframe.setAttribute("src", this._dataURL); |
| - this.element.appendChild(iframe); |
| + this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.EventTypes.PowerEventRecorded, events); |
| }, |
| - __proto__: WebInspector.RequestView.prototype |
| + powerProfileSupported: function(events) |
| + { |
| + this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.EventTypes.PowerProfileSupportStatus, events); |
| + } |
| } |
| + |