| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (hasInternalError(errorString, !propertiesArray->Get(scope.context(),
i).ToLocal(&name)) || !name->IsString()) | 229 if (hasInternalError(errorString, !propertiesArray->Get(scope.context(),
i).ToLocal(&name)) || !name->IsString()) |
| 230 return; | 230 return; |
| 231 v8::Local<v8::Value> value; | 231 v8::Local<v8::Value> value; |
| 232 if (hasInternalError(errorString, !propertiesArray->Get(scope.context(),
i + 1).ToLocal(&value))) | 232 if (hasInternalError(errorString, !propertiesArray->Get(scope.context(),
i + 1).ToLocal(&value))) |
| 233 return; | 233 return; |
| 234 OwnPtr<RemoteObject> wrappedValue = scope.injectedScript()->wrapObject(e
rrorString, value, scope.objectGroupName()); | 234 OwnPtr<RemoteObject> wrappedValue = scope.injectedScript()->wrapObject(e
rrorString, value, scope.objectGroupName()); |
| 235 if (!wrappedValue) | 235 if (!wrappedValue) |
| 236 return; | 236 return; |
| 237 propertiesProtocolArray->addItem(InternalPropertyDescriptor::create() | 237 propertiesProtocolArray->addItem(InternalPropertyDescriptor::create() |
| 238 .setName(toProtocolString(name.As<v8::String>())) | 238 .setName(toProtocolString(name.As<v8::String>())) |
| 239 .setValue(wrappedValue.release()).build()); | 239 .setValue(std::move(wrappedValue)).build()); |
| 240 } | 240 } |
| 241 if (!propertiesProtocolArray->length()) | 241 if (!propertiesProtocolArray->length()) |
| 242 return; | 242 return; |
| 243 *internalProperties = propertiesProtocolArray.release(); | 243 *internalProperties = std::move(propertiesProtocolArray); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16&
objectId) | 246 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16&
objectId) |
| 247 { | 247 { |
| 248 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); | 248 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); |
| 249 if (!scope.initialize()) | 249 if (!scope.initialize()) |
| 250 return; | 250 return; |
| 251 scope.injectedScript()->releaseObject(objectId); | 251 scope.injectedScript()->releaseObject(objectId); |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 else | 291 else |
| 292 *errorString = "Script compilation failed"; | 292 *errorString = "Script compilation failed"; |
| 293 return; | 293 return; |
| 294 } | 294 } |
| 295 | 295 |
| 296 if (!persistScript) | 296 if (!persistScript) |
| 297 return; | 297 return; |
| 298 | 298 |
| 299 String16 scriptValueId = String16::number(script->GetUnboundScript()->GetId(
)); | 299 String16 scriptValueId = String16::number(script->GetUnboundScript()->GetId(
)); |
| 300 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>(
m_debugger->isolate(), script)); | 300 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>(
m_debugger->isolate(), script)); |
| 301 m_compiledScripts.set(scriptValueId, global.release()); | 301 m_compiledScripts.set(scriptValueId, std::move(global)); |
| 302 *scriptId = scriptValueId; | 302 *scriptId = scriptValueId; |
| 303 } | 303 } |
| 304 | 304 |
| 305 void V8RuntimeAgentImpl::runScript(ErrorString* errorString, | 305 void V8RuntimeAgentImpl::runScript(ErrorString* errorString, |
| 306 const String16& scriptId, | 306 const String16& scriptId, |
| 307 int executionContextId, | 307 int executionContextId, |
| 308 const Maybe<String16>& objectGroup, | 308 const Maybe<String16>& objectGroup, |
| 309 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 309 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
| 310 const Maybe<bool>& includeCommandLineAPI, | 310 const Maybe<bool>& includeCommandLineAPI, |
| 311 OwnPtr<RemoteObject>* result, | 311 OwnPtr<RemoteObject>* result, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 { | 413 { |
| 414 if (!m_enabled) | 414 if (!m_enabled) |
| 415 return; | 415 return; |
| 416 context->setReported(true); | 416 context->setReported(true); |
| 417 OwnPtr<protocol::Runtime::ExecutionContextDescription> description = protoco
l::Runtime::ExecutionContextDescription::create() | 417 OwnPtr<protocol::Runtime::ExecutionContextDescription> description = protoco
l::Runtime::ExecutionContextDescription::create() |
| 418 .setId(context->contextId()) | 418 .setId(context->contextId()) |
| 419 .setIsDefault(context->isDefault()) | 419 .setIsDefault(context->isDefault()) |
| 420 .setName(context->humanReadableName()) | 420 .setName(context->humanReadableName()) |
| 421 .setOrigin(context->origin()) | 421 .setOrigin(context->origin()) |
| 422 .setFrameId(context->frameId()).build(); | 422 .setFrameId(context->frameId()).build(); |
| 423 m_frontend->executionContextCreated(description.release()); | 423 m_frontend->executionContextCreated(std::move(description)); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(InspectedContext* conte
xt) | 426 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(InspectedContext* conte
xt) |
| 427 { | 427 { |
| 428 if (m_enabled && context->isReported()) { | 428 if (m_enabled && context->isReported()) { |
| 429 context->setReported(false); | 429 context->setReported(false); |
| 430 m_frontend->executionContextDestroyed(context->contextId()); | 430 m_frontend->executionContextDestroyed(context->contextId()); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 | 433 |
| 434 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) |
| 435 { | 435 { |
| 436 if (m_enabled) | 436 if (m_enabled) |
| 437 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); | 437 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace blink | 440 } // namespace blink |
| OLD | NEW |