Change unsigned long to uint32_t/wtf_size_t/uint64_t in third_party/blink/*

- unsigned long -> uint32_t/wtf_size_t/uint64_t
- Reference: https://google.github.io/styleguide/cppguide.html#Integer_Types

Bug: 930252
Change-Id: Id05e83f486d1d11cac16ff17fbcd72b33ca986d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1530502
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642398}
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
index 519b6ee7..f4cfc08 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
+++ b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
@@ -55,8 +55,8 @@
   if (!cached_metadata)
     return false;
   double time_stamp;
-  const int size = sizeof(time_stamp);
-  DCHECK_EQ(cached_metadata->size(), static_cast<unsigned long>(size));
+  const uint32_t size = sizeof(time_stamp);
+  DCHECK_EQ(cached_metadata->size(), size);
   memcpy(&time_stamp, cached_metadata->Data(), size);
   return (WTF::CurrentTime() - time_stamp) < hot_seconds;
 }
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
index 66e44e3..3bf51fea 100644
--- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
+++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -1647,7 +1647,7 @@
   // the chunk has been processed.
   long bytes_processed = xmlByteConsumed(Context());
   if (bytes_processed == -1 ||
-      static_cast<unsigned long>(bytes_processed) != chunk_as_utf8.length()) {
+      static_cast<wtf_size_t>(bytes_processed) != chunk_as_utf8.length()) {
     // FIXME: I don't believe we can hit this case without also having seen
     // an error or a null byte. If we hit this DCHECK, we've found a test
     // case which demonstrates the need for this code.
diff --git a/third_party/blink/renderer/core/xml/xpath_expression_node.h b/third_party/blink/renderer/core/xml/xpath_expression_node.h
index 1c2162d..3f3f6ea 100644
--- a/third_party/blink/renderer/core/xml/xpath_expression_node.h
+++ b/third_party/blink/renderer/core/xml/xpath_expression_node.h
@@ -46,8 +46,8 @@
   explicit EvaluationContext(Node&);
 
   Member<Node> node;
-  unsigned long size;
-  unsigned long position;
+  wtf_size_t size;
+  wtf_size_t position;
   HashMap<String, String> variable_bindings;
 
   bool had_type_conversion_error;
diff --git a/third_party/blink/renderer/core/xml/xpath_value.h b/third_party/blink/renderer/core/xml/xpath_value.h
index b1361ae2..ff23f413 100644
--- a/third_party/blink/renderer/core/xml/xpath_value.h
+++ b/third_party/blink/renderer/core/xml/xpath_value.h
@@ -75,8 +75,7 @@
   enum Type { kNodeSetValue, kBooleanValue, kNumberValue, kStringValue };
 
   Value(unsigned value) : type_(kNumberValue), bool_(false), number_(value) {}
-  Value(unsigned long value)
-      : type_(kNumberValue), bool_(false), number_(value) {}
+  Value(uint64_t value) : type_(kNumberValue), bool_(false), number_(value) {}
   Value(double value) : type_(kNumberValue), bool_(false), number_(value) {}
 
   Value(const char* value)
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
index f07db7c..bc1fb4e6 100644
--- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -2432,7 +2432,7 @@
   // If the deleted was bound to the the current maximum index, trace backwards
   // to find the new max texture index.
   if (one_plus_max_non_default_texture_unit_ ==
-      static_cast<unsigned long>(max_bound_texture_index + 1)) {
+      static_cast<wtf_size_t>(max_bound_texture_index + 1)) {
     FindNewMaxNonDefaultTextureUnit();
   }
 }
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc
index 3f8d7e09..89cfad3 100644
--- a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc
+++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc
@@ -256,7 +256,7 @@
 bool PNGImageDecoder::SetSize(unsigned width, unsigned height) {
   DCHECK(!IsDecodedSizeAvailable());
   // Protect against large PNGs. See http://bugzil.la/251381 for more details.
-  const unsigned long kMaxPNGSize = 1000000UL;
+  const uint32_t kMaxPNGSize = 1000000;
   return (width <= kMaxPNGSize) && (height <= kMaxPNGSize) &&
          ImageDecoder::SetSize(width, height);
 }
diff --git a/third_party/blink/renderer/platform/wtf/math_extras_test.cc b/third_party/blink/renderer/platform/wtf/math_extras_test.cc
index 64f2b9c..bb0be6a3 100644
--- a/third_party/blink/renderer/platform/wtf/math_extras_test.cc
+++ b/third_party/blink/renderer/platform/wtf/math_extras_test.cc
@@ -179,12 +179,12 @@
             clampTo<uint64_t>(-overflow_ull));
 }
 
-TEST(MathExtrasTest, clampToUnsignedUnsignedLong) {
-  if (sizeof(unsigned long) == sizeof(unsigned))
+TEST(MathExtrasTest, clampToUnsignedUint32) {
+  if (sizeof(uint32_t) == sizeof(unsigned))
     return;
 
-  unsigned long max_unsigned = std::numeric_limits<unsigned>::max();
-  unsigned long overflow_unsigned = max_unsigned + 1;
+  uint32_t max_unsigned = std::numeric_limits<unsigned>::max();
+  uint32_t overflow_unsigned = max_unsigned + 1;
 
   EXPECT_GT(overflow_unsigned, max_unsigned);
 
@@ -194,7 +194,7 @@
   EXPECT_EQ(0u, clampTo<unsigned>(-1));
 }
 
-TEST(MathExtrasTest, clampToUnsignedUnsignedLongLong) {
+TEST(MathExtrasTest, clampToUnsignedUint64) {
   uint64_t max_unsigned = std::numeric_limits<unsigned>::max();
   uint64_t overflow_unsigned = max_unsigned + 1;