Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 if (connected_proxies_.find(proxy->InspectorId()) == connected_proxies_.end()) | 131 if (connected_proxies_.find(proxy->InspectorId()) == connected_proxies_.end()) |
| 132 return; | 132 return; |
| 133 AttachedWorkerIds()->remove(proxy->InspectorId()); | 133 AttachedWorkerIds()->remove(proxy->InspectorId()); |
| 134 GetFrontend()->detachedFromTarget(proxy->InspectorId()); | 134 GetFrontend()->detachedFromTarget(proxy->InspectorId()); |
| 135 proxy->DisconnectFromInspector(this); | 135 proxy->DisconnectFromInspector(this); |
| 136 connected_proxies_.erase(proxy->InspectorId()); | 136 connected_proxies_.erase(proxy->InspectorId()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void InspectorWorkerAgent::ConnectToAllProxies() { | 139 void InspectorWorkerAgent::ConnectToAllProxies() { |
| 140 for (WorkerInspectorProxy* proxy : WorkerInspectorProxy::AllProxies()) { | 140 for (WorkerInspectorProxy* proxy : WorkerInspectorProxy::AllProxies()) { |
| 141 if (proxy->GetDocument()->GetFrame() && | 141 // For now we assume this is document. TODO(kinuko): Fix this. |
| 142 inspected_frames_->Contains(proxy->GetDocument()->GetFrame())) | 142 DCHECK(proxy->GetExecutionContext()->IsDocument()); |
| 143 Document* document = ToDocument(proxy->GetExecutionContext()); | |
|
kinuko
2017/05/18 14:41:41
I turned this to use cast & back to use frames for
| |
| 144 if (document->GetFrame() && | |
| 145 inspected_frames_->Contains(document->GetFrame())) | |
| 143 ConnectToProxy(proxy, false); | 146 ConnectToProxy(proxy, false); |
| 144 } | 147 } |
| 145 } | 148 } |
| 146 | 149 |
| 147 void InspectorWorkerAgent::DisconnectFromAllProxies(bool report_to_frontend) { | 150 void InspectorWorkerAgent::DisconnectFromAllProxies(bool report_to_frontend) { |
| 148 for (auto& id_proxy : connected_proxies_) { | 151 for (auto& id_proxy : connected_proxies_) { |
| 149 if (report_to_frontend) { | 152 if (report_to_frontend) { |
| 150 AttachedWorkerIds()->remove(id_proxy.key); | 153 AttachedWorkerIds()->remove(id_proxy.key); |
| 151 GetFrontend()->detachedFromTarget(id_proxy.key); | 154 GetFrontend()->detachedFromTarget(id_proxy.key); |
| 152 } | 155 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 GetFrontend()->receivedMessageFromTarget(proxy->InspectorId(), message); | 206 GetFrontend()->receivedMessageFromTarget(proxy->InspectorId(), message); |
| 204 } | 207 } |
| 205 | 208 |
| 206 DEFINE_TRACE(InspectorWorkerAgent) { | 209 DEFINE_TRACE(InspectorWorkerAgent) { |
| 207 visitor->Trace(connected_proxies_); | 210 visitor->Trace(connected_proxies_); |
| 208 visitor->Trace(inspected_frames_); | 211 visitor->Trace(inspected_frames_); |
| 209 InspectorBaseAgent::Trace(visitor); | 212 InspectorBaseAgent::Trace(visitor); |
| 210 } | 213 } |
| 211 | 214 |
| 212 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |