OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * 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 :)
| |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
(...skipping 10 matching lines...) Expand all Loading... | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.RequestView} | 33 * @extends {WebInspector.Object} |
34 * @param {WebInspector.NetworkRequest} request | |
35 * @param {string} dataURL | |
36 */ | 34 */ |
37 WebInspector.RequestHTMLView = function(request, dataURL) | 35 WebInspector.PowerProfiler = function() |
38 { | 36 { |
39 WebInspector.RequestView.call(this, request); | 37 WebInspector.Object.call(this); |
40 this._dataURL = dataURL; | 38 this._dispatcher = new WebInspector.PowerDispatcher(this); |
41 this.element.addStyleClass("html"); | |
42 } | 39 } |
43 | 40 |
44 WebInspector.RequestHTMLView.prototype = { | 41 WebInspector.PowerProfiler.EventTypes = { |
45 hasContent: function() | 42 PowerEventRecorded: "PowerEventRecorded", |
43 PowerProfileSupportStatus: "PowerProfileSupportStatus" | |
44 } | |
45 | |
46 | |
47 WebInspector.PowerProfiler.prototype = { | |
48 | |
49 startProfile: function () | |
46 { | 50 { |
47 return true; | 51 InspectorFrontendHost.startPowerProfile(); |
48 }, | 52 }, |
49 | 53 |
50 wasShown: function() | 54 stopProfile: function () |
51 { | 55 { |
52 this._createIFrame(); | 56 InspectorFrontendHost.stopPowerProfile(); |
53 }, | 57 }, |
54 | 58 |
55 willHide: function(parentElement) | 59 checkStatus: function () |
56 { | 60 { |
57 this.element.removeChildren(); | 61 InspectorFrontendHost.checkPowerProfileSupportedStatus(); |
58 }, | 62 }, |
59 | 63 |
60 _createIFrame: function() | 64 __proto__: WebInspector.Object.prototype |
65 } | |
66 | |
67 /** | |
68 * @constructor | |
69 * @implements {WebInspector.PowerEventDispatcher} | |
70 */ | |
71 WebInspector.PowerDispatcher = function(profiler) | |
72 { | |
73 this._profiler = profiler; | |
74 InspectorBackend.registerPowerDispatcher(this); | |
75 } | |
76 | |
77 WebInspector.PowerDispatcher.prototype = { | |
78 PowerEventsReceived: function(events) | |
61 { | 79 { |
62 // We need to create iframe again each time because contentDocument | 80 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.Event Types.PowerEventRecorded, events); |
63 // is deleted when iframe is removed from its parent. | |
64 this.element.removeChildren(); | |
65 var iframe = document.createElement("iframe"); | |
66 iframe.setAttribute("sandbox", ""); // Forbid to run JavaScript and set unique origin. | |
67 iframe.setAttribute("src", this._dataURL); | |
68 this.element.appendChild(iframe); | |
69 }, | 81 }, |
70 | 82 |
71 __proto__: WebInspector.RequestView.prototype | 83 powerProfileSupported: function(events) |
84 { | |
85 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.Event Types.PowerProfileSupportStatus, events); | |
86 } | |
72 } | 87 } |
88 | |
OLD | NEW |