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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1942073002: [DevTools] Move getCompletions to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 /* 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return; 231 return;
232 propertiesProtocolArray->addItem(InternalPropertyDescriptor::create() 232 propertiesProtocolArray->addItem(InternalPropertyDescriptor::create()
233 .setName(toProtocolString(name.As<v8::String>())) 233 .setName(toProtocolString(name.As<v8::String>()))
234 .setValue(wrappedValue.release()).build()); 234 .setValue(wrappedValue.release()).build());
235 } 235 }
236 if (!propertiesProtocolArray->length()) 236 if (!propertiesProtocolArray->length())
237 return; 237 return;
238 *internalProperties = propertiesProtocolArray.release(); 238 *internalProperties = propertiesProtocolArray.release();
239 } 239 }
240 240
241 void V8RuntimeAgentImpl::getCompletions(
242 ErrorString* errorString,
243 const Maybe<String16>& objectId,
244 const Maybe<String16>& primitiveType,
245 OwnPtr<protocol::Array<String16>>* completions)
246 {
247 if (!objectId.isJust() && !primitiveType.isJust() && !(primitiveType.isJust( ) && objectId.isJust())) {
248 *errorString = "'objectId' or 'primitiveType 'should be passed.";
249 return;
250 }
251 if (objectId.isJust()) {
252 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->co ntextGroupId(), objectId.fromJust());
253 if (!scope.initialize())
254 return;
255 scope.injectedScript()->getCompletions(errorString, scope.object(), comp letions);
256 } else {
257 int contextId = m_debugger->client()->ensureDefaultContextInGroup(m_sess ion->contextGroupId());
258 if (!contextId) {
259 *errorString = "Cannot find default execution context";
260 return;
261 }
262 InjectedScript::ContextScope scope(errorString, m_debugger, m_session->c ontextGroupId(), contextId);
263 if (!scope.initialize())
264 return;
265 scope.injectedScript()->getCompletions(errorString, primitiveType.fromJu st(), completions);
266 }
267 }
268
269
241 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16& objectId) 270 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16& objectId)
242 { 271 {
243 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), objectId); 272 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), objectId);
244 if (!scope.initialize()) 273 if (!scope.initialize())
245 return; 274 return;
246 scope.injectedScript()->releaseObject(objectId); 275 scope.injectedScript()->releaseObject(objectId);
247 } 276 }
248 277
249 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object Group) 278 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object Group)
250 { 279 {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 451 }
423 } 452 }
424 453
425 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) 454 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints)
426 { 455 {
427 if (m_enabled) 456 if (m_enabled)
428 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints )); 457 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints ));
429 } 458 }
430 459
431 } // namespace blink 460 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698