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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/LogModel.js

Issue 2851913002: [DevTools] Do not expose agents on Target
Patch Set: storage and tests.js Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @implements {Protocol.LogDispatcher} 6 * @implements {Protocol.LogDispatcher}
7 */ 7 */
8 SDK.LogModel = class extends SDK.SDKModel { 8 SDK.LogModel = class extends SDK.SDKModel {
9 /** 9 /**
10 * @param {!SDK.Target} target 10 * @param {!SDK.Target} target
11 * @param {!Protocol.Dispatcher} dispatcher
11 */ 12 */
12 constructor(target) { 13 constructor(target, dispatcher) {
13 super(target); 14 super(target, dispatcher);
14 target.registerLogDispatcher(this); 15 dispatcher.registerLogDispatcher(this);
15 this._logAgent = target.logAgent(); 16 this._logAgent = dispatcher.logAgent();
16 this._logAgent.enable(); 17 this._logAgent.enable();
17 if (!Host.isUnderTest()) { 18 if (!Host.isUnderTest()) {
18 this._logAgent.startViolationsReport([ 19 this._logAgent.startViolationsReport([
19 {name: 'longTask', threshold: 200}, {name: 'longLayout', threshold: 30}, {name: 'blockedEvent', threshold: 100}, 20 {name: 'longTask', threshold: 200}, {name: 'longLayout', threshold: 30}, {name: 'blockedEvent', threshold: 100},
20 {name: 'blockedParser', threshold: -1}, {name: 'handler', threshold: 150 }, 21 {name: 'blockedParser', threshold: -1}, {name: 'handler', threshold: 150 },
21 {name: 'recurringHandler', threshold: 50}, {name: 'discouragedAPIUse', t hreshold: -1} 22 {name: 'recurringHandler', threshold: 50}, {name: 'discouragedAPIUse', t hreshold: -1}
22 ]); 23 ]);
23 } 24 }
24 } 25 }
25 26
26 /** 27 /**
27 * @override 28 * @override
28 * @param {!Protocol.Log.LogEntry} payload 29 * @param {!Protocol.Log.LogEntry} payload
29 */ 30 */
30 entryAdded(payload) { 31 entryAdded(payload) {
31 this.dispatchEventToListeners(SDK.LogModel.Events.EntryAdded, {logModel: thi s, entry: payload}); 32 this.dispatchEventToListeners(SDK.LogModel.Events.EntryAdded, {logModel: thi s, entry: payload});
32 } 33 }
33 34
34 requestClear() { 35 requestClear() {
35 this._logAgent.clear(); 36 this._logAgent.clear();
36 } 37 }
37 }; 38 };
38 39
39 SDK.SDKModel.register(SDK.LogModel, SDK.Target.Capability.Log, true); 40 SDK.SDKModel.register(SDK.LogModel, SDK.Target.Capability.Log, true);
40 41
41 /** @enum {symbol} */ 42 /** @enum {symbol} */
42 SDK.LogModel.Events = { 43 SDK.LogModel.Events = {
43 EntryAdded: Symbol('EntryAdded') 44 EntryAdded: Symbol('EntryAdded')
44 }; 45 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698