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

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

Issue 1924663006: [DevTools] Move API methods from V8RuntimeAgent to V8InspectorSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger-into-session
Patch Set: rebased 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 void V8RuntimeAgentImpl::disable(ErrorString* errorString) 376 void V8RuntimeAgentImpl::disable(ErrorString* errorString)
377 { 377 {
378 if (!m_enabled) 378 if (!m_enabled)
379 return; 379 return;
380 m_enabled = false; 380 m_enabled = false;
381 m_session->discardInjectedScripts(); 381 m_session->discardInjectedScripts();
382 reset(); 382 reset();
383 m_session->changeInstrumentationCounter(-1); 383 m_session->changeInstrumentationCounter(-1);
384 } 384 }
385 385
386 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapObject(v8::Local<v8::Context> c ontext, v8::Local<v8::Value> value, const String16& groupName, bool generatePrev iew)
387 {
388 ErrorString errorString;
389 InjectedScript* injectedScript = m_session->findInjectedScript(&errorString, V8Debugger::contextId(context));
390 if (!injectedScript)
391 return nullptr;
392 return injectedScript->wrapObject(&errorString, value, groupName, false, gen eratePreview);
393 }
394
395 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapTable(v8::Local<v8::Context> co ntext, v8::Local<v8::Value> table, v8::Local<v8::Value> columns)
396 {
397 ErrorString errorString;
398 InjectedScript* injectedScript = m_session->findInjectedScript(&errorString, V8Debugger::contextId(context));
399 if (!injectedScript)
400 return nullptr;
401 return injectedScript->wrapTable(table, columns);
402 }
403
404 void V8RuntimeAgentImpl::disposeObjectGroup(const String16& groupName)
405 {
406 m_session->releaseObjectGroup(groupName);
407 }
408
409 v8::Local<v8::Value> V8RuntimeAgentImpl::findObject(ErrorString* errorString, co nst String16& objectId, v8::Local<v8::Context>* context, String16* groupName)
410 {
411 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString, objectI d);
412 if (!remoteId)
413 return v8::Local<v8::Value>();
414 InjectedScript* injectedScript = m_session->findInjectedScript(errorString, remoteId.get());
415 if (!injectedScript)
416 return v8::Local<v8::Value>();
417 v8::Local<v8::Value> objectValue;
418 injectedScript->findObject(errorString, *remoteId, &objectValue);
419 if (objectValue.IsEmpty())
420 return v8::Local<v8::Value>();
421 if (context)
422 *context = injectedScript->context()->context();
423 if (groupName)
424 *groupName = injectedScript->objectGroupName(*remoteId);
425 return objectValue;
426 }
427
428 void V8RuntimeAgentImpl::addInspectedObject(PassOwnPtr<Inspectable> inspectable)
429 {
430 m_session->addInspectedObject(std::move(inspectable));
431 }
432
433 void V8RuntimeAgentImpl::reset() 386 void V8RuntimeAgentImpl::reset()
434 { 387 {
435 m_compiledScripts.clear(); 388 m_compiledScripts.clear();
436 if (m_enabled) { 389 if (m_enabled) {
437 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context Group(m_session->contextGroupId())) { 390 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context Group(m_session->contextGroupId())) {
438 for (auto& idContext : *contexts) 391 for (auto& idContext : *contexts)
439 idContext.second->setReported(false); 392 idContext.second->setReported(false);
440 } 393 }
441 m_frontend->executionContextsCleared(); 394 m_frontend->executionContextsCleared();
442 } 395 }
(...skipping 21 matching lines...) Expand all
464 } 417 }
465 } 418 }
466 419
467 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) 420 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints)
468 { 421 {
469 if (m_enabled) 422 if (m_enabled)
470 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints )); 423 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints ));
471 } 424 }
472 425
473 } // namespace blink 426 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698