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/inspector_protocol/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
8 #include "platform/v8_inspector/InjectedScript.h" | 8 #include "platform/v8_inspector/InjectedScript.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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 continue; | 186 continue; |
187 auto contextsIt = contexts->find(key); | 187 auto contextsIt = contexts->find(key); |
188 if (contextsIt == contexts->end()) | 188 if (contextsIt == contexts->end()) |
189 continue; | 189 continue; |
190 InjectedScript* injectedScript = contextsIt->second->getInjectedScript()
; | 190 InjectedScript* injectedScript = contextsIt->second->getInjectedScript()
; |
191 if (injectedScript) | 191 if (injectedScript) |
192 injectedScript->releaseObjectGroup(objectGroup); // This may destroy
some contexts. | 192 injectedScript->releaseObjectGroup(objectGroup); // This may destroy
some contexts. |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 v8::Local<v8::Value> V8InspectorSessionImpl::findObject(ErrorString* errorString
, const String16& objectId, v8::Local<v8::Context>* context, String16* groupName
) | 196 bool V8InspectorSessionImpl::unwrapObject(ErrorString* errorString, const String
16& objectId, v8::Local<v8::Value>* object, v8::Local<v8::Context>* context, Str
ing16* objectGroup) |
197 { | 197 { |
198 std::unique_ptr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString
, objectId); | 198 std::unique_ptr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString
, objectId); |
199 if (!remoteId) | 199 if (!remoteId) |
200 return v8::Local<v8::Value>(); | 200 return false; |
201 InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.ge
t()); | 201 InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.ge
t()); |
202 if (!injectedScript) | 202 if (!injectedScript) |
203 return v8::Local<v8::Value>(); | 203 return false; |
204 v8::Local<v8::Value> objectValue; | 204 if (!injectedScript->findObject(errorString, *remoteId, object)) |
205 injectedScript->findObject(errorString, *remoteId, &objectValue); | 205 return false; |
206 if (objectValue.IsEmpty()) | 206 *context = injectedScript->context()->context(); |
207 return v8::Local<v8::Value>(); | 207 *objectGroup = injectedScript->objectGroupName(*remoteId); |
208 if (context) | 208 return true; |
209 *context = injectedScript->context()->context(); | |
210 if (groupName) | |
211 *groupName = injectedScript->objectGroupName(*remoteId); | |
212 return objectValue; | |
213 } | 209 } |
214 | 210 |
215 std::unique_ptr<protocol::Runtime::API::RemoteObject> V8InspectorSessionImpl::wr
apObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const Strin
g16& groupName) | 211 std::unique_ptr<protocol::Runtime::API::RemoteObject> V8InspectorSessionImpl::wr
apObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const Strin
g16& groupName) |
216 { | 212 { |
217 return wrapObject(context, value, groupName, false); | 213 return wrapObject(context, value, groupName, false); |
218 } | 214 } |
219 | 215 |
220 std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObj
ect(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16&
groupName, bool generatePreview) | 216 std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObj
ect(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16&
groupName, bool generatePreview) |
221 { | 217 { |
222 ErrorString errorString; | 218 ErrorString errorString; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> V8Inspect
orSessionImpl::searchInTextByLines(const String16& text, const String16& query,
bool caseSensitive, bool isRegex) | 313 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> V8Inspect
orSessionImpl::searchInTextByLines(const String16& text, const String16& query,
bool caseSensitive, bool isRegex) |
318 { | 314 { |
319 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(this, text, query, caseSensitive, isRegex); | 315 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(this, text, query, caseSensitive, isRegex); |
320 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> resul
t = protocol::Array<protocol::Debugger::API::SearchMatch>::create(); | 316 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> resul
t = protocol::Array<protocol::Debugger::API::SearchMatch>::create(); |
321 for (size_t i = 0; i < matches.size(); ++i) | 317 for (size_t i = 0; i < matches.size(); ++i) |
322 result->addItem(std::move(matches[i])); | 318 result->addItem(std::move(matches[i])); |
323 return result; | 319 return result; |
324 } | 320 } |
325 | 321 |
326 } // namespace blink | 322 } // namespace blink |
OLD | NEW |