| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InjectedScript.h" | 7 #include "platform/v8_inspector/InjectedScript.h" |
| 8 #include "platform/v8_inspector/InjectedScriptHost.h" | 8 #include "platform/v8_inspector/InjectedScriptHost.h" |
| 9 #include "platform/v8_inspector/InspectedContext.h" | 9 #include "platform/v8_inspector/InspectedContext.h" |
| 10 #include "platform/v8_inspector/RemoteObjectId.h" | 10 #include "platform/v8_inspector/RemoteObjectId.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 keys.append(idContext.first); | 82 keys.append(idContext.first); |
| 83 for (auto& key : keys) { | 83 for (auto& key : keys) { |
| 84 contexts = m_debugger->contextGroup(m_contextGroupId); | 84 contexts = m_debugger->contextGroup(m_contextGroupId); |
| 85 if (contexts && contexts->contains(key)) | 85 if (contexts && contexts->contains(key)) |
| 86 contexts->get(key)->discardInjectedScript(); // This may destroy som
e contexts. | 86 contexts->get(key)->discardInjectedScript(); // This may destroy som
e contexts. |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr
ing, int contextId) | 90 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr
ing, int contextId) |
| 91 { | 91 { |
| 92 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 92 if (!contextId) { |
| 93 if (!contexts || !contexts->contains(contextId)) { | 93 *errorString = "Cannot find context with specified id"; |
| 94 *errorString = "Inspected frame has gone"; | |
| 95 return nullptr; | 94 return nullptr; |
| 96 } | 95 } |
| 97 | 96 |
| 97 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 98 if (!contexts || !contexts->contains(contextId)) { |
| 99 *errorString = "Cannot find context with specified id"; |
| 100 return nullptr; |
| 101 } |
| 102 |
| 98 InspectedContext* context = contexts->get(contextId); | 103 InspectedContext* context = contexts->get(contextId); |
| 99 if (!context->getInjectedScript()) { | 104 if (!context->getInjectedScript()) { |
| 100 context->createInjectedScript(m_injectedScriptHost.get()); | 105 context->createInjectedScript(m_injectedScriptHost.get()); |
| 101 if (!context->getInjectedScript()) { | 106 if (!context->getInjectedScript()) { |
| 102 *errorString = "Cannot access specified execution context"; | 107 *errorString = "Cannot access specified execution context"; |
| 103 return nullptr; | 108 return nullptr; |
| 104 } | 109 } |
| 105 if (m_customObjectFormatterEnabled) | 110 if (m_customObjectFormatterEnabled) |
| 106 context->getInjectedScript()->setCustomObjectFormatterEnabled(true); | 111 context->getInjectedScript()->setCustomObjectFormatterEnabled(true); |
| 107 } | 112 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) | 158 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) |
| 154 { | 159 { |
| 155 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 160 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 156 if (!contexts) | 161 if (!contexts) |
| 157 return; | 162 return; |
| 158 for (auto& idContext : *contexts) | 163 for (auto& idContext : *contexts) |
| 159 agent->reportExecutionContextCreated(idContext.second); | 164 agent->reportExecutionContextCreated(idContext.second); |
| 160 } | 165 } |
| 161 | 166 |
| 162 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |