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

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

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 WebInspector.WorkerManager.prototype = { 52 WebInspector.WorkerManager.prototype = {
53 enable: function() 53 enable: function()
54 { 54 {
55 if (this._enabled) 55 if (this._enabled)
56 return; 56 return;
57 this._enabled = true; 57 this._enabled = true;
58 58
59 this.target().workerAgent().enable(); 59 this.target().workerAgent().enable();
60 this.target().resourceTreeModel.addEventListener(WebInspector.TargetMana ger.Events.MainFrameNavigated, this._mainFrameNavigated, this); 60 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this.t arget());
61 if (resourceTreeModel)
62 resourceTreeModel.addEventListener(WebInspector.TargetManager.Events .MainFrameNavigated, this._mainFrameNavigated, this);
61 }, 63 },
62 64
63 disable: function() 65 disable: function()
64 { 66 {
65 if (!this._enabled) 67 if (!this._enabled)
66 return; 68 return;
67 this._enabled = false; 69 this._enabled = false;
68 this._reset(); 70 this._reset();
69 this.target().workerAgent().disable(); 71 this.target().workerAgent().disable();
70 this.target().resourceTreeModel.removeEventListener(WebInspector.TargetM anager.Events.MainFrameNavigated, this._mainFrameNavigated, this); 72 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this.t arget());
73 if (resourceTreeModel)
74 resourceTreeModel.removeEventListener(WebInspector.TargetManager.Eve nts.MainFrameNavigated, this._mainFrameNavigated, this);
dgozman 2016/07/14 16:29:29 This is a very strange dependency. I think it shou
eostroukhov-old 2016/07/20 23:46:16 Switched to listening to TargetManager instead.
71 }, 75 },
72 76
73 dispose: function() 77 dispose: function()
74 { 78 {
75 this._reset(); 79 this._reset();
76 }, 80 },
77 81
78 _reset: function() 82 _reset: function()
79 { 83 {
80 for (var connection of this._connections.values()) 84 for (var connection of this._connections.values())
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 this._agent.sendMessageToWorker(this._workerId, JSON.stringify(messageOb ject)); 225 this._agent.sendMessageToWorker(this._workerId, JSON.stringify(messageOb ject));
222 }, 226 },
223 227
224 _close: function() 228 _close: function()
225 { 229 {
226 this.connectionClosed("worker_terminated"); 230 this.connectionClosed("worker_terminated");
227 }, 231 },
228 232
229 __proto__: InspectorBackendClass.Connection.prototype 233 __proto__: InspectorBackendClass.Connection.prototype
230 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698