Snap for 4615953 from 5cbee2f9e9bb4fffabb58337e79e524df7cf906e to pi-release

Change-Id: I4f27cf7c337a0c3426000cb049ecfecb8db092cc
diff --git a/Android.bp b/Android.bp
index c208ed4..ac00435 100644
--- a/Android.bp
+++ b/Android.bp
@@ -36,6 +36,7 @@
         "-Wall",
         "-Werror",
         "-Wno-deprecated-declarations",
+        "-Wno-missing-field-initializers",
         "-Wno-unused-parameter",
     ],
     include_dirs: [
@@ -67,7 +68,6 @@
     cflags: [
         "-Wno-unused-function",
         "-Wno-unused-variable",
-        "-Wno-missing-field-initializers",
     ],
 
     clang_cflags: [
diff --git a/base/base64.cc b/base/base64.cc
index 61d8538..ca8ee93 100644
--- a/base/base64.cc
+++ b/base/base64.cc
@@ -6,7 +6,7 @@
 
 #include <stddef.h>
 
-#include <modp_b64/modp_b64.h>
+#include "third_party/modp_b64/modp_b64.h"
 
 namespace base {
 
diff --git a/base/base64url.cc b/base/base64url.cc
index 942229e..0a2c045 100644
--- a/base/base64url.cc
+++ b/base/base64url.cc
@@ -10,8 +10,7 @@
 #include "base/macros.h"
 #include "base/numerics/safe_math.h"
 #include "base/strings/string_util.h"
-
-#include <modp_b64/modp_b64.h>
+#include "third_party/modp_b64/modp_b64.h"
 
 namespace base {
 
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index ebe9d61..3255552 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -46,7 +46,7 @@
 #include "base/strings/string_piece.h"
 
 #if defined(USE_SYMBOLIZE)
-#error "symbolize support was removed from libchrome"
+#include "base/third_party/symbolize/symbolize.h"
 #endif
 
 #if defined(OS_ANDROID)
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index c134f49..ab4c34b 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -49,7 +49,7 @@
 #include "build/build_config.h"
 
 #if defined(USE_SYMBOLIZE)
-#error "symbolize support was removed from libchrome"
+#include "base/third_party/symbolize/symbolize.h"
 #endif
 
 namespace base {
diff --git a/base/logging.cc b/base/logging.cc
index ad9d84a..01e311b 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -796,7 +796,6 @@
     gettimeofday(&tv, nullptr);
     time_t t = tv.tv_sec;
     struct tm local_time;
-	memset(&local_time, 0, sizeof(local_time));
     localtime_r(&t, &local_time);
     struct tm* tm_time = &local_time;
     stream_ << std::setfill('0')
diff --git a/base/memory/shared_memory_android.cc b/base/memory/shared_memory_android.cc
index dffd1e3..6f1d9cb 100644
--- a/base/memory/shared_memory_android.cc
+++ b/base/memory/shared_memory_android.cc
@@ -8,12 +8,7 @@
 #include <sys/mman.h>
 
 #include "base/logging.h"
-
-#if defined(__ANDROID__)
-#include <cutils/ashmem.h>
-#else
 #include "third_party/ashmem/ashmem.h"
-#endif
 
 namespace base {
 
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index e5f67bd..287e55d 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -27,9 +27,9 @@
 
 #if defined(OS_ANDROID)
 #include "base/os_compat_android.h"
+#endif
+#if defined(OS_ANDROID) || defined(__ANDROID__)
 #include "third_party/ashmem/ashmem.h"
-#elif defined(__ANDROID__)
-#include <cutils/ashmem.h>
 #endif
 
 namespace base {
diff --git a/base/posix/unix_domain_socket_linux.cc b/base/posix/unix_domain_socket_linux.cc
index 25ddb54..8b3094e 100644
--- a/base/posix/unix_domain_socket_linux.cc
+++ b/base/posix/unix_domain_socket_linux.cc
@@ -50,8 +50,7 @@
                                const void* buf,
                                size_t length,
                                const std::vector<int>& fds) {
-  struct msghdr msg;
-  memset(&msg, 0, sizeof(msg));
+  struct msghdr msg = {};
   struct iovec iov = { const_cast<void*>(buf), length };
   msg.msg_iov = &iov;
   msg.msg_iovlen = 1;
@@ -109,8 +108,7 @@
                                            ProcessId* out_pid) {
   fds->clear();
 
-  struct msghdr msg;
-  memset(&msg, 0, sizeof(msg));
+  struct msghdr msg = {};
   struct iovec iov = { buf, length };
   msg.msg_iov = &iov;
   msg.msg_iovlen = 1;
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 1c4df40..2184051 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -163,12 +163,7 @@
 // See crbug.com/177956.
 void ResetChildSignalHandlersToDefaults(void) {
   for (int signum = 1; ; ++signum) {
-#if defined(ANDROID)
-    struct kernel_sigaction act;
-    memset(&act, 0, sizeof(act));
-#else
     struct kernel_sigaction act = {0};
-#endif
     int sigaction_get_ret = sys_rt_sigaction(signum, nullptr, &act);
     if (sigaction_get_ret && errno == EINVAL) {
 #if !defined(NDEBUG)
diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc
index db525f0..3da6793 100644
--- a/base/process/process_posix.cc
+++ b/base/process/process_posix.cc
@@ -102,12 +102,7 @@
     return false;
   }
 
-#if defined(ANDROID)
-  struct kevent change;
-  memset(&change, 0, sizeof(change));
-#else
   struct kevent change = {0};
-#endif
   EV_SET(&change, handle, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
   int result = HANDLE_EINTR(kevent(kq.get(), &change, 1, NULL, 0, NULL));
   if (result == -1) {
diff --git a/base/third_party/symbolize/symbolize.h b/base/third_party/symbolize/symbolize.h
new file mode 100644
index 0000000..59beafb
--- /dev/null
+++ b/base/third_party/symbolize/symbolize.h
@@ -0,0 +1,15 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#error "symbolize support was removed from libchrome"
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h
index 5e70410..fd2a789 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -94,7 +94,7 @@
   // initialization, as base's LINKER_INITIALIZED requires a constructor and on
   // some compilers (notably gcc 4.4) this still ends up needing runtime
   // initialization.
-#define TLS_INITIALIZER {false, 0, 0}
+  #define TLS_INITIALIZER {0}
 
   // A key representing one value stored in TLS.
   // Initialize like
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
index d78de9b..7f27060 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -211,7 +211,7 @@
                                       &allocated_objects_size);
   DCHECK(res);
 #elif defined(OS_MACOSX) || defined(OS_IOS)
-  malloc_statistics_t stats = {};
+  malloc_statistics_t stats = {0};
   malloc_zone_statistics(nullptr, &stats);
   total_virtual_size = stats.size_allocated;
   allocated_objects_size = stats.size_in_use;
diff --git a/third_party/ashmem/ashmem.h b/third_party/ashmem/ashmem.h
new file mode 100644
index 0000000..3ef9f73
--- /dev/null
+++ b/third_party/ashmem/ashmem.h
@@ -0,0 +1,17 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// third_party/ashmem is Android shared memory. Instead of clone it here,
+// use cutils/ashmem.h directly.
+#include <cutils/ashmem.h>
diff --git a/third_party/modp_b64/modp_b64.h b/third_party/modp_b64/modp_b64.h
new file mode 100644
index 0000000..ed24ac8
--- /dev/null
+++ b/third_party/modp_b64/modp_b64.h
@@ -0,0 +1,16 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Redirect to system header.
+#include <modp_b64/modp_b64.h>