Chromium Code Reviews| Index: Source/core/inspector/PageRuntimeAgent.cpp |
| diff --git a/Source/core/inspector/PageRuntimeAgent.cpp b/Source/core/inspector/PageRuntimeAgent.cpp |
| index c6e81e5e446df4a218d40de6f29b1fc639d78474..008c0d7376ebfeb9d549f011510363d72987ba74 100644 |
| --- a/Source/core/inspector/PageRuntimeAgent.cpp |
| +++ b/Source/core/inspector/PageRuntimeAgent.cpp |
| @@ -31,6 +31,8 @@ |
| #include "config.h" |
| #include "core/inspector/PageRuntimeAgent.h" |
| +#include "bindings/dart/DartController.h" |
| +#include "bindings/dart/DartHandleProxy.h" |
| #include "bindings/v8/DOMWrapperWorld.h" |
| #include "bindings/v8/ScriptController.h" |
| #include "core/inspector/InjectedScript.h" |
| @@ -43,6 +45,8 @@ |
| #include "core/page/PageConsole.h" |
| #include "weborigin/SecurityOrigin.h" |
| +#include <dart_api.h> |
|
vsm
2013/09/30 22:08:03
We should really avoid including this outside of b
Jacob
2013/10/01 00:07:05
Worse... I didn't even use this import anymore. I
|
| + |
| using WebCore::TypeBuilder::Runtime::ExecutionContextDescription; |
| namespace WebCore { |
| @@ -168,6 +172,8 @@ void PageRuntimeAgent::reportExecutionContextCreation() |
| ScriptState* scriptState = mainWorldScriptState(frame); |
| notifyContextCreated(frameId, scriptState, 0, true); |
| + notifyDartContextCreated(frameId, scriptState); |
| + |
| frame->script()->collectIsolatedContexts(isolatedContexts); |
| if (isolatedContexts.isEmpty()) |
| continue; |
| @@ -177,11 +183,25 @@ void PageRuntimeAgent::reportExecutionContextCreation() |
| } |
| } |
| +void PageRuntimeAgent::notifyDartContextCreated(const String& frameId, ScriptState* v8ScriptState) |
| +{ |
| + ScriptExecutionContext* scriptExecutionContext = v8ScriptState->scriptExecutionContext(); |
| + DartController* dartController = DartController::retrieve(scriptExecutionContext); |
| + if (dartController) { |
| + Vector<ScriptState*> scriptStates; |
| + dartController->collectScriptStates(v8ScriptState, scriptStates); |
| + for (size_t i = 0; i< scriptStates.size(); i++) |
| + notifyContextCreated(frameId, scriptStates[i], 0, false); |
| + } |
| +} |
| + |
| void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) |
| { |
| - ASSERT(securityOrigin || isPageContext); |
| + // FIXME: should Dart scripts have a security origin? |
| + ASSERT(securityOrigin || isPageContext || !scriptState->isJavaScript()); |
| int executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState); |
| - String name = securityOrigin ? securityOrigin->toRawString() : ""; |
| + String name = scriptState->name() ? *scriptState->name() : (securityOrigin ? securityOrigin->toRawString() : ""); |
| + |
| m_frontend->executionContextCreated(ExecutionContextDescription::create() |
| .setId(executionContextId) |
| .setIsPageContext(isPageContext) |