Internal change
PiperOrigin-RevId: 249345559
Change-Id: I06e208d98ce924b3395d3cc353bd9a411f5fe834
diff --git a/src/base/strings/utf_string_conversion_utils.cc b/src/base/strings/utf_string_conversion_utils.cc
index a22b109..c42c7a2 100644
--- a/src/base/strings/utf_string_conversion_utils.cc
+++ b/src/base/strings/utf_string_conversion_utils.cc
@@ -123,7 +123,9 @@
// Instantiate versions we know callers will need.
template void PrepareForUTF8Output(const wchar_t*, size_t, std::string*);
+#ifndef WCHAR_T_IS_UTF16
template void PrepareForUTF8Output(const char16*, size_t, std::string*);
+#endif
template<typename STRING>
void PrepareForUTF16Or32Output(const char* src,
@@ -144,7 +146,9 @@
// Instantiate versions we know callers will need.
template void PrepareForUTF16Or32Output(const char*, size_t, std::wstring*);
+#ifndef WCHAR_T_IS_UTF16
template void PrepareForUTF16Or32Output(const char*, size_t, string16*);
+#endif
} // namespace base
} // namespace url
diff --git a/src/build/build_config.h b/src/build/build_config.h
index a039dda..8acd0b7 100644
--- a/src/build/build_config.h
+++ b/src/build/build_config.h
@@ -63,6 +63,8 @@
#define OS_QNX 1
#elif defined(_AIX)
#define OS_AIX 1
+#elif defined(__EMSCRIPTEN__)
+#define OS_EMSCRIPTEN 1
#else
#error Please add support for your platform in build/build_config.h
#endif
@@ -99,6 +101,8 @@
#define COMPILER_GCC 1
#elif defined(_MSC_VER)
#define COMPILER_MSVC 1
+#elif defined(__EMSCRIPTEN__)
+#define COMPILER_EMSCRIPTEN 1
#else
#error Please add support for your compiler in build/build_config.h
#endif
@@ -186,6 +190,22 @@
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_BIG_ENDIAN 1
#endif
+#elif defined(__EMSCRIPTEN__)
+// Emscripten can target asm.js or WebAssembly.
+#define ARCH_CPU_EMSCRIPTEN_FAMILY 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#if defined(__wasm64__)
+#define ARCH_CPU_64_BITS 1
+#else
+#define ARCH_CPU_32_BITS 1
+#endif
+#if defined(__wasm64__)
+#define ARCH_CPU_WASM64 1
+#elif defined(__wasm__)
+#define ARCH_CPU_WASM 1
+#elif defined(__asmjs__)
+#define ARCH_CPU_ASMJS 1
+#endif
#else
#error Please add support for your architecture in build/build_config.h
#endif
@@ -193,10 +213,10 @@
// Type detection for wchar_t.
#if defined(OS_WIN)
#define WCHAR_T_IS_UTF16
-#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+#elif defined(__WCHAR_MAX__) && \
(__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
#define WCHAR_T_IS_UTF32
-#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+#elif defined(__WCHAR_MAX__) && \
(__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
// compile in this mode (in particular, Chrome doesn't). This is intended for