| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 */ | 33 */ |
| 34 WebInspector.TracingAgent = function() | 34 WebInspector.TracingAgent = function() |
| 35 { | 35 { |
| 36 this._active = false; | 36 this._active = false; |
| 37 InspectorBackend.registerTracingDispatcher(new WebInspector.TracingDispatche
r(this)); | 37 InspectorBackend.registerTracingDispatcher(new WebInspector.TracingDispatche
r(this)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 WebInspector.TracingAgent.prototype = { | 40 WebInspector.TracingAgent.prototype = { |
| 41 /** | 41 /** |
| 42 * @param {string} categoryPatterns | 42 * @param {string} categoryPatterns |
| 43 * @param {string} options |
| 43 * @param {function(?string)=} callback | 44 * @param {function(?string)=} callback |
| 44 */ | 45 */ |
| 45 start: function(categoryPatterns, callback) | 46 start: function(categoryPatterns, options, callback) |
| 46 { | 47 { |
| 47 TracingAgent.start(categoryPatterns, callback); | 48 TracingAgent.start(categoryPatterns, options, callback); |
| 48 this._active = true; | 49 this._active = true; |
| 49 this._events = []; | 50 this._events = []; |
| 50 }, | 51 }, |
| 51 | 52 |
| 52 /** | 53 /** |
| 53 * @param {function()} callback | 54 * @param {function()} callback |
| 54 */ | 55 */ |
| 55 stop: function(callback) | 56 stop: function(callback) |
| 56 { | 57 { |
| 57 if (!this._active) { | 58 if (!this._active) { |
| 58 callback(); | 59 callback(); |
| 59 return; | 60 return; |
| 60 } | 61 } |
| 61 this._pendingStopCallback = callback; | 62 this._pendingStopCallback = callback; |
| 62 TracingAgent.end(); | 63 TracingAgent.end(); |
| 63 }, | 64 }, |
| 64 | 65 |
| 66 /** |
| 67 * @return {!Array.<{cat: string, args: Object, ph: string, ts: number}>} |
| 68 */ |
| 65 events: function() | 69 events: function() |
| 66 { | 70 { |
| 67 return this._events; | 71 return this._events; |
| 68 }, | 72 }, |
| 69 | 73 |
| 70 _eventsCollected: function(events) | 74 _eventsCollected: function(events) |
| 71 { | 75 { |
| 72 Array.prototype.push.apply(this._events, events); | 76 Array.prototype.push.apply(this._events, events); |
| 73 }, | 77 }, |
| 74 | 78 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 96 dataCollected: function(data) | 100 dataCollected: function(data) |
| 97 { | 101 { |
| 98 this._tracingAgent._eventsCollected(data); | 102 this._tracingAgent._eventsCollected(data); |
| 99 }, | 103 }, |
| 100 | 104 |
| 101 tracingComplete: function() | 105 tracingComplete: function() |
| 102 { | 106 { |
| 103 this._tracingAgent._tracingComplete(); | 107 this._tracingAgent._tracingComplete(); |
| 104 } | 108 } |
| 105 } | 109 } |
| 110 |
| 111 /** |
| 112 * @type {WebInspector.TracingAgent} |
| 113 */ |
| 114 WebInspector.tracingAgent; |
| OLD | NEW |