| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/SourceLocation.h" | 5 #include "bindings/core/v8/SourceLocation.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8PerIsolateData.h" | 10 #include "bindings/core/v8/V8PerIsolateData.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 int script_id = message->GetScriptOrigin().ScriptID()->Value(); | 89 int script_id = message->GetScriptOrigin().ScriptID()->Value(); |
| 90 if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { | 90 if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { |
| 91 int top_script_id = stack->GetFrame(0)->GetScriptId(); | 91 int top_script_id = stack->GetFrame(0)->GetScriptId(); |
| 92 if (top_script_id == script_id) | 92 if (top_script_id == script_id) |
| 93 script_id = 0; | 93 script_id = 0; |
| 94 } | 94 } |
| 95 | 95 |
| 96 int line_number = 0; | 96 int line_number = 0; |
| 97 int column_number = 0; | 97 int column_number = 0; |
| 98 if (V8Call(message->GetLineNumber(isolate->GetCurrentContext()), | 98 if (message->GetLineNumber(isolate->GetCurrentContext()).To(&line_number) && |
| 99 line_number) && | 99 message->GetStartColumn(isolate->GetCurrentContext()).To(&column_number)) |
| 100 V8Call(message->GetStartColumn(isolate->GetCurrentContext()), | |
| 101 column_number)) | |
| 102 ++column_number; | 100 ++column_number; |
| 103 | 101 |
| 104 if ((!script_id || !line_number) && stack_trace && !stack_trace->isEmpty()) | 102 if ((!script_id || !line_number) && stack_trace && !stack_trace->isEmpty()) |
| 105 return SourceLocation::CreateFromNonEmptyV8StackTrace( | 103 return SourceLocation::CreateFromNonEmptyV8StackTrace( |
| 106 std::move(stack_trace), 0); | 104 std::move(stack_trace), 0); |
| 107 | 105 |
| 108 String url = ToCoreStringWithUndefinedOrNullCheck( | 106 String url = ToCoreStringWithUndefinedOrNullCheck( |
| 109 message->GetScriptOrigin().ResourceName()); | 107 message->GetScriptOrigin().ResourceName()); |
| 110 if (url.IsNull()) | 108 if (url.IsNull()) |
| 111 url = execution_context->Url(); | 109 url = execution_context->Url(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return stack_trace_ ? stack_trace_->buildInspectorObject() : nullptr; | 196 return stack_trace_ ? stack_trace_->buildInspectorObject() : nullptr; |
| 199 } | 197 } |
| 200 | 198 |
| 201 String SourceLocation::ToString() const { | 199 String SourceLocation::ToString() const { |
| 202 if (!stack_trace_) | 200 if (!stack_trace_) |
| 203 return String(); | 201 return String(); |
| 204 return ToCoreString(stack_trace_->toString()); | 202 return ToCoreString(stack_trace_->toString()); |
| 205 } | 203 } |
| 206 | 204 |
| 207 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |