| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2010 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "bindings/v8/ScriptCallStackFactory.h" | 32 #include "bindings/v8/ScriptCallStackFactory.h" |
| 33 | 33 |
| 34 #include "bindings/dart/DartUtilities.h" |
| 34 #include "bindings/v8/ScriptScope.h" | 35 #include "bindings/v8/ScriptScope.h" |
| 35 #include "bindings/v8/ScriptValue.h" | 36 #include "bindings/v8/ScriptValue.h" |
| 36 #include "bindings/v8/V8Binding.h" | 37 #include "bindings/v8/V8Binding.h" |
| 37 #include "bindings/v8/V8Utilities.h" | 38 #include "bindings/v8/V8Utilities.h" |
| 38 #include "core/inspector/InspectorInstrumentation.h" | 39 #include "core/inspector/InspectorInstrumentation.h" |
| 39 #include "core/inspector/ScriptArguments.h" | 40 #include "core/inspector/ScriptArguments.h" |
| 40 #include "core/inspector/ScriptCallFrame.h" | 41 #include "core/inspector/ScriptCallFrame.h" |
| 41 #include "core/inspector/ScriptCallStack.h" | 42 #include "core/inspector/ScriptCallStack.h" |
| 42 #include "core/platform/JSONValues.h" | 43 #include "core/platform/JSONValues.h" |
| 43 | 44 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 { | 110 { |
| 110 size_t stackSize = 1; | 111 size_t stackSize = 1; |
| 111 if (InspectorInstrumentation::hasFrontends()) { | 112 if (InspectorInstrumentation::hasFrontends()) { |
| 112 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionConte
xt(); | 113 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionConte
xt(); |
| 113 if (InspectorInstrumentation::consoleAgentEnabled(scriptExecutionContext
)) | 114 if (InspectorInstrumentation::consoleAgentEnabled(scriptExecutionContext
)) |
| 114 stackSize = maxStackSize; | 115 stackSize = maxStackSize; |
| 115 } | 116 } |
| 116 return createScriptCallStack(stackSize); | 117 return createScriptCallStack(stackSize); |
| 117 } | 118 } |
| 118 | 119 |
| 119 PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState*) | 120 PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState* scriptS
tate) |
| 120 { | 121 { |
| 121 return createScriptCallStackForConsole(); | 122 // FIXMEDART: move to a shared bindings directory. |
| 123 if (!scriptState || scriptState->isJavaScript()) |
| 124 return createScriptCallStackForConsole(); |
| 125 |
| 126 return DartUtilities::createScriptCallStack(); |
| 122 } | 127 } |
| 123 | 128 |
| 124 PassRefPtr<ScriptCallStack> createScriptCallStack(ScriptState*, size_t maxStackS
ize) | 129 PassRefPtr<ScriptCallStack> createScriptCallStack(ScriptState* scriptState, size
_t maxStackSize) |
| 125 { | 130 { |
| 126 return createScriptCallStackForConsole(maxStackSize); | 131 // FIXMEDART: move to a shared bindings directory. |
| 132 if (!scriptState || scriptState->isJavaScript()) |
| 133 return createScriptCallStackForConsole(maxStackSize); |
| 134 |
| 135 return DartUtilities::createScriptCallStack(); |
| 127 } | 136 } |
| 128 | 137 |
| 129 PassRefPtr<ScriptArguments> createScriptArguments(const v8::FunctionCallbackInfo
<v8::Value>& v8arguments, unsigned skipArgumentCount) | 138 PassRefPtr<ScriptArguments> createScriptArguments(const v8::FunctionCallbackInfo
<v8::Value>& v8arguments, unsigned skipArgumentCount) |
| 130 { | 139 { |
| 131 v8::HandleScope scope; | 140 v8::HandleScope scope; |
| 132 v8::Local<v8::Context> context = v8::Context::GetCurrent(); | 141 v8::Local<v8::Context> context = v8::Context::GetCurrent(); |
| 133 ScriptState* state = ScriptState::forContext(context); | 142 ScriptState* state = ScriptState::forContext(context); |
| 134 | 143 |
| 135 Vector<ScriptValue> arguments; | 144 Vector<ScriptValue> arguments; |
| 136 for (int i = skipArgumentCount; i < v8arguments.Length(); ++i) | 145 for (int i = skipArgumentCount; i < v8arguments.Length(); ++i) |
| 137 arguments.append(ScriptValue(v8arguments[i])); | 146 arguments.append(ScriptValue(v8arguments[i])); |
| 138 | 147 |
| 139 return ScriptArguments::create(state, arguments); | 148 return ScriptArguments::create(state, arguments); |
| 140 } | 149 } |
| 141 | 150 |
| 142 } // namespace WebCore | 151 } // namespace WebCore |
| OLD | NEW |