Import Cobalt 20.master.0.221008

Includes the following patches:
  https://cobalt-review.googlesource.com/c/cobalt/+/5470
    by errong.leng@samsung.com
diff --git a/src/base/base.gyp b/src/base/base.gyp
index 9cbd82f..adce093 100644
--- a/src/base/base.gyp
+++ b/src/base/base.gyp
@@ -5,6 +5,7 @@
 {
   'variables': {
     'chromium_code': 1,
+    'optimize_target_for_speed': 1,
   },
   'targets': [
     {
diff --git a/src/cobalt/CHANGELOG.md b/src/cobalt/CHANGELOG.md
index 6bd4d82..1e75f4e 100644
--- a/src/cobalt/CHANGELOG.md
+++ b/src/cobalt/CHANGELOG.md
@@ -159,6 +159,15 @@
   that may be copied and queried on any thread to get a coherent view of
   attributes set by the the web app on the `MediaSession`.
 
+- **Add support for size vs speed compiler flags**
+
+  Performance-critical gyp targets now specify `optimize_target_for_speed`: 1.
+  For gold configs, these targets will use compiler flags `compiler_flags_gold`
+  and `compiler_flags_gold_speed`; other targets will use `compiler_flags_gold`
+  and `compiler_flags_gold_size`. For qa configs, the respective variables are
+  `compiler_flags_qa_speed` and `compiler_flags_qa_size`. Only the qa and gold
+  configs support these types of compiler flag gyp variables.
+
  - **Improvements and Bug Fixes**
 
    - Fix bug where Cobalt would not refresh the layout when the textContent
diff --git a/src/cobalt/browser/browser_module.cc b/src/cobalt/browser/browser_module.cc
index 1708028..18aeeca 100644
--- a/src/cobalt/browser/browser_module.cc
+++ b/src/cobalt/browser/browser_module.cc
@@ -1754,16 +1754,24 @@
 ViewportSize BrowserModule::GetViewportSize() {
   // We trust the renderer module for width and height the most, if it exists.
   if (renderer_module_) {
-    math::Size size = renderer_module_->render_target_size();
+    math::Size target_size = renderer_module_->render_target_size();
     // ...but get the diagonal from one of the other modules.
     float diagonal_inches = 0;
     if (system_window_) {
       diagonal_inches = system_window_->GetDiagonalSizeInches();
+      // For those platforms that can have a main window size smaller than the
+      // render target size, the system_window_ size (if exists) should be
+      // trusted over the renderer_module_ render target size.
+      math::Size window_size = system_window_->GetWindowSize();
+      if (window_size.width() <= target_size.width() &&
+          window_size.height() <= target_size.height()) {
+        target_size = window_size;
+      }
     } else if (options_.requested_viewport_size) {
       diagonal_inches = options_.requested_viewport_size->diagonal_inches();
     }
 
-    ViewportSize v(size.width(), size.height(), diagonal_inches);
+    ViewportSize v(target_size.width(), target_size.height(), diagonal_inches);
     return v;
   }
 
diff --git a/src/cobalt/build/build.id b/src/cobalt/build/build.id
index eb09812..2099216 100644
--- a/src/cobalt/build/build.id
+++ b/src/cobalt/build/build.id
@@ -1 +1 @@
-220857
\ No newline at end of file
+221008
\ No newline at end of file
diff --git a/src/cobalt/css_parser/css_parser.gyp b/src/cobalt/css_parser/css_parser.gyp
index 0aa3ed9..d3f2715 100644
--- a/src/cobalt/css_parser/css_parser.gyp
+++ b/src/cobalt/css_parser/css_parser.gyp
@@ -14,6 +14,7 @@
 
 {
   'variables': {
+    'optimize_target_for_speed': 1,
     'sb_pedantic_warnings': 1,
 
     # Define the platform specific Bison binary.
@@ -35,7 +36,7 @@
       'type': 'none',
       'sources': [
         'grammar.h',
-	'grammar.y'
+        'grammar.y'
       ],
       # Generated header files are stored in the intermediate directory
       # under their module sub-directory.
diff --git a/src/cobalt/cssom/cssom.gyp b/src/cobalt/cssom/cssom.gyp
index 3fdf9f1..b8278f9 100644
--- a/src/cobalt/cssom/cssom.gyp
+++ b/src/cobalt/cssom/cssom.gyp
@@ -14,6 +14,7 @@
 
 {
   'variables': {
+    'optimize_target_for_speed': 1,
     'sb_pedantic_warnings': 1,
   },
   'targets': [
diff --git a/src/cobalt/doc/performance_tuning.md b/src/cobalt/doc/performance_tuning.md
index e6d9994..e8336f3 100644
--- a/src/cobalt/doc/performance_tuning.md
+++ b/src/cobalt/doc/performance_tuning.md
@@ -273,6 +273,19 @@
 
 **Tags:** *framerate, startup, browse-to-watch, input latency*
 
+#### Optimize for size vs speed
+
+For qa and gold configs, different compiler flags can be used for gyp targets
+which should be optimized for size vs speed. This can be used to reduce the
+executable size with minimal impact on performance. On top of the base
+`compiler_flags_qa` and `compiler_flags_gold`, the gyp variables
+`compiler_flags_qa_size`, `compiler_flags_qa_speed`, `compiler_flags_gold_size`,
+and `compiler_flags_gold_speed` will be used. Performance-critical gyp targets
+specify `optimize_target_for_speed`: 1, and these will use compiler flags
+`compiler_flags_<config>` + `compiler_flags_<config>_speed`; other gyp targets
+will use `compiler_flags_<config>` + `compiler_flags_<config>_size`.
+
+**Tags:** *cpu memory, package size*
 
 #### Link Time Optimization (LTO)
 If your toolchain supports it, it is recommended that you enable the LTO
diff --git a/src/cobalt/network/cobalt_net_log.cc b/src/cobalt/network/cobalt_net_log.cc
index 6bfc35e..3df4117 100644
--- a/src/cobalt/network/cobalt_net_log.cc
+++ b/src/cobalt/network/cobalt_net_log.cc
@@ -16,6 +16,7 @@
 
 #include <algorithm>
 
+#include "base/callback.h"
 #include "base/logging.h"
 #include "base/values.h"
 
@@ -23,14 +24,15 @@
 namespace network {
 
 CobaltNetLog::CobaltNetLog(const base::FilePath& log_path,
-                           net::NetLogCaptureMode capture_mode) {
-  net_log_logger_.reset(new NetLogLogger(log_path));
+                           net::NetLogCaptureMode capture_mode)
+    : net_log_logger_(
+          net::FileNetLogObserver::CreateUnbounded(log_path, nullptr)) {
   net_log_logger_->StartObserving(this, capture_mode);
 }
 
 CobaltNetLog::~CobaltNetLog() {
   // Remove the observers we own before we're destroyed.
-  if (net_log_logger_.get()) RemoveObserver(net_log_logger_.get());
+  net_log_logger_->StopObserving(nullptr, base::OnceClosure());
 }
 
 }  // namespace network
diff --git a/src/cobalt/network/cobalt_net_log.h b/src/cobalt/network/cobalt_net_log.h
index 3838915..4ee6fa8 100644
--- a/src/cobalt/network/cobalt_net_log.h
+++ b/src/cobalt/network/cobalt_net_log.h
@@ -22,7 +22,7 @@
 #include "base/macros.h"
 #include "base/observer_list.h"
 #include "base/synchronization/lock.h"
-#include "cobalt/network/net_log_logger.h"
+#include "net/log/file_net_log_observer.h"
 #include "net/log/net_log.h"
 
 namespace cobalt {
@@ -35,7 +35,7 @@
   ~CobaltNetLog() override;
 
  private:
-  std::unique_ptr<NetLogLogger> net_log_logger_;
+  std::unique_ptr<net::FileNetLogObserver> net_log_logger_;
 
   DISALLOW_COPY_AND_ASSIGN(CobaltNetLog);
 };
diff --git a/src/cobalt/network/net_log_logger.cc b/src/cobalt/network/net_log_logger.cc
deleted file mode 100644
index 65e9839..0000000
--- a/src/cobalt/network/net_log_logger.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2016 The Cobalt Authors. All Rights Reserved.
-//
-// 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.
-
-#include "cobalt/network/net_log_logger.h"
-
-#include <stdio.h>
-
-#include <limits>
-#include <memory>
-#include <string>
-
-#include "base/bind.h"
-#include "base/files/file_util.h"
-#include "base/json/json_writer.h"
-#include "base/logging.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/time/time.h"
-#include "base/values.h"
-#include "cobalt/network/net_log_constants.h"
-
-namespace cobalt {
-namespace network {
-namespace {
-SbFile OpenFile(const base::FilePath& log_path) {
-  int creation_flags = kSbFileCreateAlways | kSbFileWrite;
-  return SbFileOpen(log_path.value().c_str(), creation_flags,
-                    NULL /* out_created */, NULL /* error */);
-}
-
-void AppendToFile(SbFile file, const std::string& data) {
-  DCHECK_LE(data.size(), static_cast<size_t>(std::numeric_limits<int>::max()));
-  int num_bytes_to_write = static_cast<int>(data.size());
-  int bytes_written = SbFileWrite(file, data.c_str(), num_bytes_to_write);
-  SB_UNREFERENCED_PARAMETER(bytes_written);
-  DLOG_IF(FATAL, bytes_written != num_bytes_to_write)
-      << "Did not write all bytes to file.";
-}
-
-void CloseFile(SbFile file) {
-  bool success = SbFileClose(file);
-  SB_UNREFERENCED_PARAMETER(success);
-  DLOG_IF(ERROR, !success) << "Failed to close file.";
-}
-}  // namespace
-
-NetLogLogger::NetLogLogger(const base::FilePath& log_path)
-    : log_writer_thread_("NetLogLogger IO"),
-      log_file_(base::kInvalidPlatformFile) {
-  if (!log_path.empty()) {
-    DLOG(INFO) << log_path;
-    base::ThreadRestrictions::ScopedAllowIO allow_io;
-    log_file_ = OpenFile(log_path);
-    if (log_file_ == base::kInvalidPlatformFile) {
-      LOG(ERROR) << "Could not open file " << log_path.value()
-                 << " for net logging";
-      return;
-    }
-
-    const int kDefaultStackSize = 0;
-    log_writer_thread_.StartWithOptions(
-        base::Thread::Options(base::MessageLoop::TYPE_IO, kDefaultStackSize));
-
-    // Write constants to the output file.  This allows loading files that have
-    // different source and event types, as they may be added and removed
-    // between Chrome versions.
-    std::unique_ptr<base::Value> value(NetLogConstants::GetConstants());
-    std::string json;
-    base::JSONWriter::Write(*value.get(), &json);
-    WriteToLog("{\"constants\": ");
-    WriteToLog(json);
-    WriteToLog(",\n");
-    WriteToLog("\"events\": [\n");
-  }
-}
-
-NetLogLogger::~NetLogLogger() {
-  if (log_file_ != base::kInvalidPlatformFile) {
-    log_writer_thread_.message_loop()->task_runner()->PostTask(
-        FROM_HERE, base::Bind(&CloseFile, log_file_));
-  }
-  log_writer_thread_.Stop();
-}
-
-void NetLogLogger::StartObserving(net::NetLog* net_log,
-                                  net::NetLogCaptureMode capture_mode) {
-  net_log->AddObserver(this, capture_mode);
-}
-
-void NetLogLogger::OnAddEntry(const net::NetLogEntry& entry) {
-  std::unique_ptr<base::Value> value(entry.ToValue());
-  // Don't pretty print, so each JSON value occupies a single line, with no
-  // breaks (Line breaks in any text field will be escaped).  Using strings
-  // instead of integer identifiers allows logs from older versions to be
-  // loaded, though a little extra parsing has to be done when loading a log.
-  std::string json;
-  base::JSONWriter::Write(*value.get(), &json);
-  if (log_file_ == base::kInvalidPlatformFile) {
-    VLOG(1) << json;
-  } else {
-    WriteToLog(json);
-    WriteToLog(",\n");
-  }
-}
-
-void NetLogLogger::WriteToLog(const std::string& data) {
-  DCHECK_NE(log_file_, base::kInvalidPlatformFile);
-  DCHECK(log_writer_thread_.IsRunning());
-  log_writer_thread_.message_loop()->task_runner()->PostTask(
-      FROM_HERE, base::Bind(&AppendToFile, log_file_, data));
-}
-
-}  // namespace network
-}  // namespace cobalt
diff --git a/src/cobalt/network/net_log_logger.h b/src/cobalt/network/net_log_logger.h
deleted file mode 100644
index 8cc7a11..0000000
--- a/src/cobalt/network/net_log_logger.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2016 The Cobalt Authors. All Rights Reserved.
-//
-// 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.
-
-#ifndef COBALT_NETWORK_NET_LOG_LOGGER_H_
-#define COBALT_NETWORK_NET_LOG_LOGGER_H_
-
-#include <string>
-
-#include "base/files/platform_file.h"
-#include "base/threading/thread.h"
-#include "net/log/net_log.h"
-
-namespace base {
-class FilePath;
-}
-
-namespace cobalt {
-namespace network {
-
-// NetLogLogger watches the NetLog event stream, and sends all entries to
-// VLOG(1) or a path specified on creation.  This is to debug errors that
-// prevent getting to the about:net-internals page.
-//
-// When writing directly to a file rather than VLOG(1), the text file will
-// contain a single JSON object, with an extra comma on the end and missing
-// a terminal "]}".
-//
-// This is more or less copied from Chromium's NetLogLogger.
-class NetLogLogger : public net::NetLog::ThreadSafeObserver {
- public:
-  // If |log_path| is empty or file creation fails, writes to VLOG(1).
-  // Otherwise, writes to |log_path|.  Uses one line per entry, for
-  // easy parsing.
-  explicit NetLogLogger(const base::FilePath& log_path);
-  virtual ~NetLogLogger();
-
-  // Starts observing specified NetLog.  Must not already be watching a NetLog.
-  // Separate from constructor to enforce thread safety.
-  void StartObserving(net::NetLog* net_log,
-                      net::NetLogCaptureMode capture_mode);
-
-  // net::NetLog::ThreadSafeObserver implementation:
-  void OnAddEntry(const net::NetLogEntry& entry) override;
-
- private:
-  void WriteToLog(const std::string& data);
-
-  base::Thread log_writer_thread_;
-  base::PlatformFile log_file_;
-
-  DISALLOW_COPY_AND_ASSIGN(NetLogLogger);
-};
-
-}  // namespace network
-}  // namespace cobalt
-
-#endif  // COBALT_NETWORK_NET_LOG_LOGGER_H_
diff --git a/src/cobalt/network/network.gyp b/src/cobalt/network/network.gyp
index 42fb904..08e7036 100644
--- a/src/cobalt/network/network.gyp
+++ b/src/cobalt/network/network.gyp
@@ -70,8 +70,6 @@
             'cobalt_net_log.h',
             'net_log_constants.cc',
             'net_log_constants.h',
-            'net_log_logger.cc',
-            'net_log_logger.h',
           ],
           'defines': [
             'ENABLE_NETWORK_LOGGING',
diff --git a/src/cobalt/renderer/rasterizer/blitter/rasterizer.gyp b/src/cobalt/renderer/rasterizer/blitter/rasterizer.gyp
index 4f382f4..f989a6d 100644
--- a/src/cobalt/renderer/rasterizer/blitter/rasterizer.gyp
+++ b/src/cobalt/renderer/rasterizer/blitter/rasterizer.gyp
@@ -13,6 +13,9 @@
 # limitations under the License.
 
 {
+  'variables': {
+    'optimize_target_for_speed': 1,
+  },
   'targets': [
     # Code shared by both the hardware and software Blitter rasterizers.
     {
diff --git a/src/cobalt/renderer/rasterizer/egl/rasterizer.gyp b/src/cobalt/renderer/rasterizer/egl/rasterizer.gyp
index 949063f..1b07837 100644
--- a/src/cobalt/renderer/rasterizer/egl/rasterizer.gyp
+++ b/src/cobalt/renderer/rasterizer/egl/rasterizer.gyp
@@ -13,6 +13,9 @@
 # limitations under the License.
 
 {
+  'variables': {
+    'optimize_target_for_speed': 1,
+  },
   'targets': [
     {
       'target_name': 'software_rasterizer',
diff --git a/src/cobalt/renderer/rasterizer/skia/rasterizer.gyp b/src/cobalt/renderer/rasterizer/skia/rasterizer.gyp
index 1781010..0ae2894 100644
--- a/src/cobalt/renderer/rasterizer/skia/rasterizer.gyp
+++ b/src/cobalt/renderer/rasterizer/skia/rasterizer.gyp
@@ -13,6 +13,9 @@
 # limitations under the License.
 
 {
+  'variables': {
+    'optimize_target_for_speed': 1,
+  },
   'targets': [
     {
       'target_name': 'hardware_rasterizer',
diff --git a/src/cobalt/tools/automated_testing/cobalt_runner.py b/src/cobalt/tools/automated_testing/cobalt_runner.py
index d21b9d5..8e3d6b0 100644
--- a/src/cobalt/tools/automated_testing/cobalt_runner.py
+++ b/src/cobalt/tools/automated_testing/cobalt_runner.py
@@ -41,8 +41,8 @@
 WEBDRIVER_HTTP_TIMEOUT_SECONDS = 2 * 60
 COBALT_EXIT_TIMEOUT_SECONDS = 5
 PAGE_LOAD_WAIT_SECONDS = 30
-WINDOWDRIVER_CREATED_TIMEOUT_SECONDS = 30
-WEBMODULE_LOADED_TIMEOUT_SECONDS = 30
+WINDOWDRIVER_CREATED_TIMEOUT_SECONDS = 45
+WEBMODULE_LOADED_TIMEOUT_SECONDS = 45
 FIND_ELEMENT_RETRY_LIMIT = 20
 
 COBALT_WEBDRIVER_CAPABILITIES = {
diff --git a/src/cobalt/webdriver/webdriver.gyp b/src/cobalt/webdriver/webdriver.gyp
index b2f6528..f344d75 100644
--- a/src/cobalt/webdriver/webdriver.gyp
+++ b/src/cobalt/webdriver/webdriver.gyp
@@ -15,6 +15,10 @@
 {
   'includes': [ '../build/contents_dir.gypi' ],
 
+  'variables': {
+    'optimize_target_for_speed': 1,
+  },
+
   'targets': [
     {
       'target_name': 'webdriver',
diff --git a/src/net/log/file_net_log_observer.cc b/src/net/log/file_net_log_observer.cc
index 067992b..c09a8a4 100644
--- a/src/net/log/file_net_log_observer.cc
+++ b/src/net/log/file_net_log_observer.cc
@@ -92,6 +92,20 @@
                             base::File* destination_file,
                             char* read_buffer,
                             size_t read_buffer_size) {
+#if defined(STARBOARD)
+  auto source_file =
+      base::File(source_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
+  DCHECK(source_file.IsValid());
+
+  // Read |source_path|'s contents in chunks of read_buffer_size and append
+  // to |destination_file|.
+  size_t num_bytes_read;
+  while ((num_bytes_read = source_file.Read(0, read_buffer, read_buffer_size)) >
+         0) {
+    WriteToFile(destination_file,
+                base::StringPiece(read_buffer, num_bytes_read));
+  }
+#else
   base::ScopedFILE source_file(base::OpenFile(source_path, "rb"));
   if (!source_file)
     return;
@@ -107,6 +121,7 @@
 
   // Now that it has been copied, delete the source file.
   source_file.reset();
+#endif
   base::DeleteFile(source_path, false);
 }
 
diff --git a/src/net/log/file_net_log_observer.h b/src/net/log/file_net_log_observer.h
index 5bf5d62..909a0da 100644
--- a/src/net/log/file_net_log_observer.h
+++ b/src/net/log/file_net_log_observer.h
@@ -15,8 +15,6 @@
 #include "net/base/net_export.h"
 #include "net/log/net_log.h"
 
-#if !defined(STARBOARD)
-
 namespace base {
 class Value;
 class FilePath;
@@ -155,6 +153,4 @@
 
 }  // namespace net
 
-#endif  // !defined(STARBOARD)
-
 #endif  // NET_LOG_FILE_NET_LOG_OBSERVER_H_
diff --git a/src/net/net.gyp b/src/net/net.gyp
index f9d74c7..c90b5b3 100644
--- a/src/net/net.gyp
+++ b/src/net/net.gyp
@@ -21,6 +21,7 @@
         'STARBOARD_NO_LOCAL_ISSUER',
         'QUIC_TRACE_DISABLED',
         'COBALT_QUIC46',
+        'COMMON_CERT_SET_DISABLED_FOR_STARBOARD',
       ],
       'direct_dependent_settings': {
         'defines': [
@@ -29,6 +30,7 @@
           'STARBOARD_NO_LOCAL_ISSUER',
           'QUIC_TRACE_DISABLED',
           'COBALT_QUIC46',
+          'COMMON_CERT_SET_DISABLED_FOR_STARBOARD',
         ],
       },
       'include_dirs': [
@@ -276,6 +278,8 @@
         'http/transport_security_state_source.h',
         'log/net_log.cc',
         'log/net_log.h',
+        'log/file_net_log_observer.cc',
+        'log/file_net_log_observer.h',
         'log/net_log_capture_mode.cc',
         'log/net_log_capture_mode.h',
         'log/net_log_entry.cc',
@@ -2209,7 +2213,7 @@
         'third_party/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc',
         'third_party/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc',
         'third_party/quic/core/crypto/channel_id_test.cc',
-        'third_party/quic/core/crypto/common_cert_set_test.cc',
+        # 'third_party/quic/core/crypto/common_cert_set_test.cc',
         'third_party/quic/core/crypto/crypto_framer_test.cc',
         'third_party/quic/core/crypto/crypto_handshake_message_test.cc',
         'third_party/quic/core/crypto/crypto_secret_boxer_test.cc',
diff --git a/src/net/third_party/quic/core/crypto/common_cert_set.cc b/src/net/third_party/quic/core/crypto/common_cert_set.cc
index 6c246b9..38403b9 100644
--- a/src/net/third_party/quic/core/crypto/common_cert_set.cc
+++ b/src/net/third_party/quic/core/crypto/common_cert_set.cc
@@ -24,6 +24,7 @@
 
 namespace {
 
+#if !defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
 struct CertSet {
   // num_certs contains the number of certificates in this set.
   size_t num_certs;
@@ -70,6 +71,7 @@
   }
   return 0;
 }
+#endif
 
 // CommonCertSetsQUIC implements the CommonCertSets interface using the default
 // certificate sets.
@@ -77,11 +79,18 @@
  public:
   // CommonCertSets interface.
   QuicStringPiece GetCommonHashes() const override {
+#if defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
+    return QuicStringPiece();
+#else
     return QuicStringPiece(reinterpret_cast<const char*>(kSetHashes),
                            sizeof(uint64_t) * QUIC_ARRAYSIZE(kSetHashes));
+#endif
   }
 
   QuicStringPiece GetCert(uint64_t hash, uint32_t index) const override {
+#if defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
+    NOTIMPLEMENTED() << "common cert set is disabled!";
+#else
     for (size_t i = 0; i < QUIC_ARRAYSIZE(kSets); i++) {
       if (kSets[i].hash == hash) {
         if (index < kSets[i].num_certs) {
@@ -92,6 +101,7 @@
         break;
       }
     }
+#endif
 
     return QuicStringPiece();
   }
@@ -100,6 +110,9 @@
                  QuicStringPiece common_set_hashes,
                  uint64_t* out_hash,
                  uint32_t* out_index) const override {
+#if defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
+    NOTIMPLEMENTED() << "common cert set is disabled!";
+#else
     if (common_set_hashes.size() % sizeof(uint64_t) != 0) {
       return false;
     }
@@ -139,6 +152,7 @@
         }
       }
     }
+#endif
 
     return false;
   }
diff --git a/src/net/third_party/quic/core/crypto/common_cert_set_2.c b/src/net/third_party/quic/core/crypto/common_cert_set_2.c
index c24ebc2..dbd4231 100644
--- a/src/net/third_party/quic/core/crypto/common_cert_set_2.c
+++ b/src/net/third_party/quic/core/crypto/common_cert_set_2.c
@@ -8,6 +8,7 @@
 
 #include <stdint.h>
 
+#if !defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
 #include "net/third_party/quic/core/crypto/common_cert_set_2a.inc"
 #include "net/third_party/quic/core/crypto/common_cert_set_2b.inc"
 
@@ -127,3 +128,4 @@
 };
 
 static const uint64_t kHash = UINT64_C(0xe81a92926081e801);
+#endif
diff --git a/src/net/third_party/quic/core/crypto/common_cert_set_3.c b/src/net/third_party/quic/core/crypto/common_cert_set_3.c
index d3ffdcc..f0e81af 100644
--- a/src/net/third_party/quic/core/crypto/common_cert_set_3.c
+++ b/src/net/third_party/quic/core/crypto/common_cert_set_3.c
@@ -6,8 +6,9 @@
 /* This file contains common certificates. It's designed to be #included in
  * another file, in a namespace. */
 
-#include "net/third_party/quic/core/crypto/common_cert_set_3a.inc"
+#if !defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
 #include "net/third_party/quic/core/crypto/common_cert_set_3b.inc"
+#include "net/third_party/quic/core/crypto/common_cert_set_3a.inc"
 
 static const size_t kNumCerts = 52;
 static const unsigned char* const kCerts[] = {
@@ -121,3 +122,4 @@
 };
 
 static const uint64_t kHash = UINT64_C(0x918215a28680ed7e);
+#endif
diff --git a/src/net/third_party/quic/core/crypto/common_cert_set_test.cc b/src/net/third_party/quic/core/crypto/common_cert_set_test.cc
index 25266a8..3b6c39e 100644
--- a/src/net/third_party/quic/core/crypto/common_cert_set_test.cc
+++ b/src/net/third_party/quic/core/crypto/common_cert_set_test.cc
@@ -192,6 +192,7 @@
 
 class CommonCertSetsTest : public QuicTest {};
 
+#if !defined(COMMON_CERT_SET_DISABLED_FOR_STARBOARD)
 TEST_F(CommonCertSetsTest, FindGIA_2) {
   QuicStringPiece gia(reinterpret_cast<const char*>(kGIACertificate2),
                       sizeof(kGIACertificate2));
@@ -233,6 +234,7 @@
   ASSERT_EQ(gia.size(), gia_copy.size());
   EXPECT_EQ(0, SbMemoryCompare(gia.data(), gia_copy.data(), gia.size()));
 }
+#endif  // COMMON_CERT_SET_DISABLED_FOR_STARBOARD
 
 TEST_F(CommonCertSetsTest, NonMatch) {
   const CommonCertSets* sets(CommonCertSets::GetInstanceQUIC());
diff --git a/src/starboard/contrib/tizen/armv7l/configuration_public.h b/src/starboard/contrib/tizen/armv7l/configuration_public.h
index 4f08902..e8f4c21 100644
--- a/src/starboard/contrib/tizen/armv7l/configuration_public.h
+++ b/src/starboard/contrib/tizen/armv7l/configuration_public.h
@@ -16,11 +16,15 @@
 #define STARBOARD_CONTRIB_TIZEN_ARMV7L_CONFIGURATION_PUBLIC_H_
 
 // The API version implemented by this platform.
-#define SB_API_VERSION 6
+#define SB_API_VERSION 10
 
 // The tizen policy version
 #define SB_TIZEN_POLICY_VERSION 4
 
+#define SB_HAS_ON_SCREEN_KEYBOARD 0
+#define SB_HAS_PLAYER_WITH_URL 0
+#define SB_HAS_ASYNC_AUDIO_FRAMES_REPORTING 0
+
 // --- Architecture Configuration --------------------------------------------
 
 // Whether the current platform is big endian. SB_IS_LITTLE_ENDIAN will be
@@ -92,7 +96,7 @@
 // --- I/O Configuration -----------------------------------------------------
 
 // Whether the current platform has microphone supported.
-#define SB_HAS_MICROPHONE 0
+#define SB_HAS_MICROPHONE 1
 
 // Whether the current platform has speech recognizer.
 #define SB_HAS_SPEECH_RECOGNIZER 0
diff --git a/src/starboard/contrib/tizen/armv7l/gyp_configuration.py b/src/starboard/contrib/tizen/armv7l/gyp_configuration.py
index 82ba369..793b79b 100644
--- a/src/starboard/contrib/tizen/armv7l/gyp_configuration.py
+++ b/src/starboard/contrib/tizen/armv7l/gyp_configuration.py
@@ -36,6 +36,8 @@
     variables = super(_PlatformConfig, self).GetVariables(configuration)
     variables.update({
         'clang': 0,
+        'javascript_engine': 'v8',
+        'cobalt_enable_jit': 1,
     })
 
     return variables
diff --git a/src/starboard/contrib/tizen/armv7l/system_get_property.cc b/src/starboard/contrib/tizen/armv7l/system_get_property.cc
index ff8a9e4..aebf1a5 100644
--- a/src/starboard/contrib/tizen/armv7l/system_get_property.cc
+++ b/src/starboard/contrib/tizen/armv7l/system_get_property.cc
@@ -73,10 +73,6 @@
     case kSbSystemPropertyPlatformName:
       return CopyStringAndTestIfSuccess(out_value, value_length, kPlatformName);
 
-    case kSbSystemPropertyPlatformUuid:
-      SB_NOTIMPLEMENTED();
-      return CopyStringAndTestIfSuccess(out_value, value_length, "N/A");
-
     default:
       SB_DLOG(WARNING) << __FUNCTION__
                        << ": Unrecognized property: " << property_id;
diff --git a/src/starboard/contrib/tizen/shared/gyp_configuration.gypi b/src/starboard/contrib/tizen/shared/gyp_configuration.gypi
index cef6312..3906f50 100644
--- a/src/starboard/contrib/tizen/shared/gyp_configuration.gypi
+++ b/src/starboard/contrib/tizen/shared/gyp_configuration.gypi
@@ -78,6 +78,7 @@
       '__STDC_FORMAT_MACROS', # so that we get PRI*
       # Enable GNU extensions to get prototypes like ffsl.
       '_GNU_SOURCE=1',
+      'U_HAVE_STD_STRING=1',
     ],
     'cflags': [
       '-pthread',
diff --git a/src/starboard/contrib/tizen/shared/starboard_common.gyp b/src/starboard/contrib/tizen/shared/starboard_common.gyp
index 5b7026f..fff2b96 100644
--- a/src/starboard/contrib/tizen/shared/starboard_common.gyp
+++ b/src/starboard/contrib/tizen/shared/starboard_common.gyp
@@ -34,7 +34,9 @@
         '<(DEPTH)/starboard/contrib/tizen/shared/system_has_capability.cc',
         '<(DEPTH)/starboard/contrib/tizen/shared/thread_create.cc',
         '<(DEPTH)/starboard/contrib/tizen/shared/thread_join.cc',
+        '<(DEPTH)/starboard/shared/dlmalloc/memory_map.cc',
         '<(DEPTH)/starboard/shared/dlmalloc/memory_protect.cc',
+        '<(DEPTH)/starboard/shared/dlmalloc/memory_unmap.cc',
         '<(DEPTH)/starboard/shared/gcc/atomic_gcc_public.h',
         '<(DEPTH)/starboard/shared/iso/character_is_alphanumeric.cc',
         '<(DEPTH)/starboard/shared/iso/character_is_digit.cc',
@@ -235,6 +237,25 @@
         '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
         'starboard_base_symbolize',
       ],
+      'conditions': [
+        ['use_dlmalloc_allocator==1', {
+          'sources': [
+            '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_aligned_unchecked.cc',
+            '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_unchecked.cc',
+            '<(DEPTH)/starboard/shared/dlmalloc/memory_free.cc',
+            '<(DEPTH)/starboard/shared/dlmalloc/memory_free_aligned.cc',
+            '<(DEPTH)/starboard/shared/dlmalloc/memory_reallocate_unchecked.cc',
+          ],
+        }, {
+          'sources': [
+            '<(DEPTH)/starboard/shared/iso/memory_allocate_unchecked.cc',
+            '<(DEPTH)/starboard/shared/iso/memory_free.cc',
+            '<(DEPTH)/starboard/shared/iso/memory_reallocate_unchecked.cc',
+            '<(DEPTH)/starboard/shared/posix/memory_allocate_aligned_unchecked.cc',
+            '<(DEPTH)/starboard/shared/posix/memory_free_aligned.cc',
+          ],
+        }],
+      ],
     },
   ],
 }
diff --git a/src/starboard/contrib/tizen/shared/starboard_platform.gypi b/src/starboard/contrib/tizen/shared/starboard_platform.gypi
index f8b84a4..f5bd53d 100644
--- a/src/starboard/contrib/tizen/shared/starboard_platform.gypi
+++ b/src/starboard/contrib/tizen/shared/starboard_platform.gypi
@@ -12,17 +12,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 {
+  'includes': [
+    '<(DEPTH)/starboard/shared/starboard/player/filter/player_filter.gypi',
+  ],
   'variables': {
+    'variables': {
+      'has_cdm%': '<!(test -e <(DEPTH)/third_party/ce_cdm/cdm/include/cdm.h && echo 1 || echo 0)',
+      'has_system_libvpx%' : '<!(pkg-config vpx && echo 1 || echo 0)',
+    },
+    # This has_cdm gets exported to gyp files that include this one.
+    'has_cdm%': '<(has_cdm)',
     'starboard_platform_sources': [
-      '<(DEPTH)/starboard/contrib/tizen/shared/alsa/alsa_audio_sink_type.cc',
-      '<(DEPTH)/starboard/contrib/tizen/shared/alsa/alsa_util.cc',
-      '<(DEPTH)/starboard/contrib/tizen/shared/alsa/alsa_util.h',
-      '<(DEPTH)/starboard/contrib/tizen/shared/alsa/audio_sink_is_audio_sample_type_supported.cc',
+      '<@(filter_based_player_sources)',
       '<(DEPTH)/starboard/contrib/tizen/shared/atomic_public.h',
       '<(DEPTH)/starboard/contrib/tizen/shared/configuration_public.h',
       '<(DEPTH)/starboard/contrib/tizen/shared/get_home_directory.cc',
-      '<(DEPTH)/starboard/contrib/tizen/shared/memory_flush.cc',
-      '<(DEPTH)/starboard/contrib/tizen/shared/player/player_output_mode_supported.cc',
       '<(DEPTH)/starboard/contrib/tizen/shared/system_get_connection_type.cc',
       '<(DEPTH)/starboard/contrib/tizen/shared/system_get_path.cc',
       '<(DEPTH)/starboard/contrib/tizen/shared/system_get_device_type.cc',
@@ -30,20 +34,38 @@
       '<(DEPTH)/starboard/contrib/tizen/shared/wayland/application_tizen.h',
       '<(DEPTH)/starboard/contrib/tizen/shared/wayland/window_internal_tizen.cc',
       '<(DEPTH)/starboard/contrib/tizen/shared/wayland/window_internal_tizen.h',
+      '<(DEPTH)/starboard/shared/wayland/application_wayland.cc',
+      '<(DEPTH)/starboard/shared/wayland/application_wayland.h',
+      '<(DEPTH)/starboard/shared/wayland/dev_input.cc',
+      '<(DEPTH)/starboard/shared/wayland/dev_input.h',
+      '<(DEPTH)/starboard/shared/wayland/egl_workaround.cc',
+      '<(DEPTH)/starboard/shared/wayland/native_display_type.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_create.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_destroy.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_get_platform_handle.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_get_size.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_internal.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_internal.h',
+
+      '<(DEPTH)/starboard/linux/shared/audio_sink_type_dispatcher.cc',
       '<(DEPTH)/starboard/linux/shared/decode_target_get_info.cc',
       '<(DEPTH)/starboard/linux/shared/decode_target_internal.cc',
       '<(DEPTH)/starboard/linux/shared/decode_target_internal.h',
       '<(DEPTH)/starboard/linux/shared/decode_target_release.cc',
+      '<(DEPTH)/starboard/linux/shared/media_is_audio_supported.cc',
       '<(DEPTH)/starboard/linux/shared/media_is_video_supported.cc',
       '<(DEPTH)/starboard/linux/shared/player_components_impl.cc',
       '<(DEPTH)/starboard/linux/shared/system_has_capability.cc',
+      '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.cc',
       '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.h',
-      '<(DEPTH)/starboard/shared/alsa/audio_sink_get_max_channels.cc',
-      '<(DEPTH)/starboard/shared/alsa/audio_sink_get_nearest_supported_sample_frequency.cc',
-      '<(DEPTH)/starboard/shared/alsa/audio_sink_is_audio_frame_storage_type_supported.cc',
+      '<(DEPTH)/starboard/shared/alsa/alsa_util.cc',
+      '<(DEPTH)/starboard/shared/alsa/alsa_util.h',
       '<(DEPTH)/starboard/shared/dlmalloc/memory_map.cc',
+      '<(DEPTH)/starboard/shared/dlmalloc/memory_protect.cc',
       '<(DEPTH)/starboard/shared/dlmalloc/memory_unmap.cc',
+      '<(DEPTH)/starboard/shared/egl/system_egl.cc',
       '<(DEPTH)/starboard/shared/gcc/atomic_gcc_public.h',
+      '<(DEPTH)/starboard/shared/gles/system_gles2.cc',
       '<(DEPTH)/starboard/shared/iso/character_is_alphanumeric.cc',
       '<(DEPTH)/starboard/shared/iso/character_is_digit.cc',
       '<(DEPTH)/starboard/shared/iso/character_is_hex_digit.cc',
@@ -78,6 +100,14 @@
       '<(DEPTH)/starboard/shared/iso/string_scan.cc',
       '<(DEPTH)/starboard/shared/iso/system_binary_search.cc',
       '<(DEPTH)/starboard/shared/iso/system_sort.cc',
+      '<(DEPTH)/starboard/shared/libaom/aom_library_loader.cc',
+      '<(DEPTH)/starboard/shared/libaom/aom_library_loader.h',
+      '<(DEPTH)/starboard/shared/libaom/aom_video_decoder.cc',
+      '<(DEPTH)/starboard/shared/libaom/aom_video_decoder.h',
+      '<(DEPTH)/starboard/shared/libde265/de265_library_loader.cc',
+      '<(DEPTH)/starboard/shared/libde265/de265_library_loader.h',
+      '<(DEPTH)/starboard/shared/libde265/de265_video_decoder.cc',
+      '<(DEPTH)/starboard/shared/libde265/de265_video_decoder.h',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_add.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_create.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_destroy.cc',
@@ -86,6 +116,8 @@
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait_timed.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wake_up.cc',
+      '<(DEPTH)/starboard/shared/libvpx/vpx_library_loader.cc',
+      '<(DEPTH)/starboard/shared/libvpx/vpx_library_loader.h',
       '<(DEPTH)/starboard/shared/libvpx/vpx_video_decoder.cc',
       '<(DEPTH)/starboard/shared/libvpx/vpx_video_decoder.h',
       '<(DEPTH)/starboard/shared/linux/byte_swap.cc',
@@ -122,6 +154,7 @@
       '<(DEPTH)/starboard/shared/posix/log_format.cc',
       '<(DEPTH)/starboard/shared/posix/log_is_tty.cc',
       '<(DEPTH)/starboard/shared/posix/log_raw.cc',
+      '<(DEPTH)/starboard/shared/posix/memory_flush.cc',
       '<(DEPTH)/starboard/shared/posix/set_non_blocking_internal.cc',
       '<(DEPTH)/starboard/shared/posix/socket_accept.cc',
       '<(DEPTH)/starboard/shared/posix/socket_bind.cc',
@@ -147,6 +180,7 @@
       '<(DEPTH)/starboard/shared/posix/socket_set_tcp_keep_alive.cc',
       '<(DEPTH)/starboard/shared/posix/socket_set_tcp_no_delay.cc',
       '<(DEPTH)/starboard/shared/posix/socket_set_tcp_window_scaling.cc',
+      '<(DEPTH)/starboard/shared/posix/storage_write_record.cc',
       '<(DEPTH)/starboard/shared/posix/string_compare_no_case.cc',
       '<(DEPTH)/starboard/shared/posix/string_compare_no_case_n.cc',
       '<(DEPTH)/starboard/shared/posix/string_compare_wide.cc',
@@ -176,6 +210,8 @@
       '<(DEPTH)/starboard/shared/pthread/mutex_destroy.cc',
       '<(DEPTH)/starboard/shared/pthread/mutex_release.cc',
       '<(DEPTH)/starboard/shared/pthread/once.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_context_get_pointer.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_context_internal.h',
       '<(DEPTH)/starboard/shared/pthread/thread_create.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_create_local_key.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_create_priority.h',
@@ -185,8 +221,19 @@
       '<(DEPTH)/starboard/shared/pthread/thread_get_local_value.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_is_equal.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_join.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_create.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_destroy.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_freeze.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_internal.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_internal.h',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_is_supported.cc',
+      '<(DEPTH)/starboard/shared/pthread/thread_sampler_thaw.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_set_local_value.cc',
       '<(DEPTH)/starboard/shared/pthread/thread_yield.cc',
+      '<(DEPTH)/starboard/shared/pulse/pulse_audio_sink_type.cc',
+      '<(DEPTH)/starboard/shared/pulse/pulse_audio_sink_type.h',
+      '<(DEPTH)/starboard/shared/pulse/pulse_dynamic_load_dispatcher.cc',
+      '<(DEPTH)/starboard/shared/pulse/pulse_dynamic_load_dispatcher.h',
       '<(DEPTH)/starboard/shared/signal/crash_signals.h',
       '<(DEPTH)/starboard/shared/signal/crash_signals_sigaction.cc',
       '<(DEPTH)/starboard/shared/signal/suspend_signals.cc',
@@ -194,8 +241,12 @@
       '<(DEPTH)/starboard/shared/starboard/application.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_create.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_destroy.cc',
+      '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_get_max_channels_5_1.cc',
+      '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_get_nearest_supported_sample_frequency.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.h',
+      '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_is_audio_frame_storage_type_supported_interleaved_only.cc',
+      '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_is_audio_sample_type_supported_float32_only.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_is_valid.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc',
       '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.h',
@@ -210,7 +261,6 @@
       '<(DEPTH)/starboard/shared/starboard/file_storage/storage_get_record_size.cc',
       '<(DEPTH)/starboard/shared/starboard/file_storage/storage_open_record.cc',
       '<(DEPTH)/starboard/shared/starboard/file_storage/storage_read_record.cc',
-      '<(DEPTH)/starboard/shared/starboard/file_storage/storage_write_record.cc',
       '<(DEPTH)/starboard/shared/starboard/log_message.cc',
       '<(DEPTH)/starboard/shared/starboard/log_mutex.cc',
       '<(DEPTH)/starboard/shared/starboard/log_mutex.h',
@@ -219,10 +269,21 @@
       '<(DEPTH)/starboard/shared/starboard/media/codec_util.cc',
       '<(DEPTH)/starboard/shared/starboard/media/codec_util.h',
       '<(DEPTH)/starboard/shared/starboard/media/media_can_play_mime_and_key_system.cc',
-      '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_configuration_stereo_only.cc',
-      '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_output_count_stereo_only.cc',
-      '<(DEPTH)/starboard/shared/starboard/media/media_is_audio_supported_aac_only.cc',
-      '<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_buffer_budget.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_configuration_5_1.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_output_count_single_audio_output.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_buffer_alignment.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_buffer_allocation_unit.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_buffer_garbage_collection_duration_threshold.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_buffer_padding.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_buffer_storage_type.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_initial_buffer_capacity.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_max_buffer_capacity.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_progressive_buffer_budget.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_get_video_buffer_budget.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_pool_allocate_on_demand.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_is_buffer_using_memory_pool.cc',
+      '<(DEPTH)/starboard/shared/starboard/media/media_is_transfer_characteristics_supported.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_util.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_util.h',
@@ -231,39 +292,6 @@
       '<(DEPTH)/starboard/shared/starboard/new.cc',
       '<(DEPTH)/starboard/shared/starboard/player/decoded_audio_internal.cc',
       '<(DEPTH)/starboard/shared/starboard/player/decoded_audio_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_decoder_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_frame_tracker.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_frame_tracker.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink_impl.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_sink_impl.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_resampler_impl.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_time_stretcher.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/audio_time_stretcher.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/cpu_video_frame.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/cpu_video_frame.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider_impl.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/media_time_provider_impl.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/player_components.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/punchout_video_renderer_sink.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/punchout_video_renderer_sink.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_decoder_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_frame_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm_impl.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_render_algorithm_impl.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_sink.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/wsola_internal.cc',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/wsola_internal.h',
       '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.cc',
       '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.h',
       '<(DEPTH)/starboard/shared/starboard/player/job_queue.cc',
@@ -274,10 +302,13 @@
       '<(DEPTH)/starboard/shared/starboard/player/player_destroy.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_get_current_frame.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_get_info.cc',
+      '<(DEPTH)/starboard/shared/starboard/player/player_get_info2.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_get_maximum_number_of_samples_per_write.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_internal.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_internal.h',
+      '<(DEPTH)/starboard/shared/starboard/player/player_output_mode_supported.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_seek.cc',
+      '<(DEPTH)/starboard/shared/starboard/player/player_seek2.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_set_bounds.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_set_playback_rate.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_set_volume.cc',
@@ -285,6 +316,7 @@
       '<(DEPTH)/starboard/shared/starboard/player/player_worker.h',
       '<(DEPTH)/starboard/shared/starboard/player/player_write_end_of_stream.cc',
       '<(DEPTH)/starboard/shared/starboard/player/player_write_sample.cc',
+      '<(DEPTH)/starboard/shared/starboard/player/player_write_sample2.cc',
       '<(DEPTH)/starboard/shared/starboard/queue_application.cc',
       '<(DEPTH)/starboard/shared/starboard/string_concat.cc',
       '<(DEPTH)/starboard/shared/starboard/string_concat_wide.cc',
@@ -296,6 +328,7 @@
       '<(DEPTH)/starboard/shared/starboard/system_request_stop.cc',
       '<(DEPTH)/starboard/shared/starboard/system_request_suspend.cc',
       '<(DEPTH)/starboard/shared/starboard/system_request_unpause.cc',
+      '<(DEPTH)/starboard/shared/starboard/system_supports_resume.cc',
       '<(DEPTH)/starboard/shared/starboard/window_set_default_options.cc',
       '<(DEPTH)/starboard/shared/stub/accessibility_get_display_settings.cc',
       '<(DEPTH)/starboard/shared/stub/accessibility_get_text_to_speech_settings.cc',
@@ -306,33 +339,34 @@
       '<(DEPTH)/starboard/shared/stub/cryptography_set_authenticated_data.cc',
       '<(DEPTH)/starboard/shared/stub/cryptography_set_initialization_vector.cc',
       '<(DEPTH)/starboard/shared/stub/cryptography_transform.cc',
-      '<(DEPTH)/starboard/shared/stub/drm_close_session.cc',
-      '<(DEPTH)/starboard/shared/stub/drm_create_system.cc',
-      '<(DEPTH)/starboard/shared/stub/drm_destroy_system.cc',
-      '<(DEPTH)/starboard/shared/stub/drm_generate_session_update_request.cc',
-      '<(DEPTH)/starboard/shared/stub/drm_system_internal.h',
-      '<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
+      '<(DEPTH)/starboard/shared/stub/system_get_extensions.cc',
       '<(DEPTH)/starboard/shared/stub/image_decode.cc',
       '<(DEPTH)/starboard/shared/stub/image_is_decode_supported.cc',
-      '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
-      '<(DEPTH)/starboard/shared/stub/media_is_transfer_characteristics_supported.cc',
-      '<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
+      '<(DEPTH)/starboard/shared/stub/media_set_audio_write_duration.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_close.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_create.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_destroy.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_get_available.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_is_sample_rate_supported.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_open.cc',
+      '<(DEPTH)/starboard/shared/stub/microphone_read.cc',
       '<(DEPTH)/starboard/shared/stub/system_get_total_gpu_memory.cc',
       '<(DEPTH)/starboard/shared/stub/system_get_used_gpu_memory.cc',
       '<(DEPTH)/starboard/shared/stub/system_hide_splash_screen.cc',
       '<(DEPTH)/starboard/shared/stub/system_raise_platform_error.cc',
-      '<(DEPTH)/starboard/shared/wayland/application_wayland.cc',
-      '<(DEPTH)/starboard/shared/wayland/application_wayland.h',
-      '<(DEPTH)/starboard/shared/wayland/dev_input.cc',
-      '<(DEPTH)/starboard/shared/wayland/dev_input.h',
-      '<(DEPTH)/starboard/shared/wayland/egl_workaround.cc',
-      '<(DEPTH)/starboard/shared/wayland/native_display_type.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_create.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_destroy.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_get_platform_handle.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_get_size.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_internal.cc',
-      '<(DEPTH)/starboard/shared/wayland/window_internal.h',
+      '<(DEPTH)/starboard/shared/stub/ui_nav_get_interface.cc',
+      '<(DEPTH)/starboard/shared/stub/window_get_diagonal_size_in_inches.cc',
+    ],
+    'starboard_platform_dependencies': [
+      '<(DEPTH)/starboard/common/common.gyp:common',
+      '<(DEPTH)/starboard/linux/shared/starboard_base_symbolize.gyp:starboard_base_symbolize',
+      '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg.gyp:ffmpeg_dynamic_load',
+      '<(DEPTH)/third_party/aom_includes/aom_includes.gyp:aom',
+      '<(DEPTH)/third_party/boringssl/boringssl.gyp:crypto',
+      '<(DEPTH)/third_party/de265_includes/de265_includes.gyp:de265',
+      '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc',
+      '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
+      '<(DEPTH)/third_party/pulseaudio_includes/pulseaudio_includes.gyp:pulseaudio',
     ],
     'conditions': [
       ['use_dlmalloc_allocator==1', {
@@ -342,7 +376,7 @@
           '<(DEPTH)/starboard/shared/dlmalloc/memory_free.cc',
           '<(DEPTH)/starboard/shared/dlmalloc/memory_free_aligned.cc',
           '<(DEPTH)/starboard/shared/dlmalloc/memory_reallocate_unchecked.cc',
-          '<(DEPTH)/starboard/shared/dlmalloc/system_get_used_cpu_memory.cc',
+          '<(DEPTH)/starboard/shared/linux/system_get_used_cpu_memory.cc',
         ],
       }, {
         'starboard_platform_sources': [
@@ -353,15 +387,52 @@
           '<(DEPTH)/starboard/shared/posix/memory_allocate_aligned_unchecked.cc',
           '<(DEPTH)/starboard/shared/posix/memory_free_aligned.cc',
         ],
-      }]
-    ],
-    'starboard_platform_dependencies': [
-      '<(DEPTH)/starboard/common/common.gyp:common',
-      '<(DEPTH)/starboard/linux/shared/starboard_base_symbolize.gyp:starboard_base_symbolize',
-      '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg.gyp:ffmpeg_linked',
-      '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc',
-      '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
-      '<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
+      }],
+      ['has_cdm==1', {
+        'starboard_platform_dependencies': [
+          '<(DEPTH)/starboard/shared/widevine/widevine3.gyp:oemcrypto',
+          '<(DEPTH)/starboard/shared/widevine/widevine3.gyp:widevine_ce_cdm_static',
+        ],
+        'starboard_platform_sources': [
+          '<(DEPTH)/starboard/linux/shared/drm_create_system.cc',
+          '<(DEPTH)/starboard/linux/shared/media_is_output_protected.cc',
+          '<(DEPTH)/starboard/linux/shared/oemcrypto_engine_device_properties_linux.cc',
+
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_close_session.cc',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_destroy_system.cc',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_generate_session_update_request.cc',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_is_server_certificate_updatable.cc',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_system_internal.h',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_update_server_certificate.cc',
+          '<(DEPTH)/starboard/shared/starboard/drm/drm_update_session.cc',
+
+          '<(DEPTH)/starboard/shared/widevine/drm_system_widevine.cc',
+          '<(DEPTH)/starboard/shared/widevine/drm_system_widevine.h',
+          '<(DEPTH)/starboard/shared/widevine/media_is_supported.cc',
+          '<(DEPTH)/starboard/shared/widevine/widevine_storage.cc',
+          '<(DEPTH)/starboard/shared/widevine/widevine_storage.h',
+          '<(DEPTH)/starboard/shared/widevine/widevine_timer.cc',
+          '<(DEPTH)/starboard/shared/widevine/widevine_timer.h',
+        ],
+      }, {
+        'starboard_platform_sources': [
+          '<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
+          '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_close_session.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_create_system.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_destroy_system.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_generate_session_update_request.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_is_server_certificate_updatable.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_system_internal.h',
+          '<(DEPTH)/starboard/shared/stub/drm_update_server_certificate.cc',
+          '<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
+        ],
+      }],
+      ['has_system_libvpx==0', {
+        'starboard_platform_dependencies': [
+          '<(DEPTH)/third_party/vpx_includes/vpx_includes.gyp:vpx',
+        ],
+      }],
     ],
   },
   'conditions': [
diff --git a/src/starboard/contrib/tizen/shared/system_get_path.cc b/src/starboard/contrib/tizen/shared/system_get_path.cc
index c45d1a3..c2ba82c 100644
--- a/src/starboard/contrib/tizen/shared/system_get_path.cc
+++ b/src/starboard/contrib/tizen/shared/system_get_path.cc
@@ -132,15 +132,6 @@
 
       SbDirectoryCreate(path);
       break;
-    case kSbSystemPathSourceDirectory:
-      if (!GetPackageDirectory(path, kPathSize)) {
-        return false;
-      }
-      if (SbStringConcat(path, "/content/dir_source_root", kPathSize) >=
-          kPathSize) {
-        return false;
-      }
-      break;
     case kSbSystemPathTempDirectory:
       if (SbStringCopy(path, "/tmp/cobalt", kPathSize) >= kPathSize) {
         return false;
diff --git a/src/starboard/linux/shared/compiler_flags.gypi b/src/starboard/linux/shared/compiler_flags.gypi
index f1fae58..ed98d05 100644
--- a/src/starboard/linux/shared/compiler_flags.gypi
+++ b/src/starboard/linux/shared/compiler_flags.gypi
@@ -32,14 +32,24 @@
     ],
     'compiler_flags_qa': [
       '-fno-rtti',
-      '-O2',
       '-gline-tables-only',
     ],
+    'compiler_flags_qa_size': [
+      '-Os',
+    ],
+    'compiler_flags_qa_speed': [
+      '-O2',
+    ],
     'compiler_flags_gold': [
       '-fno-rtti',
-      '-O2',
       '-gline-tables-only',
     ],
+    'compiler_flags_gold_size': [
+      '-Os',
+    ],
+    'compiler_flags_gold_speed': [
+      '-O2',
+    ],
     'conditions': [
       ['clang==1', {
         'linker_flags': [
diff --git a/src/starboard/linux/x64x11/clang/3.6/download_clang.sh b/src/starboard/linux/x64x11/clang/3.6/download_clang.sh
index 0117209..d83afe7 100755
--- a/src/starboard/linux/x64x11/clang/3.6/download_clang.sh
+++ b/src/starboard/linux/x64x11/clang/3.6/download_clang.sh
@@ -33,7 +33,8 @@
 
 build_duration="about 20 minutes"
 
-cd $(dirname $0)
+scriptfolder=$(dirname $(realpath $0))
+cd ${scriptfolder}
 source ../../toolchain_paths.sh
 
 (
@@ -51,6 +52,11 @@
   git clone --branch ${branch} https://git.llvm.org/git/compiler-rt.git/
   cd ${toolchain_path}
 
+  # Patch for compiling with gcc newer than version 7.
+  patch -p1 <${scriptfolder}/hasmd.patch
+  patch -p1 <${scriptfolder}/ustat_size.patch
+  patch -d llvm/projects/compiler-rt/ -p0 <${scriptfolder}/sigaltstack.patch
+
   cd llvm
   # Specify a bootstrap compiler that is known to be available.
   CC=gcc CXX=g++ \
diff --git a/src/starboard/linux/x64x11/clang/3.6/hasmd.patch b/src/starboard/linux/x64x11/clang/3.6/hasmd.patch
new file mode 100644
index 0000000..f4ddf53
--- /dev/null
+++ b/src/starboard/linux/x64x11/clang/3.6/hasmd.patch
@@ -0,0 +1,11 @@
+--- x86_64-linux-gnu-clang-3.6.orig/llvm/include/llvm/IR/ValueMap.h	2019-08-21 11:38:34.282434856 -0700
++++ x86_64-linux-gnu-clang-3.6/llvm/include/llvm/IR/ValueMap.h	2019-08-21 11:33:41.327987115 -0700
+@@ -101,7 +101,7 @@
+ 
+   ~ValueMap() {}
+ 
+-  bool hasMD() const { return MDMap; }
++  bool hasMD() const { return static_cast<bool>(MDMap); }
+   MDMapT &MD() {
+     if (!MDMap)
+       MDMap.reset(new MDMapT);
diff --git a/src/starboard/linux/x64x11/clang/3.6/sigaltstack.patch b/src/starboard/linux/x64x11/clang/3.6/sigaltstack.patch
new file mode 100644
index 0000000..d8ce752
--- /dev/null
+++ b/src/starboard/linux/x64x11/clang/3.6/sigaltstack.patch
@@ -0,0 +1,62 @@
+Index: lib/sanitizer_common/sanitizer_linux.h
+===================================================================
+--- lib/sanitizer_common/sanitizer_linux.h
++++ lib/sanitizer_common/sanitizer_linux.h
+@@ -21,7 +21,6 @@
+ #include "sanitizer_platform_limits_posix.h"
+ 
+ struct link_map;  // Opaque type returned by dlopen().
+-struct sigaltstack;
+ 
+ namespace __sanitizer {
+ // Dirent structure for getdents(). Note that this structure is different from
+@@ -30,8 +29,7 @@
+ 
+ // Syscall wrappers.
+ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
+-uptr internal_sigaltstack(const struct sigaltstack* ss,
+-                          struct sigaltstack* oss);
++uptr internal_sigaltstack(const void* ss, void* oss);
+ uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
+     __sanitizer_sigset_t *oldset);
+ 
+Index: lib/sanitizer_common/sanitizer_linux.cc
+===================================================================
+--- lib/sanitizer_common/sanitizer_linux.cc
++++ lib/sanitizer_common/sanitizer_linux.cc
+@@ -631,8 +631,7 @@
+ }
+ #endif
+ 
+-uptr internal_sigaltstack(const struct sigaltstack *ss,
+-                         struct sigaltstack *oss) {
++uptr internal_sigaltstack(const void *ss, void *oss) {
+   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
+ }
+ 
+Index: lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+===================================================================
+--- lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
++++ lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+@@ -287,7 +287,7 @@
+ 
+   // Alternate stack for signal handling.
+   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
+-  struct sigaltstack handler_stack;
++  stack_t handler_stack;
+   internal_memset(&handler_stack, 0, sizeof(handler_stack));
+   handler_stack.ss_sp = handler_stack_memory.data();
+   handler_stack.ss_size = kHandlerStackSize;
+Index: lib/tsan/rtl/tsan_platform_linux.cc
+===================================================================
+--- lib/tsan/rtl/tsan_platform_linux.cc
++++ lib/tsan/rtl/tsan_platform_linux.cc
+@@ -288,7 +288,7 @@
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   int cnt = 0;
+-  __res_state *statp = (__res_state*)state;
++  struct __res_state *statp = (struct __res_state*)state;
+   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
+       fds[cnt++] = statp->_u._ext.nssocks[i];
diff --git a/src/starboard/linux/x64x11/clang/3.6/ustat_size.patch b/src/starboard/linux/x64x11/clang/3.6/ustat_size.patch
new file mode 100644
index 0000000..e2c7f23
--- /dev/null
+++ b/src/starboard/linux/x64x11/clang/3.6/ustat_size.patch
@@ -0,0 +1,31 @@
+--- x86_64-linux-gnu-clang-3.6.orig/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc     2019-08-21 11:38:34.282434856 -0700
++++ x86_64-linux-gnu-clang-3.6/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc  2019-08-21 11:33:41.327987115 -0700
+@@ -159,7 +159,6 @@
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -251,7 +251,19 @@
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++// Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++// has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
diff --git a/src/starboard/raspi/shared/gyp_configuration.gypi b/src/starboard/raspi/shared/gyp_configuration.gypi
index 4749467..f680796 100644
--- a/src/starboard/raspi/shared/gyp_configuration.gypi
+++ b/src/starboard/raspi/shared/gyp_configuration.gypi
@@ -95,16 +95,26 @@
       '-frtti',
     ],
     'compiler_flags_qa': [
-      '-O2',
       '-Wno-unused-but-set-variable',
     ],
+    'compiler_flags_qa_size': [
+      '-Os',
+    ],
+    'compiler_flags_qa_speed': [
+      '-O2',
+    ],
     'compiler_flags_cc_qa': [
       '-fno-rtti',
     ],
     'compiler_flags_gold': [
-      '-O2',
       '-Wno-unused-but-set-variable',
     ],
+    'compiler_flags_gold_size': [
+      '-Os',
+    ],
+    'compiler_flags_gold_speed': [
+      '-O2',
+    ],
     'compiler_flags_cc_gold': [
       '-fno-rtti',
     ],
diff --git a/src/third_party/mozjs-45/mozjs-45.gyp b/src/third_party/mozjs-45/mozjs-45.gyp
index 1b53555..13d5e4e 100644
--- a/src/third_party/mozjs-45/mozjs-45.gyp
+++ b/src/third_party/mozjs-45/mozjs-45.gyp
@@ -17,6 +17,7 @@
   ],
   'variables': {
     'generated_include_directory': '<(SHARED_INTERMEDIATE_DIR)/mozjs-45/include',
+    'optimize_target_for_speed': 1,
 
     'common_cflags': [
       '-include',