| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "bindings/core/dart/DartInjectedScriptManager.h" | 36 #include "bindings/core/dart/DartInjectedScriptManager.h" |
| 37 #include "bindings/core/dart/DartUtilities.h" | 37 #include "bindings/core/dart/DartUtilities.h" |
| 38 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
| 39 #include "core/inspector/IdentifiersFactory.h" | 39 #include "core/inspector/IdentifiersFactory.h" |
| 40 #include "core/inspector/InjectedScriptManager.h" | 40 #include "core/inspector/InjectedScriptManager.h" |
| 41 #include "core/inspector/InspectorConsoleAgent.h" | 41 #include "core/inspector/InspectorConsoleAgent.h" |
| 42 #include "core/inspector/ScriptCallStack.h" | 42 #include "core/inspector/ScriptCallStack.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 // TODO(jacobr): this method is basically obsolete with dart:html implemented on
top of JS interop. |
| 46 void DartInspectorConsoleMessage::addToFrontend(InspectorFrontend::Console* fron
tend, InjectedScriptManager* injectedScriptManager, bool generatePreview, Consol
eMessage* consoleMessage, PassRefPtr<TypeBuilder::Console::ConsoleMessage> jsonO
bj) | 47 void DartInspectorConsoleMessage::addToFrontend(InspectorFrontend::Console* fron
tend, InjectedScriptManager* injectedScriptManager, bool generatePreview, Consol
eMessage* consoleMessage, PassRefPtr<TypeBuilder::Console::ConsoleMessage> jsonO
bj) |
| 47 { | 48 { |
| 49 ASSERT_NOT_REACHED(); |
| 50 /* |
| 48 DartScriptState* scriptState = DartUtilities::currentDartScriptState(); | 51 DartScriptState* scriptState = DartUtilities::currentDartScriptState(); |
| 49 ASSERT(scriptState != 0); | 52 ASSERT(scriptState != 0); |
| 50 | 53 |
| 51 DartInjectedScriptManager* dartInjectedScriptManager = injectedScriptManager
->dartInjectedScriptManager(); | 54 DartInjectedScriptManager* dartInjectedScriptManager = injectedScriptManager
->dartInjectedScriptManager(); |
| 52 jsonObj->setExecutionContextId(dartInjectedScriptManager->injectedScriptIdFo
r(scriptState)); | 55 jsonObj->setExecutionContextId(dartInjectedScriptManager->injectedScriptIdFo
r(scriptState)); |
| 53 if (consoleMessage->source() == NetworkMessageSource && consoleMessage->requ
estIdentifier()) | 56 if (consoleMessage->source() == NetworkMessageSource && consoleMessage->requ
estIdentifier()) |
| 54 jsonObj->setNetworkRequestId(IdentifiersFactory::requestId(consoleMessag
e->requestIdentifier())); | 57 jsonObj->setNetworkRequestId(IdentifiersFactory::requestId(consoleMessag
e->requestIdentifier())); |
| 55 if (consoleMessage->scriptArguments() && consoleMessage->scriptArguments()->
argumentCount()) { | 58 if (consoleMessage->scriptArguments() && consoleMessage->scriptArguments()->
argumentCount()) { |
| 56 DartInjectedScript* injectedScript = dartInjectedScriptManager->injected
ScriptFor(scriptState); | 59 DartInjectedScript* injectedScript = dartInjectedScriptManager->injected
ScriptFor(scriptState); |
| 57 ASSERT(injectedScript != 0); | 60 ASSERT(injectedScript != 0); |
| 58 | 61 |
| 59 if (injectedScript) { | 62 if (injectedScript) { |
| 60 RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject> > json
Args = TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject>::create(); | 63 RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject> > json
Args = TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject>::create(); |
| 61 if (consoleMessage->type() == TableMessageType && generatePreview &&
consoleMessage->scriptArguments()->argumentCount()) { | 64 if (consoleMessage->type() == TableMessageType && generatePreview &&
consoleMessage->scriptArguments()->argumentCount()) { |
| 62 ScriptValue table = consoleMessage->scriptArguments()->argumentA
t(0); | 65 ScriptValue table = consoleMessage->scriptArguments()->argumentA
t(0); |
| 63 ScriptValue columns = consoleMessage->scriptArguments()->argumen
tCount() > 1 ? consoleMessage->scriptArguments()->argumentAt(1) : ScriptValue(); | 66 ScriptValue columns = consoleMessage->scriptArguments()->argumen
tCount() > 1 ? consoleMessage->scriptArguments()->argumentAt(1) : ScriptValue(); |
| 64 RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue = inje
ctedScript->wrapTable(table, columns); | 67 ASSERT_NOT_REACHED(); |
| 65 if (!inspectorValue) { | |
| 66 ASSERT_NOT_REACHED(); | |
| 67 return; | |
| 68 } | |
| 69 jsonArgs->addItem(inspectorValue); | 68 jsonArgs->addItem(inspectorValue); |
| 70 } else { | 69 } else { |
| 71 for (unsigned i = 0; i < consoleMessage->scriptArguments()->argu
mentCount(); ++i) { | 70 for (unsigned i = 0; i < consoleMessage->scriptArguments()->argu
mentCount(); ++i) { |
| 72 ScriptValue value = consoleMessage->scriptArguments()->argum
entAt(i); | 71 ScriptValue value = consoleMessage->scriptArguments()->argum
entAt(i); |
| 73 | 72 |
| 74 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 73 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 75 | 74 |
| 76 RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue; | 75 RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue; |
| 77 v8::Handle<v8::Value> v8Value = value.v8ValueUnsafe(); | 76 v8::Handle<v8::Value> v8Value = value.v8ValueUnsafe(); |
| 78 | 77 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 } | 90 } |
| 92 jsonObj->setParameters(jsonArgs); | 91 jsonObj->setParameters(jsonArgs); |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 if (consoleMessage->callStack()) { | 94 if (consoleMessage->callStack()) { |
| 96 // FIXMEDART: is the call stack right? | 95 // FIXMEDART: is the call stack right? |
| 97 jsonObj->setStackTrace(consoleMessage->callStack()->buildInspectorArray(
)); | 96 jsonObj->setStackTrace(consoleMessage->callStack()->buildInspectorArray(
)); |
| 98 } | 97 } |
| 99 frontend->messageAdded(jsonObj); | 98 frontend->messageAdded(jsonObj); |
| 100 frontend->flush(); | 99 frontend->flush(); |
| 100 */ |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |