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 38 matching lines...) Loading... |
49 using protocol::Runtime::ExceptionDetails; | 49 using protocol::Runtime::ExceptionDetails; |
50 using protocol::Runtime::RemoteObject; | 50 using protocol::Runtime::RemoteObject; |
51 | 51 |
52 static bool hasInternalError(ErrorString* errorString, bool hasError) | 52 static bool hasInternalError(ErrorString* errorString, bool hasError) |
53 { | 53 { |
54 if (hasError) | 54 if (hasError) |
55 *errorString = "Internal error"; | 55 *errorString = "Internal error"; |
56 return hasError; | 56 return hasError; |
57 } | 57 } |
58 | 58 |
59 V8RuntimeAgentImpl::V8RuntimeAgentImpl(V8InspectorSessionImpl* session) | 59 V8RuntimeAgentImpl::V8RuntimeAgentImpl(V8InspectorSessionImpl* session, protocol
::Frontend::Runtime* frontend, protocol::DictionaryValue* state) |
60 : m_session(session) | 60 : m_session(session) |
61 , m_state(nullptr) | 61 , m_state(state) |
62 , m_frontend(nullptr) | 62 , m_frontend(frontend) |
63 , m_debugger(session->debugger()) | 63 , m_debugger(session->debugger()) |
64 , m_enabled(false) | 64 , m_enabled(false) |
65 { | 65 { |
66 } | 66 } |
67 | 67 |
68 V8RuntimeAgentImpl::~V8RuntimeAgentImpl() | 68 V8RuntimeAgentImpl::~V8RuntimeAgentImpl() |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 void V8RuntimeAgentImpl::evaluate( | 72 void V8RuntimeAgentImpl::evaluate( |
(...skipping 263 matching lines...) Loading... |
336 return; | 336 return; |
337 | 337 |
338 v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->runCompiledScript(s
cope.context(), script); | 338 v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->runCompiledScript(s
cope.context(), script); |
339 | 339 |
340 // Re-initialize after running client's code, as it could have destroyed con
text or session. | 340 // Re-initialize after running client's code, as it could have destroyed con
text or session. |
341 if (!scope.initialize()) | 341 if (!scope.initialize()) |
342 return; | 342 return; |
343 scope.injectedScript()->wrapEvaluateResult(errorString, maybeResultValue, sc
ope.tryCatch(), objectGroup.fromMaybe(""), false, false, result, nullptr, except
ionDetails); | 343 scope.injectedScript()->wrapEvaluateResult(errorString, maybeResultValue, sc
ope.tryCatch(), objectGroup.fromMaybe(""), false, false, result, nullptr, except
ionDetails); |
344 } | 344 } |
345 | 345 |
346 void V8RuntimeAgentImpl::setInspectorState(protocol::DictionaryValue* state) | |
347 { | |
348 m_state = state; | |
349 } | |
350 | |
351 void V8RuntimeAgentImpl::setFrontend(protocol::Frontend::Runtime* frontend) | |
352 { | |
353 m_frontend = frontend; | |
354 } | |
355 | |
356 void V8RuntimeAgentImpl::clearFrontend() | |
357 { | |
358 ErrorString error; | |
359 disable(&error); | |
360 DCHECK(m_frontend); | |
361 m_frontend = nullptr; | |
362 } | |
363 | |
364 void V8RuntimeAgentImpl::restore() | 346 void V8RuntimeAgentImpl::restore() |
365 { | 347 { |
366 if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false
)) | 348 if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false
)) |
367 return; | 349 return; |
368 m_frontend->executionContextsCleared(); | 350 m_frontend->executionContextsCleared(); |
369 ErrorString error; | 351 ErrorString error; |
370 enable(&error); | 352 enable(&error); |
371 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) | 353 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) |
372 m_session->setCustomObjectFormatterEnabled(true); | 354 m_session->setCustomObjectFormatterEnabled(true); |
373 } | 355 } |
(...skipping 54 matching lines...) Loading... |
428 } | 410 } |
429 } | 411 } |
430 | 412 |
431 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) | 413 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) |
432 { | 414 { |
433 if (m_enabled) | 415 if (m_enabled) |
434 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); | 416 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); |
435 } | 417 } |
436 | 418 |
437 } // namespace blink | 419 } // namespace blink |
OLD | NEW |