| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/v8_inspector/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
| 10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT
ION00832000000000000000 | 100 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT
ION00832000000000000000 |
| 101 static String16 calculateHash(const String16& str) | 101 static String16 calculateHash(const String16& str) |
| 102 { | 102 { |
| 103 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35,
0x81ABE279 }; | 103 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35,
0x81ABE279 }; |
| 104 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; | 104 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; |
| 105 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; | 105 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; |
| 106 | 106 |
| 107 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; | 107 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; |
| 108 uint64_t zi[] = { 1, 1, 1, 1, 1 }; | 108 uint64_t zi[] = { 1, 1, 1, 1, 1 }; |
| 109 | 109 |
| 110 const size_t hashesSize = WTF_ARRAY_LENGTH(hashes); | 110 const size_t hashesSize = PROTOCOL_ARRAY_LENGTH(hashes); |
| 111 | 111 |
| 112 size_t current = 0; | 112 size_t current = 0; |
| 113 const uint32_t* data = nullptr; | 113 const uint32_t* data = nullptr; |
| 114 data = reinterpret_cast<const uint32_t*>(str.characters16()); | 114 data = reinterpret_cast<const uint32_t*>(str.characters16()); |
| 115 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { | 115 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { |
| 116 uint32_t v = data[i]; | 116 uint32_t v = data[i]; |
| 117 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; | 117 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; |
| 118 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; | 118 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; |
| 119 zi[current] = (zi[current] * random[current]) % prime[current]; | 119 zi[current] = (zi[current] * random[current]) % prime[current]; |
| 120 current = current == hashesSize - 1 ? 0 : current + 1; | 120 current = current == hashesSize - 1 ? 0 : current + 1; |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 if (!enabled()) | 1437 if (!enabled()) |
| 1438 return; | 1438 return; |
| 1439 m_scheduledDebuggerStep = NoStep; | 1439 m_scheduledDebuggerStep = NoStep; |
| 1440 m_scripts.clear(); | 1440 m_scripts.clear(); |
| 1441 m_blackboxedPositions.clear(); | 1441 m_blackboxedPositions.clear(); |
| 1442 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1442 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1443 allAsyncTasksCanceled(); | 1443 allAsyncTasksCanceled(); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 } // namespace blink | 1446 } // namespace blink |
| OLD | NEW |