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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp

Issue 2226863003: [DevTools] Reduce API surface of String16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
index aedaade5fd00215a23c71dd9c91a4bf04ec197e9..842c00126ff8b94f2e851a95e4f9995a2695eae6 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
@@ -10,12 +10,13 @@
namespace blink {
-static const LChar hexDigits[17] = "0123456789ABCDEF";
+static const char hexDigits[17] = "0123456789ABCDEF";
static void appendUnsignedAsHex(unsigned number, String16Builder* destination)
{
for (size_t i = 0; i < 8; ++i) {
- destination->append(hexDigits[number & 0xF]);
+ UChar c = hexDigits[number & 0xF];
+ destination->append(c);
number >>= 4;
}
}
@@ -36,18 +37,18 @@ static String16 calculateHash(const String16& str)
size_t current = 0;
const uint32_t* data = nullptr;
+ size_t sizeInBytes = sizeof(UChar) * str.length();
data = reinterpret_cast<const uint32_t*>(str.characters16());
- size_t charactersSizeInBytes = str.charactersSizeInBytes();
- for (size_t i = 0; i < charactersSizeInBytes / 4; i += 4) {
+ for (size_t i = 0; i < sizeInBytes / 4; i += 4) {
uint32_t v = data[i];
uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF;
hashes[current] = (hashes[current] + zi[current] * xi) % prime[current];
zi[current] = (zi[current] * random[current]) % prime[current];
current = current == hashesSize - 1 ? 0 : current + 1;
}
- if (charactersSizeInBytes % 4) {
+ if (sizeInBytes % 4) {
uint32_t v = 0;
- for (size_t i = charactersSizeInBytes - charactersSizeInBytes % 4; i < charactersSizeInBytes; ++i) {
+ for (size_t i = sizeInBytes - sizeInBytes % 4; i < sizeInBytes; ++i) {
v <<= 8;
v |= reinterpret_cast<const uint8_t*>(data)[i];
}

Powered by Google App Engine
This is Rietveld 408576698