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/v8-debugger-script.h" | 5 #include "src/inspector/v8-debugger-script.h" |
6 | 6 |
7 #include "src/inspector/protocol-platform.h" | 7 #include "src/inspector/protocol-platform.h" |
8 #include "src/inspector/string-util.h" | 8 #include "src/inspector/string-util.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 static v8::Local<v8::Value> GetChecked(v8::Local<v8::Context> context, | 70 static v8::Local<v8::Value> GetChecked(v8::Local<v8::Context> context, |
71 v8::Local<v8::Object> object, | 71 v8::Local<v8::Object> object, |
72 const char* name) { | 72 const char* name) { |
73 return object | 73 return object |
74 ->Get(context, toV8StringInternalized(context->GetIsolate(), name)) | 74 ->Get(context, toV8StringInternalized(context->GetIsolate(), name)) |
75 .ToLocalChecked(); | 75 .ToLocalChecked(); |
76 } | 76 } |
77 | 77 |
78 static int64_t GetCheckedInt(v8::Local<v8::Context> context, | 78 static int GetCheckedInt(v8::Local<v8::Context> context, |
79 v8::Local<v8::Object> object, const char* name) { | 79 v8::Local<v8::Object> object, const char* name) { |
80 return GetChecked(context, object, name) | 80 return static_cast<int>(GetChecked(context, object, name) |
81 ->ToInteger(context) | 81 ->ToInteger(context) |
82 .ToLocalChecked() | 82 .ToLocalChecked() |
83 ->Value(); | 83 ->Value()); |
84 } | 84 } |
85 | 85 |
86 V8DebuggerScript::V8DebuggerScript(v8::Local<v8::Context> context, | 86 V8DebuggerScript::V8DebuggerScript(v8::Local<v8::Context> context, |
87 v8::Local<v8::Object> object, | 87 v8::Local<v8::Object> object, |
88 bool isLiveEdit) { | 88 bool isLiveEdit) { |
89 v8::Isolate* isolate = context->GetIsolate(); | 89 v8::Isolate* isolate = context->GetIsolate(); |
90 v8::Local<v8::Value> idValue = GetChecked(context, object, "id"); | 90 v8::Local<v8::Value> idValue = GetChecked(context, object, "id"); |
91 DCHECK(!idValue.IsEmpty() && idValue->IsInt32()); | 91 DCHECK(!idValue.IsEmpty() && idValue->IsInt32()); |
92 m_id = String16::fromInteger(idValue->Int32Value(context).FromJust()); | 92 m_id = String16::fromInteger(idValue->Int32Value(context).FromJust()); |
93 | 93 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 m_sourceMappingURL = sourceMappingURL; | 131 m_sourceMappingURL = sourceMappingURL; |
132 } | 132 } |
133 | 133 |
134 void V8DebuggerScript::setSource(v8::Isolate* isolate, | 134 void V8DebuggerScript::setSource(v8::Isolate* isolate, |
135 v8::Local<v8::String> source) { | 135 v8::Local<v8::String> source) { |
136 m_source.Reset(isolate, source); | 136 m_source.Reset(isolate, source); |
137 m_hash = calculateHash(toProtocolString(source)); | 137 m_hash = calculateHash(toProtocolString(source)); |
138 } | 138 } |
139 | 139 |
140 } // namespace v8_inspector | 140 } // namespace v8_inspector |
OLD | NEW |