Fix VS 2015 warning by adding an additional cast

The OwningThread member of CRITICAL_SECTION is declared as having type
HANDLE but it is actually the thread's Thread ID which is a DWORD. When
doing 64-bit builds of Chromium with VS 2015 this triggers a warning
because of the suspicious conversion from 32-bit integer to 64-bit
pointer.

This change adds a cast (and some comments) to make the conversion
explicit and avoid the warning.

R=henrikg@webrtc.org
BUG=440500

Review URL: https://codereview.webrtc.org/1386183002

Cr-Commit-Position: refs/heads/master@{#10190}
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc
index 851635d..1f50c23 100644
--- a/webrtc/base/criticalsection.cc
+++ b/webrtc/base/criticalsection.cc
@@ -88,7 +88,12 @@
 
 bool CriticalSection::CurrentThreadIsOwner() const {
 #if defined(WEBRTC_WIN)
-  return crit_.OwningThread == reinterpret_cast<HANDLE>(GetCurrentThreadId());
+  // OwningThread has type HANDLE but actually contains the Thread ID:
+  // http://stackoverflow.com/questions/12675301/why-is-the-owningthread-member-of-critical-section-of-type-handle-when-it-is-de
+  // Converting through size_t avoids the VS 2015 warning C4312: conversion from
+  // 'type1' to 'type2' of greater size
+  return crit_.OwningThread ==
+         reinterpret_cast<HANDLE>(static_cast<size_t>(GetCurrentThreadId()));
 #else
 #if CS_DEBUG_CHECKS
   return pthread_equal(thread_, pthread_self());