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(uint64_t number, String16Builder* destination) { | 14 static void appendUnsignedAsHex(unsigned 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 = | 84 m_startLine = object->Get(toV8StringInternalized(isolate, "startLine")) |
85 static_cast<int>(object->Get(toV8StringInternalized(isolate, "startLine")) | 85 ->ToInteger(isolate) |
86 ->ToInteger(isolate) | 86 ->Value(); |
87 ->Value()); | 87 m_startColumn = object->Get(toV8StringInternalized(isolate, "startColumn")) |
88 m_startColumn = static_cast<int>( | 88 ->ToInteger(isolate) |
89 object->Get(toV8StringInternalized(isolate, "startColumn")) | 89 ->Value(); |
90 ->ToInteger(isolate) | 90 m_endLine = object->Get(toV8StringInternalized(isolate, "endLine")) |
91 ->Value()); | 91 ->ToInteger(isolate) |
92 m_endLine = | 92 ->Value(); |
93 static_cast<int>(object->Get(toV8StringInternalized(isolate, "endLine")) | 93 m_endColumn = object->Get(toV8StringInternalized(isolate, "endColumn")) |
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()); | |
100 m_executionContextAuxData = toProtocolStringWithTypeCheck( | 96 m_executionContextAuxData = toProtocolStringWithTypeCheck( |
101 object->Get(toV8StringInternalized(isolate, "executionContextAuxData"))); | 97 object->Get(toV8StringInternalized(isolate, "executionContextAuxData"))); |
102 m_executionContextId = static_cast<int>( | 98 m_executionContextId = |
103 object->Get(toV8StringInternalized(isolate, "executionContextId")) | 99 object->Get(toV8StringInternalized(isolate, "executionContextId")) |
104 ->ToInteger(isolate) | 100 ->ToInteger(isolate) |
105 ->Value()); | 101 ->Value(); |
106 m_isLiveEdit = isLiveEdit; | 102 m_isLiveEdit = isLiveEdit; |
107 | 103 |
108 v8::Local<v8::Value> sourceValue = | 104 v8::Local<v8::Value> sourceValue = |
109 object->Get(toV8StringInternalized(isolate, "source")); | 105 object->Get(toV8StringInternalized(isolate, "source")); |
110 if (!sourceValue.IsEmpty() && sourceValue->IsString()) | 106 if (!sourceValue.IsEmpty() && sourceValue->IsString()) |
111 setSource(isolate, sourceValue.As<v8::String>()); | 107 setSource(isolate, sourceValue.As<v8::String>()); |
112 } | 108 } |
113 | 109 |
114 V8DebuggerScript::~V8DebuggerScript() {} | 110 V8DebuggerScript::~V8DebuggerScript() {} |
115 | 111 |
(...skipping 13 matching lines...) Expand all Loading... |
129 m_sourceMappingURL = sourceMappingURL; | 125 m_sourceMappingURL = sourceMappingURL; |
130 } | 126 } |
131 | 127 |
132 void V8DebuggerScript::setSource(v8::Isolate* isolate, | 128 void V8DebuggerScript::setSource(v8::Isolate* isolate, |
133 v8::Local<v8::String> source) { | 129 v8::Local<v8::String> source) { |
134 m_source.Reset(isolate, source); | 130 m_source.Reset(isolate, source); |
135 m_hash = calculateHash(toProtocolString(source)); | 131 m_hash = calculateHash(toProtocolString(source)); |
136 } | 132 } |
137 | 133 |
138 } // namespace v8_inspector | 134 } // namespace v8_inspector |
OLD | NEW |