OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project 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 "src/inspector/V8DebuggerScript.h" | 5 #include "src/inspector/V8DebuggerScript.h" |
6 | 6 |
7 #include "src/inspector/ProtocolPlatform.h" | 7 #include "src/inspector/ProtocolPlatform.h" |
8 #include "src/inspector/StringUtil.h" | 8 #include "src/inspector/StringUtil.h" |
9 | 9 |
10 namespace v8_inspector { | 10 namespace v8_inspector { |
11 | 11 |
12 static const char hexDigits[17] = "0123456789ABCDEF"; | 12 static const char hexDigits[17] = "0123456789ABCDEF"; |
13 | 13 |
14 static void appendUnsignedAsHex(unsigned number, String16Builder* destination) { | 14 static void appendUnsignedAsHex(uint64_t number, String16Builder* destination) { |
15 for (size_t i = 0; i < 8; ++i) { | 15 for (size_t i = 0; i < 8; ++i) { |
16 UChar c = hexDigits[number & 0xF]; | 16 UChar c = hexDigits[number & 0xF]; |
17 destination->append(c); | 17 destination->append(c); |
18 number >>= 4; | 18 number >>= 4; |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
22 // Hash algorithm for substrings is described in "Über die Komplexität der | 22 // Hash algorithm for substrings is described in "Über die Komplexität der |
23 // Multiplikation in | 23 // Multiplikation in |
24 // eingeschränkten Branchingprogrammmodellen" by Woelfe. | 24 // eingeschränkten Branchingprogrammmodellen" by Woelfe. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 object->Get(toV8StringInternalized(isolate, "id")); | 74 object->Get(toV8StringInternalized(isolate, "id")); |
75 DCHECK(!idValue.IsEmpty() && idValue->IsInt32()); | 75 DCHECK(!idValue.IsEmpty() && idValue->IsInt32()); |
76 m_id = String16::fromInteger(idValue->Int32Value()); | 76 m_id = String16::fromInteger(idValue->Int32Value()); |
77 | 77 |
78 m_url = toProtocolStringWithTypeCheck( | 78 m_url = toProtocolStringWithTypeCheck( |
79 object->Get(toV8StringInternalized(isolate, "name"))); | 79 object->Get(toV8StringInternalized(isolate, "name"))); |
80 m_sourceURL = toProtocolStringWithTypeCheck( | 80 m_sourceURL = toProtocolStringWithTypeCheck( |
81 object->Get(toV8StringInternalized(isolate, "sourceURL"))); | 81 object->Get(toV8StringInternalized(isolate, "sourceURL"))); |
82 m_sourceMappingURL = toProtocolStringWithTypeCheck( | 82 m_sourceMappingURL = toProtocolStringWithTypeCheck( |
83 object->Get(toV8StringInternalized(isolate, "sourceMappingURL"))); | 83 object->Get(toV8StringInternalized(isolate, "sourceMappingURL"))); |
84 m_startLine = object->Get(toV8StringInternalized(isolate, "startLine")) | 84 m_startLine = |
85 ->ToInteger(isolate) | 85 static_cast<int>(object->Get(toV8StringInternalized(isolate, "startLine")) |
86 ->Value(); | 86 ->ToInteger(isolate) |
87 m_startColumn = object->Get(toV8StringInternalized(isolate, "startColumn")) | 87 ->Value()); |
88 ->ToInteger(isolate) | 88 m_startColumn = static_cast<int>( |
89 ->Value(); | 89 object->Get(toV8StringInternalized(isolate, "startColumn")) |
90 m_endLine = object->Get(toV8StringInternalized(isolate, "endLine")) | 90 ->ToInteger(isolate) |
91 ->ToInteger(isolate) | 91 ->Value()); |
92 ->Value(); | 92 m_endLine = |
93 m_endColumn = object->Get(toV8StringInternalized(isolate, "endColumn")) | 93 static_cast<int>(object->Get(toV8StringInternalized(isolate, "endLine")) |
94 ->ToInteger(isolate) | 94 ->ToInteger(isolate) |
95 ->Value(); | 95 ->Value()); |
| 96 m_endColumn = |
| 97 static_cast<int>(object->Get(toV8StringInternalized(isolate, "endColumn")) |
| 98 ->ToInteger(isolate) |
| 99 ->Value()); |
96 m_executionContextAuxData = toProtocolStringWithTypeCheck( | 100 m_executionContextAuxData = toProtocolStringWithTypeCheck( |
97 object->Get(toV8StringInternalized(isolate, "executionContextAuxData"))); | 101 object->Get(toV8StringInternalized(isolate, "executionContextAuxData"))); |
98 m_executionContextId = | 102 m_executionContextId = static_cast<int>( |
99 object->Get(toV8StringInternalized(isolate, "executionContextId")) | 103 object->Get(toV8StringInternalized(isolate, "executionContextId")) |
100 ->ToInteger(isolate) | 104 ->ToInteger(isolate) |
101 ->Value(); | 105 ->Value()); |
102 m_isLiveEdit = isLiveEdit; | 106 m_isLiveEdit = isLiveEdit; |
103 | 107 |
104 v8::Local<v8::Value> sourceValue = | 108 v8::Local<v8::Value> sourceValue = |
105 object->Get(toV8StringInternalized(isolate, "source")); | 109 object->Get(toV8StringInternalized(isolate, "source")); |
106 if (!sourceValue.IsEmpty() && sourceValue->IsString()) | 110 if (!sourceValue.IsEmpty() && sourceValue->IsString()) |
107 setSource(isolate, sourceValue.As<v8::String>()); | 111 setSource(isolate, sourceValue.As<v8::String>()); |
108 } | 112 } |
109 | 113 |
110 V8DebuggerScript::~V8DebuggerScript() {} | 114 V8DebuggerScript::~V8DebuggerScript() {} |
111 | 115 |
(...skipping 13 matching lines...) Expand all Loading... |
125 m_sourceMappingURL = sourceMappingURL; | 129 m_sourceMappingURL = sourceMappingURL; |
126 } | 130 } |
127 | 131 |
128 void V8DebuggerScript::setSource(v8::Isolate* isolate, | 132 void V8DebuggerScript::setSource(v8::Isolate* isolate, |
129 v8::Local<v8::String> source) { | 133 v8::Local<v8::String> source) { |
130 m_source.Reset(isolate, source); | 134 m_source.Reset(isolate, source); |
131 m_hash = calculateHash(toProtocolString(source)); | 135 m_hash = calculateHash(toProtocolString(source)); |
132 } | 136 } |
133 | 137 |
134 } // namespace v8_inspector | 138 } // namespace v8_inspector |
OLD | NEW |