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

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

Issue 2179683002: [DevTools] Cleanup v8_inspector API part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: breakDetails Created 4 years, 4 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ErrorString error; 362 ErrorString error;
363 enable(&error); 363 enable(&error);
364 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE nabled, false)) 364 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE nabled, false))
365 m_session->setCustomObjectFormatterEnabled(true); 365 m_session->setCustomObjectFormatterEnabled(true);
366 } 366 }
367 367
368 void V8RuntimeAgentImpl::enable(ErrorString* errorString) 368 void V8RuntimeAgentImpl::enable(ErrorString* errorString)
369 { 369 {
370 if (m_enabled) 370 if (m_enabled)
371 return; 371 return;
372 m_session->client()->runtimeEnabled(); 372 m_debugger->client()->beginEnsureAllContextsInGroup(m_session->contextGroupI d());
373 m_enabled = true; 373 m_enabled = true;
374 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); 374 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true);
375 m_session->debugger()->enableStackCapturingIfNeeded(); 375 m_session->debugger()->enableStackCapturingIfNeeded();
376 m_session->reportAllContexts(this); 376 m_session->reportAllContexts(this);
377 V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessa geStorage(m_session->contextGroupId()); 377 V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessa geStorage(m_session->contextGroupId());
378 for (const auto& message : storage->messages()) 378 for (const auto& message : storage->messages())
379 reportMessage(message.get(), false); 379 reportMessage(message.get(), false);
380 } 380 }
381 381
382 void V8RuntimeAgentImpl::disable(ErrorString* errorString) 382 void V8RuntimeAgentImpl::disable(ErrorString* errorString)
383 { 383 {
384 if (!m_enabled) 384 if (!m_enabled)
385 return; 385 return;
386 m_enabled = false; 386 m_enabled = false;
387 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); 387 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false);
388 m_session->debugger()->disableStackCapturingIfNeeded(); 388 m_session->debugger()->disableStackCapturingIfNeeded();
389 m_session->discardInjectedScripts(); 389 m_session->discardInjectedScripts();
390 reset(); 390 reset();
391 m_session->client()->runtimeDisabled(); 391 m_debugger->client()->endEnsureAllContextsInGroup(m_session->contextGroupId( ));
392 } 392 }
393 393
394 void V8RuntimeAgentImpl::reset() 394 void V8RuntimeAgentImpl::reset()
395 { 395 {
396 m_compiledScripts.clear(); 396 m_compiledScripts.clear();
397 if (m_enabled) { 397 if (m_enabled) {
398 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context Group(m_session->contextGroupId())) { 398 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context Group(m_session->contextGroupId())) {
399 for (auto& idContext : *contexts) 399 for (auto& idContext : *contexts)
400 idContext.second->setReported(false); 400 idContext.second->setReported(false);
401 } 401 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 reportMessage(message, true); 437 reportMessage(message, true);
438 } 438 }
439 439
440 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP review) 440 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP review)
441 { 441 {
442 message->reportToFrontend(&m_frontend, m_session, generatePreview); 442 message->reportToFrontend(&m_frontend, m_session, generatePreview);
443 m_frontend.flush(); 443 m_frontend.flush();
444 } 444 }
445 445
446 } // namespace blink 446 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698