| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/v8_inspector/RemoteObjectId.h" | 36 #include "platform/v8_inspector/RemoteObjectId.h" |
| 37 #include "platform/v8_inspector/V8DebuggerImpl.h" | 37 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 38 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 38 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 39 #include "platform/v8_inspector/V8StringUtil.h" | 39 #include "platform/v8_inspector/V8StringUtil.h" |
| 40 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 40 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 namespace V8RuntimeAgentImplState { | 44 namespace V8RuntimeAgentImplState { |
| 45 static const char customObjectFormatterEnabled[] = "customObjectFormatterEnabled
"; | 45 static const char customObjectFormatterEnabled[] = "customObjectFormatterEnabled
"; |
| 46 static const char runtimeEnabled[] = "runtimeEnabled"; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 using protocol::Runtime::ExceptionDetails; | 49 using protocol::Runtime::ExceptionDetails; |
| 49 using protocol::Runtime::RemoteObject; | 50 using protocol::Runtime::RemoteObject; |
| 50 | 51 |
| 51 static bool hasInternalError(ErrorString* errorString, bool hasError) | 52 static bool hasInternalError(ErrorString* errorString, bool hasError) |
| 52 { | 53 { |
| 53 if (hasError) | 54 if (hasError) |
| 54 *errorString = "Internal error"; | 55 *errorString = "Internal error"; |
| 55 return hasError; | 56 return hasError; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void V8RuntimeAgentImpl::clearFrontend() | 359 void V8RuntimeAgentImpl::clearFrontend() |
| 359 { | 360 { |
| 360 ErrorString error; | 361 ErrorString error; |
| 361 disable(&error); | 362 disable(&error); |
| 362 ASSERT(m_frontend); | 363 ASSERT(m_frontend); |
| 363 m_frontend = nullptr; | 364 m_frontend = nullptr; |
| 364 } | 365 } |
| 365 | 366 |
| 366 void V8RuntimeAgentImpl::restore() | 367 void V8RuntimeAgentImpl::restore() |
| 367 { | 368 { |
| 369 if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false
)) |
| 370 return; |
| 368 m_frontend->executionContextsCleared(); | 371 m_frontend->executionContextsCleared(); |
| 369 ErrorString error; | 372 ErrorString error; |
| 370 enable(&error); | 373 enable(&error); |
| 371 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) | 374 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) |
| 372 m_session->setCustomObjectFormatterEnabled(true); | 375 m_session->setCustomObjectFormatterEnabled(true); |
| 373 } | 376 } |
| 374 | 377 |
| 375 void V8RuntimeAgentImpl::enable(ErrorString* errorString) | 378 void V8RuntimeAgentImpl::enable(ErrorString* errorString) |
| 376 { | 379 { |
| 377 if (m_enabled) | 380 if (m_enabled) |
| 378 return; | 381 return; |
| 379 m_session->changeInstrumentationCounter(+1); | 382 m_session->changeInstrumentationCounter(+1); |
| 380 m_enabled = true; | 383 m_enabled = true; |
| 384 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); |
| 381 v8::HandleScope handles(m_debugger->isolate()); | 385 v8::HandleScope handles(m_debugger->isolate()); |
| 382 m_session->reportAllContexts(this); | 386 m_session->reportAllContexts(this); |
| 383 } | 387 } |
| 384 | 388 |
| 385 void V8RuntimeAgentImpl::disable(ErrorString* errorString) | 389 void V8RuntimeAgentImpl::disable(ErrorString* errorString) |
| 386 { | 390 { |
| 387 if (!m_enabled) | 391 if (!m_enabled) |
| 388 return; | 392 return; |
| 389 m_enabled = false; | 393 m_enabled = false; |
| 394 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); |
| 390 m_session->discardInjectedScripts(); | 395 m_session->discardInjectedScripts(); |
| 391 reset(); | 396 reset(); |
| 392 m_session->changeInstrumentationCounter(-1); | 397 m_session->changeInstrumentationCounter(-1); |
| 393 } | 398 } |
| 394 | 399 |
| 395 void V8RuntimeAgentImpl::reset() | 400 void V8RuntimeAgentImpl::reset() |
| 396 { | 401 { |
| 397 m_compiledScripts.clear(); | 402 m_compiledScripts.clear(); |
| 398 if (m_enabled) { | 403 if (m_enabled) { |
| 399 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context
Group(m_session->contextGroupId())) { | 404 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context
Group(m_session->contextGroupId())) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 426 } | 431 } |
| 427 } | 432 } |
| 428 | 433 |
| 429 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) | 434 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) |
| 430 { | 435 { |
| 431 if (m_enabled) | 436 if (m_enabled) |
| 432 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); | 437 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); |
| 433 } | 438 } |
| 434 | 439 |
| 435 } // namespace blink | 440 } // namespace blink |
| OLD | NEW |