Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp

Issue 1779033003: DevTools: always use 16bit strings for inspector protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/IgnoreExceptionsScope.h" 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h"
10 #include "platform/v8_inspector/InjectedScript.h" 10 #include "platform/v8_inspector/InjectedScript.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 }; 106 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 };
107 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1 1D, 0x8F462907 }; 107 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1 1D, 0x8F462907 };
108 108
109 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; 109 uint64_t hashes[] = { 0, 0, 0, 0, 0 };
110 uint64_t zi[] = { 1, 1, 1, 1, 1 }; 110 uint64_t zi[] = { 1, 1, 1, 1, 1 };
111 111
112 const size_t hashesSize = WTF_ARRAY_LENGTH(hashes); 112 const size_t hashesSize = WTF_ARRAY_LENGTH(hashes);
113 113
114 size_t current = 0; 114 size_t current = 0;
115 const uint32_t* data = nullptr; 115 const uint32_t* data = nullptr;
116 if (str.is8Bit()) 116 data = reinterpret_cast<const uint32_t*>(str.characters16());
117 data = reinterpret_cast<const uint32_t*>(str.characters8());
118 else
119 data = reinterpret_cast<const uint32_t*>(str.characters16());
120 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { 117 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) {
121 uint32_t v = data[i]; 118 uint32_t v = data[i];
122 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; 119 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF;
123 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; 120 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current];
124 zi[current] = (zi[current] * random[current]) % prime[current]; 121 zi[current] = (zi[current] * random[current]) % prime[current];
125 current = current == hashesSize - 1 ? 0 : current + 1; 122 current = current == hashesSize - 1 ? 0 : current + 1;
126 } 123 }
127 if (str.sizeInBytes() % 4) { 124 if (str.sizeInBytes() % 4) {
128 uint32_t v = 0; 125 uint32_t v = 0;
129 for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeI nBytes(); ++i) { 126 for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeI nBytes(); ++i) {
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 m_scripts.clear(); 1526 m_scripts.clear();
1530 m_blackboxedPositions.clear(); 1527 m_blackboxedPositions.clear();
1531 m_breakpointIdToDebuggerBreakpointIds.clear(); 1528 m_breakpointIdToDebuggerBreakpointIds.clear();
1532 resetAsyncCallTracker(); 1529 resetAsyncCallTracker();
1533 m_promiseTracker->clear(); 1530 m_promiseTracker->clear();
1534 if (m_frontend) 1531 if (m_frontend)
1535 m_frontend->globalObjectCleared(); 1532 m_frontend->globalObjectCleared();
1536 } 1533 }
1537 1534
1538 } // namespace blink 1535 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698