diff --git a/DEPS b/DEPS
index c1cba3b..4b63cd6f 100644
--- a/DEPS
+++ b/DEPS
@@ -39,7 +39,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': '0b2a18922146c6134515d42baf5935b71bba03c3',
+  'skia_revision': 'cb8d719d7a991ceb93ccc7dd1542bb0cd82437d6',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
@@ -187,7 +187,7 @@
     Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd',
 
   'src/third_party/libvpx_new/source/libvpx':
-   Var('chromium_git') + '/webm/libvpx.git' + '@' +  'eba14ddbe7e7b69803dab770ba25ae2ba75c65e2',
+   Var('chromium_git') + '/webm/libvpx.git' + '@' +  '9ecb99abf094bf73a74468b100f3a139a4e372dc',
 
   'src/third_party/ffmpeg':
    Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'b1b22ffc6a5c809c41cc27910e3e8b479c15d3a2',
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java
index 4dd877d..d85737e 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java
@@ -137,6 +137,8 @@
 
     @Feature({"AndroidWebView"})
     @SmallTest
+    // Run in single-process mode only. Blocked by software draws support crbug.com/545611.
+    @ParameterizedTest.Set
     public void testVisualStateCallbackWaitsForContentsToBeOnScreen() throws Throwable {
         // This test loads a page with a blue background color. It then waits for the DOM tree
         // in blink to contain the contents of the blue page (which happens when the onPageFinished
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index d23cc78..715c7af 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -474,6 +474,11 @@
       system_bubble_->bubble()->FocusDefaultIfNeeded();
     }
   } else {
+    // Cleanup the existing bubble before showing a new one. Otherwise, it's
+    // possible to confuse the new system bubble with the old one during
+    // destruction, leading to subtle errors/crashes such as crbug.com/545166.
+    DestroySystemBubble();
+
     // Remember if the menu is a single property (like e.g. volume) or the
     // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case
     // above, |full_system_tray_menu_| does not get changed since the fact that
@@ -507,6 +512,7 @@
     if (items.size() == 1 && items[0]->ShouldHideArrow())
       init_params.arrow_paint_type = views::BubbleBorder::PAINT_TRANSPARENT;
     SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type);
+
     system_bubble_.reset(new SystemBubbleWrapper(bubble));
     system_bubble_->InitView(this, tray_container(), &init_params, persistent);
   }
diff --git a/base/base.gypi b/base/base.gypi
index 04fa6c1..bdaf4c78 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -477,6 +477,7 @@
           'process/memory_linux.cc',
           'process/memory_mac.mm',
           'process/memory_win.cc',
+          'process/port_provider_mac.cc',
           'process/port_provider_mac.h',
           'process/process.h',
           'process/process_handle.cc',
diff --git a/base/process/BUILD.gn b/base/process/BUILD.gn
index 8c7cc8a..63d65cd 100644
--- a/base/process/BUILD.gn
+++ b/base/process/BUILD.gn
@@ -24,6 +24,7 @@
     "memory_linux.cc",
     "memory_mac.mm",
     "memory_win.cc",
+    "port_provider_mac.cc",
     "port_provider_mac.h",
     "process.h",
     "process_handle.cc",
diff --git a/base/process/port_provider_mac.cc b/base/process/port_provider_mac.cc
new file mode 100644
index 0000000..ac13949a
--- /dev/null
+++ b/base/process/port_provider_mac.cc
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/process/port_provider_mac.h"
+
+namespace base {
+
+PortProvider::PortProvider() : lock_(), observer_list_() {}
+PortProvider::~PortProvider() {}
+
+void PortProvider::AddObserver(Observer* observer) {
+  base::AutoLock l(lock_);
+  observer_list_.AddObserver(observer);
+}
+
+void PortProvider::RemoveObserver(Observer* observer) {
+  base::AutoLock l(lock_);
+  observer_list_.RemoveObserver(observer);
+}
+
+void PortProvider::NotifyObservers(ProcessHandle process) {
+  base::AutoLock l(lock_);
+  FOR_EACH_OBSERVER(Observer, observer_list_, OnReceivedTaskPort(process));
+}
+
+}  // namespace base
diff --git a/base/process/port_provider_mac.h b/base/process/port_provider_mac.h
index bdee4a8a..2f40297 100644
--- a/base/process/port_provider_mac.h
+++ b/base/process/port_provider_mac.h
@@ -8,7 +8,10 @@
 #include <mach/mach.h>
 
 #include "base/base_export.h"
+#include "base/macros.h"
+#include "base/observer_list.h"
 #include "base/process/process_handle.h"
+#include "base/synchronization/lock.h"
 
 namespace base {
 
@@ -17,11 +20,40 @@
 // privileges.
 class BASE_EXPORT PortProvider {
  public:
-  virtual ~PortProvider() {}
+  PortProvider();
+  virtual ~PortProvider();
+
+  class Observer {
+   public:
+    virtual ~Observer() {};
+    // Called by the PortProvider to notify observers that the task port was
+    // received for a given process.
+    // No guarantees are made about the thread on which this notification will
+    // be sent.
+    // Observers must not call AddObserver() or RemoveObserver() in this
+    // callback, as doing so will deadlock.
+    virtual void OnReceivedTaskPort(ProcessHandle process) = 0;
+  };
 
   // Returns the mach task port for |process| if possible, or else
   // |MACH_PORT_NULL|.
   virtual mach_port_t TaskForPid(ProcessHandle process) const = 0;
+
+  // Observer interface.
+  void AddObserver(Observer* observer);
+  void RemoveObserver(Observer* observer);
+
+ protected:
+  // Called by subclasses to send a notification to observers.
+  void NotifyObservers(ProcessHandle process);
+
+ private:
+  // ObserverList is not thread-safe, so |lock_| ensures consistency of
+  // |observer_list_|.
+  base::Lock lock_;
+  base::ObserverList<Observer> observer_list_;
+
+  DISALLOW_COPY_AND_ASSIGN(PortProvider);
 };
 
 }  // namespace base
diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc
index e486339..6d99383 100644
--- a/base/process/process_metrics.cc
+++ b/base/process/process_metrics.cc
@@ -43,6 +43,14 @@
   return res.Pass();
 }
 
+ProcessMetrics* ProcessMetrics::CreateCurrentProcessMetrics() {
+#if !defined(OS_MACOSX) || defined(OS_IOS)
+  return CreateProcessMetrics(base::GetCurrentProcessHandle());
+#else
+  return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr);
+#endif  // !defined(OS_MACOSX) || defined(OS_IOS)
+}
+
 double ProcessMetrics::GetPlatformIndependentCPUUsage() {
 #if defined(OS_WIN)
   return GetCPUUsage() * processor_count_;
diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h
index 327483a42..40c9644 100644
--- a/base/process/process_metrics.h
+++ b/base/process/process_metrics.h
@@ -90,8 +90,9 @@
 BASE_EXPORT int64 TimeValToMicroseconds(const struct timeval& tv);
 
 // Provides performance metrics for a specified process (CPU usage, memory and
-// IO counters). To use it, invoke CreateProcessMetrics() to get an instance
-// for a specific process, then access the information with the different get
+// IO counters). Use CreateCurrentProcessMetrics() to get an instance for the
+// current process, or CreateProcessMetrics() to get an instance for an
+// arbitrary process. Then, access the information with the different get
 // methods.
 class BASE_EXPORT ProcessMetrics {
  public:
@@ -110,6 +111,11 @@
                                               PortProvider* port_provider);
 #endif  // !defined(OS_MACOSX) || defined(OS_IOS)
 
+  // Creates a ProcessMetrics for the current process. This a cross-platform
+  // convenience wrapper for CreateProcessMetrics().
+  // The caller owns the returned object.
+  static ProcessMetrics* CreateCurrentProcessMetrics();
+
   // Returns the current space allocated for the pagefile, in bytes (these pages
   // may or may not be in memory).  On Linux, this returns the total virtual
   // memory size.
diff --git a/base/trace_event/etw_manifest/BUILD.gn b/base/trace_event/etw_manifest/BUILD.gn
index f62e356..ed83aab 100644
--- a/base/trace_event/etw_manifest/BUILD.gn
+++ b/base/trace_event/etw_manifest/BUILD.gn
@@ -2,47 +2,19 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//build/win/message_compiler.gni")
+
 assert(is_win, "This only runs on Windows.")
 
-# Makes the .h/.rc files from the .man file.
-action("chrome_events_win_generate") {
-  visibility = [ ":*" ]
-  script = "build/message_compiler.py"
-
-  sources = [
-    "chrome_events_win.man",
-  ]
-
-  outputs = [
-    "$target_gen_dir/chrome_events_win.h",
-    "$target_gen_dir/chrome_events_win.rc",
-  ]
-
-  args = [
-    # Where to put the header.
-    "-h",
-    rebase_path("$target_gen_dir", root_build_dir),
-
-    # Where to put the .rc file.
-    "-r",
-    rebase_path("$target_gen_dir", root_build_dir),
-
-    # Generate the user-mode code.
-    "-um",
-    rebase_path("chrome_events_win.man", root_build_dir),
-  ]
-}
-
-# Compile the generated files.
-source_set("chrome_events_win") {
+message_compiler("chrome_events_win") {
   visibility = [
     "//base/trace_event/*",
     "//chrome:main_dll",
   ]
 
-  sources = get_target_outputs(":chrome_events_win_generate")
-
-  deps = [
-    ":chrome_events_win_generate",
+  sources = [
+    "chrome_events_win.man",
   ]
+
+  user_mode_logging = true
 }
diff --git a/base/trace_event/etw_manifest/BUILD/message_compiler.py b/base/trace_event/etw_manifest/BUILD/message_compiler.py
deleted file mode 100644
index be5927d..0000000
--- a/base/trace_event/etw_manifest/BUILD/message_compiler.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Runs the Microsoft Message Compiler (mc.exe). This Python adapter is for the
-# GN build, which can only run Python and not native binaries.
-
-import subprocess
-import sys
-
-# mc writes to stderr, so this explicily redirects to stdout and eats it.
-try:
-  subprocess.check_output(["mc.exe"] + sys.argv[1:], stderr=subprocess.STDOUT)
-except subprocess.CalledProcessError as e:
-  print e.output
-  sys.exit(e.returncode)
diff --git a/base/trace_event/process_memory_totals_dump_provider.cc b/base/trace_event/process_memory_totals_dump_provider.cc
index c057deb..83015f8 100644
--- a/base/trace_event/process_memory_totals_dump_provider.cc
+++ b/base/trace_event/process_memory_totals_dump_provider.cc
@@ -25,17 +25,6 @@
 // static
 uint64 ProcessMemoryTotalsDumpProvider::rss_bytes_for_testing = 0;
 
-namespace {
-
-ProcessMetrics* CreateProcessMetricsForCurrentProcess() {
-#if !defined(OS_MACOSX) || defined(OS_IOS)
-  return ProcessMetrics::CreateProcessMetrics(GetCurrentProcessHandle());
-#else
-  return ProcessMetrics::CreateProcessMetrics(GetCurrentProcessHandle(), NULL);
-#endif
-}
-}  // namespace
-
 // static
 ProcessMemoryTotalsDumpProvider*
 ProcessMemoryTotalsDumpProvider::GetInstance() {
@@ -45,8 +34,7 @@
 }
 
 ProcessMemoryTotalsDumpProvider::ProcessMemoryTotalsDumpProvider()
-    : process_metrics_(CreateProcessMetricsForCurrentProcess()) {
-}
+    : process_metrics_(ProcessMetrics::CreateCurrentProcessMetrics()) {}
 
 ProcessMemoryTotalsDumpProvider::~ProcessMemoryTotalsDumpProvider() {
 }
diff --git a/blimp/client/BUILD.gn b/blimp/client/BUILD.gn
index 77ae98d..e630200b 100644
--- a/blimp/client/BUILD.gn
+++ b/blimp/client/BUILD.gn
@@ -30,12 +30,14 @@
   deps = [
     "//base",
     "//blimp/common:blimp_common",
+    "//blimp/common/proto",
     "//cc",
     "//gpu/command_buffer/client:gl_in_process_context",
     "//gpu/command_buffer/common:gles2_utils",
     "//gpu/skia_bindings",
     "//ui/gfx/geometry",
     "//ui/gl",
+    "//url:url",
   ]
 
   if (is_android) {
@@ -46,6 +48,8 @@
       "android/blimp_library_loader.h",
       "android/blimp_view.cc",
       "android/blimp_view.h",
+      "android/toolbar.cc",
+      "android/toolbar.h",
       "compositor/blimp_compositor_android.cc",
       "compositor/blimp_compositor_android.h",
     ]
@@ -80,6 +84,7 @@
     sources = [
       "android/java/src/org/chromium/blimp/BlimpLibraryLoader.java",
       "android/java/src/org/chromium/blimp/BlimpView.java",
+      "android/java/src/org/chromium/blimp/toolbar/Toolbar.java",
     ]
 
     jni_package = "blimp"
@@ -162,6 +167,8 @@
       "android/java/src/org/chromium/blimp/BlimpLibraryLoader.java",
       "android/java/src/org/chromium/blimp/BlimpRendererActivity.java",
       "android/java/src/org/chromium/blimp/BlimpView.java",
+      "android/java/src/org/chromium/blimp/toolbar/Toolbar.java",
+      "android/java/src/org/chromium/blimp/toolbar/UrlBar.java",
     ]
   }
 
diff --git a/blimp/client/DEPS b/blimp/client/DEPS
index dc443c4..fd78a68 100644
--- a/blimp/client/DEPS
+++ b/blimp/client/DEPS
@@ -10,6 +10,7 @@
   "+third_party/skia",
   "+ui/gfx",
   "+ui/gl",
+  "+url",
 
   # TODO(dtrainor): Remove this once Toast uses are removed from Java.
   "!ui/android",
diff --git a/blimp/client/android/blimp_jni_registrar.cc b/blimp/client/android/blimp_jni_registrar.cc
index 9bc8096f..0bdd121 100644
--- a/blimp/client/android/blimp_jni_registrar.cc
+++ b/blimp/client/android/blimp_jni_registrar.cc
@@ -7,11 +7,13 @@
 #include "base/android/jni_registrar.h"
 #include "blimp/client/android/blimp_library_loader.h"
 #include "blimp/client/android/blimp_view.h"
+#include "blimp/client/android/toolbar.h"
 
 namespace {
 
 base::android::RegistrationMethod kBlimpRegistrationMethods[] = {
     {"BlimpLibraryLoader", blimp::RegisterBlimpLibraryLoaderJni},
+    {"Toolbar", blimp::Toolbar::RegisterJni},
     {"BlimpView", blimp::BlimpView::RegisterJni},
 };
 
diff --git a/blimp/client/android/java/res/drawable-hdpi/btn_reload.png b/blimp/client/android/java/res/drawable-hdpi/btn_reload.png
new file mode 100644
index 0000000..12a3ef8
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-hdpi/btn_reload.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-hdpi/textbox.9.png b/blimp/client/android/java/res/drawable-hdpi/textbox.9.png
new file mode 100644
index 0000000..994e5a5
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-hdpi/textbox.9.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-mdpi/btn_reload.png b/blimp/client/android/java/res/drawable-mdpi/btn_reload.png
new file mode 100644
index 0000000..d79c3a5
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-mdpi/btn_reload.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-mdpi/textbox.9.png b/blimp/client/android/java/res/drawable-mdpi/textbox.9.png
new file mode 100644
index 0000000..a015e50
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-mdpi/textbox.9.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xhdpi/btn_reload.png b/blimp/client/android/java/res/drawable-xhdpi/btn_reload.png
new file mode 100644
index 0000000..7e92fed7
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xhdpi/btn_reload.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xhdpi/textbox.9.png b/blimp/client/android/java/res/drawable-xhdpi/textbox.9.png
new file mode 100644
index 0000000..016d897
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xhdpi/textbox.9.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xxhdpi/btn_reload.png b/blimp/client/android/java/res/drawable-xxhdpi/btn_reload.png
new file mode 100644
index 0000000..de414bf
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xxhdpi/btn_reload.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xxhdpi/textbox.9.png b/blimp/client/android/java/res/drawable-xxhdpi/textbox.9.png
new file mode 100644
index 0000000..c2cbd05
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xxhdpi/textbox.9.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xxxhdpi/btn_reload.png b/blimp/client/android/java/res/drawable-xxxhdpi/btn_reload.png
new file mode 100644
index 0000000..a50297f
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xxxhdpi/btn_reload.png
Binary files differ
diff --git a/blimp/client/android/java/res/drawable-xxxhdpi/textbox.9.png b/blimp/client/android/java/res/drawable-xxxhdpi/textbox.9.png
new file mode 100644
index 0000000..02d5fb8e
--- /dev/null
+++ b/blimp/client/android/java/res/drawable-xxxhdpi/textbox.9.png
Binary files differ
diff --git a/blimp/client/android/java/res/layout/blimp_main.xml b/blimp/client/android/java/res/layout/blimp_main.xml
index bf5083cc..a019db2 100644
--- a/blimp/client/android/java/res/layout/blimp_main.xml
+++ b/blimp/client/android/java/res/layout/blimp_main.xml
@@ -4,8 +4,43 @@
      found in the LICENSE file. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
-    <org.chromium.blimp.BlimpView
-        android:id="@+id/renderer"
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+        <!-- Toolbar -->
+        <org.chromium.blimp.toolbar.Toolbar
+            android:id="@+id/toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="56dp"
+            android:paddingStart="5dp"
+            android:orientation="horizontal"
+            android:gravity="center"
+            android:background="#f2f2f2">
+            <org.chromium.blimp.toolbar.UrlBar
+                android:id="@+id/toolbar_url_bar"
+                android:layout_width="0dp"
+                android:layout_height="48dp"
+                android:layout_weight="1"
+                android:paddingStart="10dp"
+                android:paddingEnd="10dp"
+                android:singleLine="true"
+                android:maxLines="1"
+                android:background="@drawable/textbox"
+                android:textColor="#333" />
+            <ImageButton
+                android:id="@+id/toolbar_reload_btn"
+                android:layout_width="48dp"
+                android:layout_height="56dp"
+                android:background="?android:attr/selectableItemBackground"
+                android:scaleType="center"
+                android:src="@drawable/btn_reload" />
+        </org.chromium.blimp.toolbar.Toolbar>
+        
+        <!-- Content Area -->
+        <org.chromium.blimp.BlimpView
+            android:id="@+id/renderer"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    </LinearLayout>
 </merge>
\ No newline at end of file
diff --git a/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
index f032717..da2501104 100644
--- a/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
+++ b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
@@ -13,6 +13,7 @@
 import org.chromium.blimp.auth.RetryingTokenSource;
 import org.chromium.blimp.auth.TokenSource;
 import org.chromium.blimp.auth.TokenSourceImpl;
+import org.chromium.blimp.toolbar.Toolbar;
 import org.chromium.ui.widget.Toast;
 
 /**
@@ -26,6 +27,7 @@
     private static final String TAG = "Blimp";
     private TokenSource mTokenSource;
     private BlimpView mBlimpView;
+    private Toolbar mToolbar;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -51,6 +53,11 @@
             mBlimpView = null;
         }
 
+        if (mToolbar != null) {
+            mToolbar.destroy();
+            mToolbar = null;
+        }
+
         if (mTokenSource != null) {
             mTokenSource.destroy();
             mTokenSource = null;
@@ -73,6 +80,15 @@
         }
     }
 
+    @Override
+    public void onBackPressed() {
+        // Check if the toolbar can handle the back navigation.
+        if (mToolbar != null && mToolbar.onBackPressed()) return;
+
+        // If not, use the default Activity behavior.
+        super.onBackPressed();
+    }
+
     // BlimpLibraryLoader.Callback implementation.
     @Override
     public void onStartupComplete(boolean success) {
@@ -83,8 +99,12 @@
         }
 
         setContentView(R.layout.blimp_main);
+
         mBlimpView = (BlimpView) findViewById(R.id.renderer);
         mBlimpView.initializeRenderer();
+
+        mToolbar = (Toolbar) findViewById(R.id.toolbar);
+        mToolbar.initialize();
     }
 
     // TokenSource.Callback implementation.
diff --git a/blimp/client/android/java/src/org/chromium/blimp/BlimpView.java b/blimp/client/android/java/src/org/chromium/blimp/BlimpView.java
index 191b415d..a902680 100644
--- a/blimp/client/android/java/src/org/chromium/blimp/BlimpView.java
+++ b/blimp/client/android/java/src/org/chromium/blimp/BlimpView.java
@@ -30,6 +30,8 @@
      */
     public BlimpView(Context context, AttributeSet attrs) {
         super(context, attrs);
+        setFocusable(true);
+        setFocusableInTouchMode(true);
     }
 
     /**
diff --git a/blimp/client/android/java/src/org/chromium/blimp/toolbar/Toolbar.java b/blimp/client/android/java/src/org/chromium/blimp/toolbar/Toolbar.java
new file mode 100644
index 0000000..ca82caa0
--- /dev/null
+++ b/blimp/client/android/java/src/org/chromium/blimp/toolbar/Toolbar.java
@@ -0,0 +1,137 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.blimp.toolbar;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+
+import org.chromium.blimp.R;
+
+/**
+ * A {@link View} that visually represents the Blimp toolbar, which lets users issue navigation
+ * commands and displays relevant navigation UI.
+ */
+@JNINamespace("blimp")
+public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver,
+        View.OnClickListener {
+    private long mNativeToolbarPtr;
+
+    private UrlBar mUrlBar;
+    private ImageButton mReloadButton;
+
+    /**
+     * A URL to load when this object is initialized.  This handles the case where there is a URL
+     * to load before native is ready to receive any URL.
+     * */
+    private String mUrlToLoad;
+
+    /**
+     * Builds a new {@link Toolbar}.
+     * @param context A {@link Context} instance.
+     * @param attrs   An {@link AttributeSet} instance.
+     */
+    public Toolbar(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    /**
+     * To be called when the native library is loaded so that this class can initialize its native
+     * components.
+     */
+    public void initialize() {
+        assert mNativeToolbarPtr == 0;
+
+        mNativeToolbarPtr = nativeInit();
+        sendUrlTextInternal(mUrlToLoad);
+    }
+
+    /**
+     * To be called when this class should be torn down.  This {@link View} should not be used after
+     * this.
+     */
+    public void destroy() {
+        if (mNativeToolbarPtr != 0) {
+            nativeDestroy(mNativeToolbarPtr);
+            mNativeToolbarPtr = 0;
+        }
+    }
+
+    /**
+     * Loads {@code text} as if it had been typed by the user.  Useful for specifically loading
+     * startup URLs or testing.
+     * @param text The URL or text to load.
+     */
+    public void loadUrl(String text) {
+        mUrlBar.setText(text);
+        sendUrlTextInternal(text);
+    }
+
+    /**
+     * To be called when the user triggers a back navigation action.
+     * @return Whether or not the back event was consumed.
+     */
+    public boolean onBackPressed() {
+        if (mNativeToolbarPtr == 0) return false;
+        return nativeOnBackPressed(mNativeToolbarPtr);
+    }
+
+    // View overrides.
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+
+        mUrlBar = (UrlBar) findViewById(R.id.toolbar_url_bar);
+        mUrlBar.addUrlBarObserver(this);
+
+        mReloadButton = (ImageButton) findViewById(R.id.toolbar_reload_btn);
+        mReloadButton.setOnClickListener(this);
+    }
+
+    // UrlBar.UrlBarObserver interface.
+    @Override
+    public void onNewTextEntered(String text) {
+        sendUrlTextInternal(text);
+    }
+
+    // View.OnClickListener interface.
+    @Override
+    public void onClick(View view) {
+        if (mNativeToolbarPtr == 0) return;
+        if (view == mReloadButton) nativeOnReloadPressed(mNativeToolbarPtr);
+    }
+
+    private void sendUrlTextInternal(String text) {
+        mUrlToLoad = null;
+        if (TextUtils.isEmpty(text)) return;
+
+        if (mNativeToolbarPtr == 0) {
+            mUrlToLoad = text;
+            return;
+        }
+
+        nativeOnUrlTextEntered(mNativeToolbarPtr, text);
+    }
+
+    // Methods that are called by native via JNI.
+    @CalledByNative
+    private void onNavigationStateChanged(String url, Bitmap favicon, String title) {
+        if (url != null) mUrlBar.setText(url);
+        // TODO(dtrainor): Add a UI for favicon and title data and tie it in here.
+    }
+
+    private native long nativeInit();
+    private native void nativeDestroy(long nativeToolbar);
+    private native void nativeOnUrlTextEntered(long nativeToolbar, String text);
+    private native void nativeOnReloadPressed(long nativeToolbar);
+    private native boolean nativeOnBackPressed(long nativeToolbar);
+}
diff --git a/blimp/client/android/java/src/org/chromium/blimp/toolbar/UrlBar.java b/blimp/client/android/java/src/org/chromium/blimp/toolbar/UrlBar.java
new file mode 100644
index 0000000..55d44fa
--- /dev/null
+++ b/blimp/client/android/java/src/org/chromium/blimp/toolbar/UrlBar.java
@@ -0,0 +1,81 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.blimp.toolbar;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnKeyListener;
+import android.widget.EditText;
+
+import org.chromium.base.ObserverList;
+import org.chromium.ui.UiUtils;
+
+/**
+ * A {@link View} that allows users to enter text and URLs.
+ */
+public class UrlBar extends EditText implements OnKeyListener {
+    /**
+     * An observer that gets notified of relevant URL bar text changes.
+     */
+    public interface UrlBarObserver {
+        /**
+         * Will be called when the user presses enter after typing something into this
+         * {@link EditText}.
+         * @param text The new text the user entered.
+         */
+        void onNewTextEntered(String text);
+    }
+
+    private final ObserverList<UrlBarObserver> mObservers = new ObserverList<UrlBarObserver>();
+
+    /**
+     * Builds a new {@link UrlBar}.
+     * @param context A {@link Context} instance.
+     * @param attrs   An {@link AttributeSet} instance.
+     */
+    public UrlBar(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        setOnKeyListener(this);
+    }
+
+    /**
+     * @return The current text of this {@link EditText}.  Guaranteed to be not {@code null}.
+     */
+    public String getQueryText() {
+        return getEditableText() == null ? "" : getEditableText().toString();
+    }
+
+    /**
+     * @param observer An {@link UrlBarObserver} that will be notified of future text entries.
+     */
+    public void addUrlBarObserver(UrlBarObserver observer) {
+        mObservers.addObserver(observer);
+    }
+
+    /**
+     * @param observer An {@link UrlBarObserver} that will no longer be notified of future text
+     *                 entries.
+     */
+    public void removeUrlBarObserver(UrlBarObserver observer) {
+        mObservers.removeObserver(observer);
+    }
+
+    // OnKeyListener interface.
+    @Override
+    public boolean onKey(View view, int keyCode, KeyEvent event) {
+        if (event.getAction() == KeyEvent.ACTION_UP
+                && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER
+                || event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_ENTER)) {
+            UiUtils.hideKeyboard(view);
+            clearFocus();
+            for (UrlBarObserver observer : mObservers) {
+                observer.onNewTextEntered(getQueryText());
+            }
+        }
+        return false;
+    }
+}
diff --git a/blimp/client/android/toolbar.cc b/blimp/client/android/toolbar.cc
new file mode 100644
index 0000000..b15b9e2
--- /dev/null
+++ b/blimp/client/android/toolbar.cc
@@ -0,0 +1,76 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/android/toolbar.h"
+
+#include "base/android/jni_string.h"
+#include "jni/Toolbar_jni.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/android/java_bitmap.h"
+#include "url/gurl.h"
+
+namespace blimp {
+
+// static
+static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
+  return reinterpret_cast<intptr_t>(new Toolbar(env, jobj));
+}
+
+// static
+bool Toolbar::RegisterJni(JNIEnv* env) {
+  return RegisterNativesImpl(env);
+}
+
+Toolbar::Toolbar(JNIEnv* env,
+                 const base::android::JavaParamRef<jobject>& jobj) {
+  java_obj_.Reset(env, jobj);
+}
+
+Toolbar::~Toolbar() {}
+
+void Toolbar::Destroy(JNIEnv* env, jobject jobj) {
+  delete this;
+}
+
+void Toolbar::OnUrlTextEntered(JNIEnv* env, jobject jobj, jstring text) {
+  // TODO(dtrainor): Notify the content lite NavigationController.
+}
+
+void Toolbar::OnReloadPressed(JNIEnv* env, jobject jobj) {
+  // TODO(dtrainor): Notify the content lite NavigationController.
+}
+
+jboolean Toolbar::OnBackPressed(JNIEnv* env, jobject jobj) {
+  // TODO(dtrainor): Notify the content lite NavigationController.
+  // TODO(dtrainor): Find a way to determine whether or not we're at the end of
+  // our history stack.
+  return true;
+}
+
+void Toolbar::OnNavigationStateChanged(const GURL* url,
+                                       const SkBitmap* favicon,
+                                       const std::string* title) {
+  JNIEnv* env = base::android::AttachCurrentThread();
+
+  ScopedJavaLocalRef<jstring> jurl;
+  ScopedJavaLocalRef<jobject> jfavicon;
+  ScopedJavaLocalRef<jstring> jtitle;
+
+  if (url)
+    jurl = base::android::ConvertUTF8ToJavaString(env, url->spec());
+
+  if (favicon)
+    jfavicon = gfx::ConvertToJavaBitmap(favicon);
+
+  if (title)
+    jtitle = base::android::ConvertUTF8ToJavaString(env, *title);
+
+  Java_Toolbar_onNavigationStateChanged(env,
+                                        java_obj_.obj(),
+                                        jurl.obj(),
+                                        jfavicon.obj(),
+                                        jtitle.obj());
+}
+
+}  // namespace blimp
diff --git a/blimp/client/android/toolbar.h b/blimp/client/android/toolbar.h
new file mode 100644
index 0000000..47f18ed
--- /dev/null
+++ b/blimp/client/android/toolbar.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_CLIENT_ANDROID_TOOLBAR_H_
+#define BLIMP_CLIENT_ANDROID_TOOLBAR_H_
+
+#include "base/android/jni_android.h"
+#include "base/macros.h"
+
+class GURL;
+class SkBitmap;
+
+namespace blimp {
+
+// The native component of org.chromium.blimp.toolbar.Toolbar.  This handles
+// marshalling calls between Java and native.  Specifically, this passes calls
+// between Toolbar.java <=> content_lite's NavigationController layer.
+class Toolbar {
+ public:
+  static bool RegisterJni(JNIEnv* env);
+
+  Toolbar(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
+
+  // Methods called from Java via JNI.
+  void Destroy(JNIEnv* env, jobject jobj);
+  void OnUrlTextEntered(JNIEnv* env, jobject jobj, jstring text);
+  void OnReloadPressed(JNIEnv* env, jobject jobj);
+  jboolean OnBackPressed(JNIEnv* env, jobject jobj);
+
+  // TODO(dtrainor): To be called by a the content lite NavigationController.
+  // Should probably be an overridden delegate method so the network code can be
+  // multi platform.
+  void OnNavigationStateChanged(const GURL* url,
+                                const SkBitmap* favicon,
+                                const std::string* title);
+
+ private:
+  virtual ~Toolbar();
+
+  // Reference to the Java object which owns this class.
+  base::android::ScopedJavaGlobalRef<jobject> java_obj_;
+
+  DISALLOW_COPY_AND_ASSIGN(Toolbar);
+};
+
+}  // namespace blimp
+
+#endif  // BLIMP_CLIENT_ANDROID_TOOLBAR_H_
diff --git a/blimp/common/proto/BUILD.gn b/blimp/common/proto/BUILD.gn
index ecaa29c7..5ca8283 100644
--- a/blimp/common/proto/BUILD.gn
+++ b/blimp/common/proto/BUILD.gn
@@ -6,17 +6,38 @@
 
 group("proto") {
   public_deps = [
-    ":proto_lib",
+    ":blimp_proto",
     "//third_party/protobuf:protobuf_lite",
   ]
 }
 
-proto_library("proto_lib") {
+component("blimp_proto") {
+  # Only expose the target to the "proto" group.
+  visibility = [ ":proto" ]
+
+  public_deps = [
+    ":proto_internal",
+  ]
+}
+
+proto_library("proto_internal") {
+  # Only expose the target to the "blimp_proto" target.
+  visibility = [ ":blimp_proto" ]
+
   sources = [
     "blimp_message.proto",
     "common.proto",
     "compositor.proto",
     "control.proto",
     "input.proto",
+    "navigation.proto",
   ]
+
+  cc_generator_options = "dllexport_decl=BLIMP_PROTO_EXPORT:"
+  cc_include = "blimp/common/proto/blimp_proto_export.h"
+
+  defines = [ "BLIMP_PROTO_IMPLEMENTATION" ]
+
+  # Warn if clang creates exit destructors
+  extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
 }
diff --git a/blimp/common/proto/blimp_message.proto b/blimp/common/proto/blimp_message.proto
index 553119d..e81c608 100644
--- a/blimp/common/proto/blimp_message.proto
+++ b/blimp/common/proto/blimp_message.proto
@@ -27,6 +27,7 @@
 import "control.proto";
 import "compositor.proto";
 import "input.proto";
+import "navigation.proto";
 
 package blimp;
 
@@ -35,6 +36,7 @@
     COMPOSITOR = 0;
     INPUT = 1;
     CONTROL = 2;
+    NAVIGATION = 3;
   }
   // Identifies the feature type of this message.
   // The feature-specific contents are contained in optional fields of the same
@@ -58,5 +60,6 @@
   optional CompositorMessage compositor = 1000;
   optional InputMessage input = 1001;
   optional ControlMessage control = 1002;
+  optional NavigationMessage navigation = 1003;
 }
 
diff --git a/blimp/common/proto/blimp_proto_export.h b/blimp/common/proto/blimp_proto_export.h
new file mode 100644
index 0000000..ac5f9be
--- /dev/null
+++ b/blimp/common/proto/blimp_proto_export.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_COMMON_PROTO_BLIMP_PROTO_EXPORT_H_
+#define BLIMP_COMMON_PROTO_BLIMP_PROTO_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(BLIMP_PROTO_IMPLEMENTATION)
+#define BLIMP_PROTO_EXPORT __declspec(dllexport)
+#else
+#define BLIMP_PROTO_EXPORT __declspec(dllimport)
+#endif  // defined(BLIMP_PROTO_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#if defined(BLIMP_PROTO_IMPLEMENTATION)
+#define BLIMP_PROTO_EXPORT __attribute__((visibility("default")))
+#else
+#define BLIMP_PROTO_EXPORT
+#endif  // defined(BLIMP_PROTO_IMPLEMENTATION)
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define BLIMP_PROTO_EXPORT
+#endif
+
+#endif  // BLIMP_COMMON_PROTO_BLIMP_PROTO_EXPORT_H_
diff --git a/blimp/common/proto/control.proto b/blimp/common/proto/control.proto
index fdc1c89..f01654b 100644
--- a/blimp/common/proto/control.proto
+++ b/blimp/common/proto/control.proto
@@ -8,21 +8,11 @@
 
 option optimize_for = LITE_RUNTIME;
 
-message LoadUrlMessage {
-  optional string url = 1;
-}
-
 message ControlMessage {
   enum Type {
     // Client <=> Server types.
     CREATE_TAB = 1;
     CLOSE_TAB = 2;
-    LOAD_URL = 3;
-
-    // Server => Client types.
-    // Client => Server types.
   }
   optional Type type = 1;
-
-  optional LoadUrlMessage load_url = 1000;
 }
diff --git a/blimp/common/proto/navigation.proto b/blimp/common/proto/navigation.proto
new file mode 100644
index 0000000..564e1a482
--- /dev/null
+++ b/blimp/common/proto/navigation.proto
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Message definitions for browser navigation messages.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package blimp;
+
+message LoadUrlMessage {
+  // The text to generate and create a URL from.  This might be a URL or might
+  // not.  It might be text that should be turned into a search URL.
+  // Some example inputs:
+  // 1. google.com
+  // 2. www.wikipedia.org
+  // 3. dogs
+  optional string url = 1;
+}
+
+message NavigationStateChangeMessage {
+  // If the URL changed, this will include the new URL string.
+  optional string url = 1;
+
+  // If the favicon of the page changed, this should include the serialized
+  // bitmap of the favicon.
+  optional bytes favicon = 2;
+
+  // If the title changed, this will contain the new title string.
+  optional string title = 3;
+}
+
+message NavigationMessage {
+  enum Type {
+    // Server => Client types.
+    NAVIGATION_STATE_CHANGED = 1;
+
+    // Client => Server types.
+    LOAD_URL = 2;
+    GO_BACK = 3;
+    GO_FORWARD = 4;
+    RELOAD = 5;
+  }
+
+  optional Type type = 1;
+
+  optional NavigationStateChangeMessage navigation_state_change = 1000;
+  optional LoadUrlMessage load_url = 1001;
+}
diff --git a/blimp/engine/browser/blimp_browser_main_parts.cc b/blimp/engine/browser/blimp_browser_main_parts.cc
index 232d8120..8a8e533 100644
--- a/blimp/engine/browser/blimp_browser_main_parts.cc
+++ b/blimp/engine/browser/blimp_browser_main_parts.cc
@@ -46,8 +46,10 @@
   message.set_type(BlimpMessage::CONTROL);
   message.mutable_control()->set_type(ControlMessage::CREATE_TAB);
   engine_session_->OnBlimpMessage(message);
-  message.mutable_control()->set_type(ControlMessage::LOAD_URL);
-  message.mutable_control()->mutable_load_url()->set_url(
+  message.clear_control();
+  message.set_type(BlimpMessage::NAVIGATION);
+  message.mutable_navigation()->set_type(NavigationMessage::LOAD_URL);
+  message.mutable_navigation()->mutable_load_url()->set_url(
       "https://www.google.com/");
   engine_session_->OnBlimpMessage(message);
 }
diff --git a/blimp/engine/browser/blimp_engine_session.cc b/blimp/engine/browser/blimp_engine_session.cc
index 6ffd79da..47bf330 100644
--- a/blimp/engine/browser/blimp_engine_session.cc
+++ b/blimp/engine/browser/blimp_engine_session.cc
@@ -96,6 +96,11 @@
   PlatformSetContents(new_contents.Pass());
 }
 
+void BlimpEngineSession::CloseWebContents(const int target_tab_id) {
+  DCHECK(web_contents_);
+  web_contents_->Close();
+}
+
 void BlimpEngineSession::LoadUrl(const int target_tab_id, const GURL& url) {
   if (url.is_empty() || !web_contents_)
     return;
@@ -107,19 +112,59 @@
   web_contents_->Focus();
 }
 
-net::Error BlimpEngineSession::OnBlimpMessage(const BlimpMessage& message) {
-  DCHECK(message.type() == BlimpMessage::CONTROL);
+void BlimpEngineSession::GoBack(const int target_tab_id) {
+  if (!web_contents_)
+    return;
 
-  switch (message.control().type()) {
-    case ControlMessage::CREATE_TAB:
-      CreateWebContents(message.target_tab_id());
-      break;
-    case ControlMessage::LOAD_URL:
-      LoadUrl(message.target_tab_id(),
-              GURL(message.control().load_url().url()));
-      break;
-    default:
-      NOTIMPLEMENTED();
+  web_contents_->GetController().GoBack();
+}
+
+void BlimpEngineSession::GoForward(const int target_tab_id) {
+  if (!web_contents_)
+    return;
+
+  web_contents_->GetController().GoForward();
+}
+
+void BlimpEngineSession::Reload(const int target_tab_id) {
+  if (!web_contents_)
+    return;
+
+  web_contents_->GetController().Reload(true);
+}
+
+net::Error BlimpEngineSession::OnBlimpMessage(const BlimpMessage& message) {
+  DCHECK(message.type() == BlimpMessage::CONTROL ||
+         message.type() == BlimpMessage::NAVIGATION);
+
+  if (message.type() == BlimpMessage::CONTROL) {
+    switch (message.control().type()) {
+      case ControlMessage::CREATE_TAB:
+        CreateWebContents(message.target_tab_id());
+        break;
+      case ControlMessage::CLOSE_TAB:
+        CloseWebContents(message.target_tab_id());
+      default:
+        NOTIMPLEMENTED();
+    }
+  } else if (message.type() == BlimpMessage::NAVIGATION && web_contents_) {
+    switch (message.navigation().type()) {
+      case NavigationMessage::LOAD_URL:
+        LoadUrl(message.target_tab_id(),
+                GURL(message.navigation().load_url().url()));
+        break;
+      case NavigationMessage::GO_BACK:
+        GoBack(message.target_tab_id());
+        break;
+      case NavigationMessage::GO_FORWARD:
+        GoForward(message.target_tab_id());
+        break;
+      case NavigationMessage::RELOAD:
+        Reload(message.target_tab_id());
+        break;
+      default:
+        NOTIMPLEMENTED();
+    }
   }
 
   return net::OK;
diff --git a/blimp/engine/browser/blimp_engine_session.h b/blimp/engine/browser/blimp_engine_session.h
index 46b3039..054534c 100644
--- a/blimp/engine/browser/blimp_engine_session.h
+++ b/blimp/engine/browser/blimp_engine_session.h
@@ -57,11 +57,17 @@
   net::Error OnBlimpMessage(const BlimpMessage& message) override;
 
  private:
+  // ControlMessage handler methods.
   // Creates a new WebContents, which will be indexed by |target_tab_id|.
   void CreateWebContents(const int target_tab_id);
+  void CloseWebContents(const int target_tab_id);
 
+  // NavigationMessage handler methods.
   // Navigates the target tab to the |url|.
   void LoadUrl(const int target_tab_id, const GURL& url);
+  void GoBack(const int target_tab_id);
+  void GoForward(const int target_tab_id);
+  void Reload(const int target_tab_id);
 
   // content::WebContentsDelegate implementation.
   content::WebContents* OpenURLFromTab(
diff --git a/build/common.gypi b/build/common.gypi
index 67fc8e5..a253ce6 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -6089,8 +6089,8 @@
         ],
       },
     }],
-    # Apply a lower LTO optimization level in non-official builds.
-    ['use_lto==1 and clang==1 and buildtype!="Official"', {
+    # Apply a lower LTO optimization level as the default is too slow.
+    ['use_lto==1 and clang==1', {
       'target_defaults': {
         'target_conditions': [
           ['_toolset=="target"', {
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn
index eb7ba4ab..19d0a3ff 100644
--- a/build/config/sanitizers/BUILD.gn
+++ b/build/config/sanitizers/BUILD.gn
@@ -183,13 +183,11 @@
         "-fsanitize=cfi-unrelated-cast",
       ]
 
-      # Apply a lower LTO optimization level in non-official builds.
-      if (!is_official_build) {
-        if (is_linux) {
-          ldflags += [ "-Wl,-plugin-opt,O1" ]
-        } else if (is_mac) {
-          ldflags += [ "-Wl,-mllvm,-O1" ]
-        }
+      # Apply a lower LTO optimization level as the default is too slow.
+      if (is_linux) {
+        ldflags += [ "-Wl,-plugin-opt,O1" ]
+      } else if (is_mac) {
+        ldflags += [ "-Wl,-mllvm,-O1" ]
       }
 
       # Work-around for http://openradar.appspot.com/20356002
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
index c111289..38e8a517 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -24,8 +24,13 @@
 import subprocess
 import sys
 
-
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+sys.path.append(os.path.dirname(os.path.dirname(os.path.join(SCRIPT_DIR))))
+import detect_host_arch
+import gyp_chromium
+import gyp_environment
+
+
 URL_PREFIX = 'http://storage.googleapis.com'
 URL_PATH = 'chrome-linux-sysroot/toolchain'
 REVISION_AMD64 = 'a2d45701cb21244b9514e420950ba6ba687fb655'
@@ -60,25 +65,29 @@
   return sha1.hexdigest()
 
 
-def DetectArch(gyp_defines):
+def DetectArch(gyp_defines, is_android):
   # Check for optional target_arch and only install for that architecture.
   # If target_arch is not specified, then only install for the host
   # architecture.
-  if 'target_arch=x64' in gyp_defines:
+  target_arch = gyp_defines.get('target_arch')
+  if target_arch == 'x64':
     return 'amd64'
-  elif 'target_arch=ia32' in gyp_defines:
+  elif target_arch == 'ia32':
     return 'i386'
-  elif 'target_arch=arm' in gyp_defines:
+  elif target_arch == 'arm':
     return 'arm'
-  elif 'target_arch=mipsel' in gyp_defines:
+  elif target_arch == 'arm64':
+    return 'arm64'
+  elif target_arch == 'mipsel':
     return 'mips'
+  elif target_arch:
+    raise Exception('Unrecognized target_arch: %s' % target_arch)
+
+  if is_android:
+    return 'arm'
 
   # Figure out host arch using build/detect_host_arch.py and
   # set target_arch to host arch
-  build_dir = os.path.dirname(os.path.dirname(os.path.join(SCRIPT_DIR)))
-  sys.path.append(build_dir)
-  import detect_host_arch
-
   detected_host_arch = detect_host_arch.HostArch()
   if detected_host_arch == 'x64':
     return 'amd64'
@@ -94,22 +103,23 @@
   return None
 
 
-def UsingSysroot(target_arch, gyp_defines):
+def UsingSysroot(target_arch, is_android, gyp_defines):
   # ChromeOS uses a chroot, so doesn't need a sysroot
-  if 'chromeos=1' in gyp_defines:
+  if gyp_defines.get('chromeos'):
     return False
 
-  # When cross-compiling we always use a sysroot
-  if target_arch in ('arm', 'mips', 'i386'):
+  # When cross-compiling non-Android builds we always use a sysroot
+  if not is_android and target_arch in ('arm', 'mips', 'i386'):
     return True
 
   # Setting use_sysroot=1 GYP_DEFINES forces the use of the sysroot even
   # when not cross compiling
-  if 'use_sysroot=1' in gyp_defines:
+  if gyp_defines.get('use_sysroot'):
     return True
 
   # Official builds always use the sysroot.
-  if 'branding=Chrome' in gyp_defines and 'buildtype=Official' in gyp_defines:
+  if (gyp_defines.get('branding') == 'Chrome' and
+      gyp_defines.get('buildtype') == 'Official'):
     return True
 
   return False
@@ -119,19 +129,36 @@
   if options.running_as_hook and not sys.platform.startswith('linux'):
     return 0
 
-  gyp_defines = os.environ.get('GYP_DEFINES', '')
+  gyp_environment.SetEnvironment()
+  supplemental_includes = gyp_chromium.GetSupplementalFiles()
+  gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
+  is_android = gyp_defines.get('OS') == 'android'
 
   if options.arch:
     target_arch = options.arch
   else:
-    target_arch = DetectArch(gyp_defines)
+    target_arch = DetectArch(gyp_defines, is_android)
     if not target_arch:
-      print 'Unable to detect host architecture'
+      print 'Unable to detect target architecture'
       return 1
 
-  if options.running_as_hook and not UsingSysroot(target_arch, gyp_defines):
+  if (options.running_as_hook and
+      not UsingSysroot(target_arch, is_android, gyp_defines)):
     return 0
 
+  if is_android:
+    # 32-bit Android builds require a 32-bit host sysroot for the v8 snapshot.
+    if '64' not in target_arch:
+      ret = _InstallSysroot('i386')
+      if ret:
+        return ret
+    # Always need host sysroot (which we assume is x64).
+    target_arch = 'amd64'
+
+  return _InstallSysroot(target_arch)
+
+
+def _InstallSysroot(target_arch):
   # The sysroot directory should match the one specified in build/common.gypi.
   # TODO(thestig) Consider putting this else where to avoid having to recreate
   # it on every build.
diff --git a/build/win/message_compiler.gni b/build/win/message_compiler.gni
new file mode 100644
index 0000000..1214898a
--- /dev/null
+++ b/build/win/message_compiler.gni
@@ -0,0 +1,71 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+assert(is_win, "This only runs on Windows.")
+
+# Runs mc.exe over a list of sources. The outputs (a header and rc file) are
+# placed in the target gen dir, and compiled.
+#
+# sources
+#   List of message files to process.
+#
+# user_mode_logging (optional bool)
+#   Generates user-mode logging code. Defaults to false (no logging code).
+#
+# deps, public_deps, visibility
+#   Normal meaning.
+template("message_compiler") {
+  action_name = "${target_name}_mc"
+  source_set_name = target_name
+
+  action_foreach(action_name) {
+    visibility = [ ":$source_set_name" ]
+
+    script = "//build/win/message_compiler.py"
+
+    outputs = [
+      "$target_gen_dir/{{source_name_part}}.h",
+      "$target_gen_dir/{{source_name_part}}.rc",
+    ]
+
+    args = [
+      # The first argument is the environment file saved to the build
+      # directory. This is required because the Windows toolchain setup saves
+      # the VC paths and such so that running "mc.exe" will work with the
+      # configured toolchain. This file is in the root build dir.
+      "environment.$current_cpu",
+
+      # Where to put the header.
+      "-h",
+      rebase_path(target_gen_dir, root_build_dir),
+
+      # Where to put the .rc file.
+      "-r",
+      rebase_path(target_gen_dir, root_build_dir),
+
+      # Input is Unicode.
+      "-u",
+    ]
+    if (defined(invoker.user_mode_logging) && invoker.user_mode_logging) {
+      args += [ "-um" ]
+    }
+    args += [ "{{source}}" ]
+
+    forward_variables_from(invoker,
+                           [
+                             "deps",
+                             "public_deps",
+                             "sources",
+                           ])
+  }
+
+  # Compile the generated rc file.
+  source_set(source_set_name) {
+    forward_variables_from(invoker, [ "visibility" ])
+    sources = get_target_outputs(":$action_name")
+    deps = [
+      ":$action_name",
+    ]
+  }
+}
diff --git a/build/win/message_compiler.py b/build/win/message_compiler.py
new file mode 100644
index 0000000..5e52efe
--- /dev/null
+++ b/build/win/message_compiler.py
@@ -0,0 +1,26 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Runs the Microsoft Message Compiler (mc.exe). This Python adapter is for the
+# GN build, which can only run Python and not native binaries.
+#
+# Usage: message_compiler.py <environment_file> [<args to mc.exe>*]
+
+import subprocess
+import sys
+
+# Read the environment block from the file. This is stored in the format used
+# by CreateProcess. Drop last 2 NULs, one for list terminator, one for trailing
+# vs. separator.
+env_pairs = open(sys.argv[1]).read()[:-2].split('\0')
+env_dict = dict([item.split('=', 1) for item in env_pairs])
+
+# mc writes to stderr, so this explicitly redirects to stdout and eats it.
+try:
+  subprocess.check_output(["mc.exe"] + sys.argv[2:],
+                          env=env_dict,
+                          stderr=subprocess.STDOUT)
+except subprocess.CalledProcessError as e:
+  print e.output
+  sys.exit(e.returncode)
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 9d3cc43..e38e0db 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -486,7 +486,6 @@
     "trees/property_tree.h",
     "trees/property_tree_builder.cc",
     "trees/property_tree_builder.h",
-    "trees/proxy.cc",
     "trees/proxy.h",
     "trees/proxy_common.cc",
     "trees/proxy_common.h",
diff --git a/cc/cc.gyp b/cc/cc.gyp
index c453330..b8d6c40f 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -548,7 +548,6 @@
         'trees/property_tree.h',
         'trees/property_tree_builder.cc',
         'trees/property_tree_builder.h',
-        'trees/proxy.cc',
         'trees/proxy.h',
         'trees/proxy_common.cc',
         'trees/proxy_common.h',
diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc
index 9c5b0a5..c7138cd 100644
--- a/cc/debug/micro_benchmark_controller_unittest.cc
+++ b/cc/debug/micro_benchmark_controller_unittest.cc
@@ -32,7 +32,9 @@
     layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_,
                                                  &task_graph_runner_);
     layer_tree_host_->SetRootLayer(Layer::Create(LayerSettings()));
-    layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy));
+    layer_tree_host_->InitializeForTesting(
+        TaskRunnerProvider::Create(nullptr, nullptr),
+        scoped_ptr<Proxy>(new FakeProxy));
   }
 
   void TearDown() override {
diff --git a/cc/layers/delegated_renderer_layer_unittest.cc b/cc/layers/delegated_renderer_layer_unittest.cc
index ad4a345f..85f0f2e 100644
--- a/cc/layers/delegated_renderer_layer_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_unittest.cc
@@ -20,7 +20,7 @@
 class DelegatedRendererLayerTest : public testing::Test {
  public:
   DelegatedRendererLayerTest()
-      : proxy_(), host_client_(FakeLayerTreeHostClient::DIRECT_3D) {
+      : host_client_(FakeLayerTreeHostClient::DIRECT_3D) {
     LayerTreeSettings settings;
     settings.minimum_occlusion_tracking_size = gfx::Size();
 
@@ -30,7 +30,6 @@
   }
 
  protected:
-  FakeProxy proxy_;
   FakeLayerTreeHostClient host_client_;
   TestTaskGraphRunner task_graph_runner_;
   TestSharedBitmapManager shared_bitmap_manager_;
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 5ebe0d8c..4796f73 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1301,7 +1301,7 @@
        it != copy_requests_.end();
        ++it) {
     scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
-        layer_tree_host()->proxy()->MainThreadTaskRunner();
+        layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
     scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it);
     const CopyOutputRequest& original_request_ref = *original_request;
     scoped_ptr<CopyOutputRequest> main_thread_request =
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 9c15a650..1162d65 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -71,7 +71,9 @@
         child_impl_(nullptr),
         grand_child_impl_(nullptr),
         great_grand_child_impl_(nullptr) {
-    layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy));
+    layer_tree_host_->InitializeForTesting(
+        TaskRunnerProvider::Create(nullptr, nullptr),
+        scoped_ptr<Proxy>(new FakeProxy));
     CreateTreeForTest();
     fixed_to_top_left_.set_is_fixed_position(true);
     fixed_to_bottom_right_.set_is_fixed_position(true);
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index dffbad4..70855b4 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -56,23 +56,21 @@
   // Intentionally skipping Update since it would normally be skipped on
   // a layer with empty bounds.
 
-  FakeProxy proxy;
-  {
-    DebugScopedSetImplThread impl_thread(&proxy);
+  FakeImplTaskRunnerProvider impl_task_runner_provider;
 
-    TestSharedBitmapManager shared_bitmap_manager;
-    FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), &proxy,
-                                    &shared_bitmap_manager, &task_graph_runner);
-    host_impl.CreatePendingTree();
-    scoped_ptr<FakePictureLayerImpl> layer_impl =
-        FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
+  TestSharedBitmapManager shared_bitmap_manager;
+  FakeLayerTreeHostImpl host_impl(LayerTreeSettings(),
+                                  &impl_task_runner_provider,
+                                  &shared_bitmap_manager, &task_graph_runner);
+  host_impl.CreatePendingTree();
+  scoped_ptr<FakePictureLayerImpl> layer_impl =
+      FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
 
-    layer->PushPropertiesTo(layer_impl.get());
-    EXPECT_FALSE(layer_impl->CanHaveTilings());
-    EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0));
-    EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize());
-    EXPECT_FALSE(layer_impl->raster_source()->HasRecordings());
-  }
+  layer->PushPropertiesTo(layer_impl.get());
+  EXPECT_FALSE(layer_impl->CanHaveTilings());
+  EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0));
+  EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize());
+  EXPECT_FALSE(layer_impl->raster_source()->HasRecordings());
 }
 
 TEST(PictureLayerTest, SuitableForGpuRasterization) {
diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h
index d2b9b38..7998625e 100644
--- a/cc/test/fake_proxy.h
+++ b/cc/test/fake_proxy.h
@@ -13,11 +13,7 @@
 
 class FakeProxy : public Proxy {
  public:
-  FakeProxy() : Proxy(NULL, NULL), layer_tree_host_(NULL) {}
-  explicit FakeProxy(
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
-      : Proxy(main_task_runner, impl_task_runner), layer_tree_host_(NULL) {}
+  FakeProxy() : layer_tree_host_(nullptr) {}
 
   void SetLayerTreeHost(LayerTreeHost* host);
 
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc
index 596cb7c8..5c5c831 100644
--- a/cc/test/layer_tree_pixel_resource_test.cc
+++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -110,8 +110,9 @@
     scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
     scoped_ptr<ResourcePool>* resource_pool) {
   base::SingleThreadTaskRunner* task_runner =
-      proxy()->HasImplThread() ? proxy()->ImplThreadTaskRunner()
-                               : proxy()->MainThreadTaskRunner();
+      task_runner_provider()->HasImplThread()
+          ? task_runner_provider()->ImplThreadTaskRunner()
+          : task_runner_provider()->MainThreadTaskRunner();
   DCHECK(task_runner);
   DCHECK(initialized_);
 
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index b0fae93..41cf98b 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -118,15 +118,11 @@
   static scoped_ptr<Proxy> Create(
       TestHooks* test_hooks,
       LayerTreeHost* host,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
+      TaskRunnerProvider* task_runner_provider,
       scoped_ptr<BeginFrameSource> external_begin_frame_source) {
-    return make_scoped_ptr(new ThreadProxyForTest(
-        test_hooks,
-        host,
-        main_task_runner,
-        impl_task_runner,
-        external_begin_frame_source.Pass()));
+    return make_scoped_ptr(
+        new ThreadProxyForTest(test_hooks, host, task_runner_provider,
+                               external_begin_frame_source.Pass()));
   }
 
   ~ThreadProxyForTest() override {}
@@ -339,14 +335,12 @@
     ThreadProxy::BeginMainFrame(begin_main_frame_state.Pass());
   };
 
-  ThreadProxyForTest(
-      TestHooks* test_hooks,
-      LayerTreeHost* host,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
-      scoped_ptr<BeginFrameSource> external_begin_frame_source)
-      : ThreadProxy(host, main_task_runner,
-                    impl_task_runner,
+  ThreadProxyForTest(TestHooks* test_hooks,
+                     LayerTreeHost* host,
+                     TaskRunnerProvider* task_runner_provider,
+                     scoped_ptr<BeginFrameSource> external_begin_frame_source)
+      : ThreadProxy(host,
+                    task_runner_provider,
                     external_begin_frame_source.Pass()),
         test_hooks_(test_hooks) {}
 };
@@ -358,10 +352,10 @@
       TestHooks* test_hooks,
       LayerTreeHost* host,
       LayerTreeHostSingleThreadClient* client,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+      TaskRunnerProvider* task_runner_provider,
       scoped_ptr<BeginFrameSource> external_begin_frame_source) {
     return make_scoped_ptr(new SingleThreadProxyForTest(
-        test_hooks, host, client, main_task_runner,
+        test_hooks, host, client, task_runner_provider,
         external_begin_frame_source.Pass()));
   }
 
@@ -417,9 +411,11 @@
       TestHooks* test_hooks,
       LayerTreeHost* host,
       LayerTreeHostSingleThreadClient* client,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+      TaskRunnerProvider* task_runner_provider,
       scoped_ptr<BeginFrameSource> external_begin_frame_source)
-      : SingleThreadProxy(host, client, main_task_runner,
+      : SingleThreadProxy(host,
+                          client,
+                          task_runner_provider,
                           external_begin_frame_source.Pass()),
         test_hooks_(test_hooks) {}
 };
@@ -431,14 +427,15 @@
       TestHooks* test_hooks,
       const LayerTreeSettings& settings,
       LayerTreeHostImplClient* host_impl_client,
-      Proxy* proxy,
+      TaskRunnerProvider* task_runner_provider,
       SharedBitmapManager* shared_bitmap_manager,
       gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
       TaskGraphRunner* task_graph_runner,
       RenderingStatsInstrumentation* stats_instrumentation) {
     return make_scoped_ptr(new LayerTreeHostImplForTesting(
-        test_hooks, settings, host_impl_client, proxy, shared_bitmap_manager,
-        gpu_memory_buffer_manager, task_graph_runner, stats_instrumentation));
+        test_hooks, settings, host_impl_client, task_runner_provider,
+        shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner,
+        stats_instrumentation));
   }
 
  protected:
@@ -446,14 +443,14 @@
       TestHooks* test_hooks,
       const LayerTreeSettings& settings,
       LayerTreeHostImplClient* host_impl_client,
-      Proxy* proxy,
+      TaskRunnerProvider* task_runner_provider,
       SharedBitmapManager* shared_bitmap_manager,
       gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
       TaskGraphRunner* task_graph_runner,
       RenderingStatsInstrumentation* stats_instrumentation)
       : LayerTreeHostImpl(settings,
                           host_impl_client,
-                          proxy,
+                          task_runner_provider,
                           stats_instrumentation,
                           shared_bitmap_manager,
                           gpu_memory_buffer_manager,
@@ -707,29 +704,27 @@
     params.settings = &settings;
     scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
         new LayerTreeHostForTesting(test_hooks, &params));
+    scoped_ptr<TaskRunnerProvider> task_runner_provider =
+        TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
+    scoped_ptr<Proxy> proxy;
     if (impl_task_runner.get()) {
-      layer_tree_host->InitializeForTesting(
-          ThreadProxyForTest::Create(test_hooks,
-                                     layer_tree_host.get(),
-                                     main_task_runner,
-                                     impl_task_runner,
-                                     external_begin_frame_source.Pass()));
+      proxy = ThreadProxyForTest::Create(test_hooks, layer_tree_host.get(),
+                                         task_runner_provider.get(),
+                                         external_begin_frame_source.Pass());
     } else {
-      layer_tree_host->InitializeForTesting(
-          SingleThreadProxyForTest::Create(
-              test_hooks,
-              layer_tree_host.get(),
-              client,
-              main_task_runner,
-              external_begin_frame_source.Pass()));
+      proxy = SingleThreadProxyForTest::Create(
+          test_hooks, layer_tree_host.get(), client, task_runner_provider.get(),
+          external_begin_frame_source.Pass());
     }
+    layer_tree_host->InitializeForTesting(task_runner_provider.Pass(),
+                                          proxy.Pass());
     return layer_tree_host.Pass();
   }
 
   scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
       LayerTreeHostImplClient* host_impl_client) override {
     return LayerTreeHostImplForTesting::Create(
-        test_hooks_, settings(), host_impl_client, proxy(),
+        test_hooks_, settings(), host_impl_client, task_runner_provider(),
         shared_bitmap_manager(), gpu_memory_buffer_manager(),
         task_graph_runner(), rendering_stats_instrumentation());
   }
@@ -989,7 +984,7 @@
 
 void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation,
                                          double animation_duration) {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_to_receive_animation) {
     AddOpacityTransitionToLayer(
@@ -1000,7 +995,7 @@
 void LayerTreeTest::DispatchAddAnimationToPlayer(
     AnimationPlayer* player_to_receive_animation,
     double animation_duration) {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (player_to_receive_animation) {
     AddOpacityTransitionToPlayer(player_to_receive_animation,
@@ -1009,55 +1004,55 @@
 }
 
 void LayerTreeTest::DispatchSetDeferCommits(bool defer_commits) {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetDeferCommits(defer_commits);
 }
 
 void LayerTreeTest::DispatchSetNeedsCommit() {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetNeedsCommit();
 }
 
 void LayerTreeTest::DispatchSetNeedsUpdateLayers() {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetNeedsUpdateLayers();
 }
 
 void LayerTreeTest::DispatchSetNeedsRedraw() {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetNeedsRedraw();
 }
 
 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetNeedsRedrawRect(damage_rect);
 }
 
 void LayerTreeTest::DispatchSetVisible(bool visible) {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
   if (layer_tree_host_)
     layer_tree_host_->SetVisible(visible);
 }
 
 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
 
   if (layer_tree_host_)
     layer_tree_host_->SetNextCommitForcesRedraw();
 }
 
 void LayerTreeTest::DispatchCompositeImmediately() {
-  DCHECK(!proxy() || proxy()->IsMainThread());
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread());
   if (layer_tree_host_)
     layer_tree_host_->Composite(base::TimeTicks::Now());
 }
@@ -1156,11 +1151,13 @@
 }
 
 LayerTreeHost* LayerTreeTest::layer_tree_host() {
-  // We check for a null proxy here as we sometimes ask for the layer tree host
-  // when the proxy does not exist, often for checking settings after a test has
-  // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See
-  // elsewhere in this file for other examples.
-  DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked());
+  // We check for a null task_runner_provider here as we sometimes ask for the
+  // layer tree host when the task_runner_provider does not exist, often for
+  // checking settings after a test has completed. For example,
+  // LTHPixelResourceTest::RunPixelResourceTest. See elsewhere in this file for
+  // other examples.
+  DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread() ||
+         task_runner_provider()->IsMainThreadBlocked());
   return layer_tree_host_.get();
 }
 
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 33593aa..0c2dfb10 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -253,9 +253,11 @@
 
   bool HasImplThread() { return !!impl_thread_; }
   base::SingleThreadTaskRunner* ImplThreadTaskRunner() {
-    DCHECK(proxy());
-    return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner()
-                                           : main_task_runner_.get();
+    DCHECK(task_runner_provider());
+    base::SingleThreadTaskRunner* impl_thread_task_runner =
+        task_runner_provider()->ImplThreadTaskRunner();
+    return impl_thread_task_runner ? impl_thread_task_runner
+                                   : main_task_runner_.get();
   }
   base::SingleThreadTaskRunner* MainThreadTaskRunner() {
     return main_task_runner_.get();
@@ -263,6 +265,10 @@
   Proxy* proxy() const {
     return layer_tree_host_ ? layer_tree_host_->proxy() : NULL;
   }
+  TaskRunnerProvider* task_runner_provider() const {
+    return layer_tree_host_ ? layer_tree_host_->task_runner_provider()
+                            : nullptr;
+  }
   TaskGraphRunner* task_graph_runner() const {
     return task_graph_runner_.get();
   }
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 8312165c..74dc211 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -137,9 +137,9 @@
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
     scoped_ptr<BeginFrameSource> external_begin_frame_source) {
-  InitializeProxy(ThreadProxy::Create(this,
-                                      main_task_runner,
-                                      impl_task_runner,
+  task_runner_provider_ =
+      TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
+  InitializeProxy(ThreadProxy::Create(this, task_runner_provider_.get(),
                                       external_begin_frame_source.Pass()));
 }
 
@@ -147,14 +147,16 @@
     LayerTreeHostSingleThreadClient* single_thread_client,
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_ptr<BeginFrameSource> external_begin_frame_source) {
-  InitializeProxy(
-      SingleThreadProxy::Create(this,
-                                single_thread_client,
-                                main_task_runner,
-                                external_begin_frame_source.Pass()));
+  task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr);
+  InitializeProxy(SingleThreadProxy::Create(
+      this, single_thread_client, task_runner_provider_.get(),
+      external_begin_frame_source.Pass()));
 }
 
-void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
+void LayerTreeHost::InitializeForTesting(
+    scoped_ptr<TaskRunnerProvider> task_runner_provider,
+    scoped_ptr<Proxy> proxy_for_testing) {
+  task_runner_provider_ = task_runner_provider.Pass();
   InitializeProxy(proxy_for_testing.Pass());
 }
 
@@ -187,8 +189,11 @@
   BreakSwapPromises(SwapPromise::COMMIT_FAILS);
 
   if (proxy_) {
-    DCHECK(proxy_->IsMainThread());
+    DCHECK(task_runner_provider_->IsMainThread());
     proxy_->Stop();
+
+    // Proxy must be destroyed before the Task Runner Provider.
+    proxy_ = nullptr;
   }
 
   // We must clear any pointers into the layer tree prior to destroying it.
@@ -234,7 +239,7 @@
 // should be delayed until the LayerTreeHost::CommitComplete, which will run
 // after the commit, but on the main thread.
 void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
-  DCHECK(proxy_->IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
 
   bool is_new_trace;
   TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
@@ -419,11 +424,11 @@
 
 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
     LayerTreeHostImplClient* client) {
-  DCHECK(proxy_->IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
-      settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(),
-      shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_,
-      id_);
+      settings_, client, task_runner_provider_.get(),
+      rendering_stats_instrumentation_.get(), shared_bitmap_manager_,
+      gpu_memory_buffer_manager_, task_graph_runner_, id_);
   host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
   host_impl->SetContentIsSuitableForGpuRasterization(
       content_is_suitable_for_gpu_rasterization_);
@@ -436,7 +441,7 @@
 
 void LayerTreeHost::DidLoseOutputSurface() {
   TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface");
-  DCHECK(proxy_->IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
 
   if (output_surface_lost_)
     return;
@@ -530,7 +535,7 @@
 
 void LayerTreeHost::SetAnimationEvents(
     scoped_ptr<AnimationEventsVector> events) {
-  DCHECK(proxy_->IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   if (animation_host_)
     animation_host_->SetAnimationEvents(events.Pass());
   else
@@ -668,7 +673,7 @@
 }
 
 void LayerTreeHost::LayoutAndUpdateLayers() {
-  DCHECK(!proxy_->HasImplThread());
+  DCHECK(!task_runner_provider_->HasImplThread());
   // This function is only valid when not using the scheduler.
   DCHECK(!settings_.single_thread_proxy_scheduler);
   SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
@@ -686,7 +691,7 @@
 }
 
 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) {
-  DCHECK(!proxy_->HasImplThread());
+  DCHECK(!task_runner_provider_->HasImplThread());
   // This function is only valid when not using the scheduler.
   DCHECK(!settings_.single_thread_proxy_scheduler);
   SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
@@ -727,7 +732,8 @@
 void LayerTreeHost::RecordGpuRasterizationHistogram() {
   // Gpu rasterization is only supported for Renderer compositors.
   // Checking for proxy_->HasImplThread() to exclude Browser compositors.
-  if (gpu_rasterization_histogram_recorded_ || !proxy_->HasImplThread())
+  if (gpu_rasterization_histogram_recorded_ ||
+      !task_runner_provider_->HasImplThread())
     return;
 
   // Record how widely gpu rasterization is enabled.
@@ -895,7 +901,7 @@
                                            TopControlsState current,
                                            bool animate) {
   // Top controls are only used in threaded mode.
-  DCHECK(proxy_->HasImplThread());
+  DCHECK(task_runner_provider_->HasImplThread());
   proxy_->UpdateTopControlsState(constraints, current, animate);
 }
 
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index b6fb6fc..b3a7740 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -249,6 +249,9 @@
   HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); }
 
   Proxy* proxy() const { return proxy_.get(); }
+  TaskRunnerProvider* task_runner_provider() const {
+    return task_runner_provider_.get();
+  }
   AnimationRegistrar* animation_registrar() const {
     return animation_registrar_.get();
   }
@@ -366,7 +369,8 @@
       LayerTreeHostSingleThreadClient* single_thread_client,
       scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
       scoped_ptr<BeginFrameSource> external_begin_frame_source);
-  void InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
+  void InitializeForTesting(scoped_ptr<TaskRunnerProvider> task_runner_provider,
+                            scoped_ptr<Proxy> proxy_for_testing);
   void SetOutputSurfaceLostForTesting(bool is_lost) {
     output_surface_lost_ = is_lost;
   }
@@ -419,6 +423,7 @@
 
   LayerTreeHostClient* client_;
   scoped_ptr<Proxy> proxy_;
+  scoped_ptr<TaskRunnerProvider> task_runner_provider_;
 
   int source_frame_number_;
   int meta_information_sequence_number_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index d3c82dd..849b566 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -81,9 +81,7 @@
                               public LayerTreeHostImplClient {
  public:
   LayerTreeHostImplTest()
-      : task_runner_provider_(base::ThreadTaskRunnerHandle::Get(),
-                              base::ThreadTaskRunnerHandle::Get()),
-        always_impl_thread_(&task_runner_provider_),
+      : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
         always_main_thread_blocked_(&task_runner_provider_),
         on_can_draw_state_changed_called_(false),
         did_notify_ready_to_activate_(false),
@@ -429,8 +427,7 @@
     host_impl_->DidDrawAllLayers(frame_data);
   }
 
-  TaskRunnerProvider task_runner_provider_;
-  DebugScopedSetImplThread always_impl_thread_;
+  FakeImplTaskRunnerProvider task_runner_provider_;
   DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
 
   TestSharedBitmapManager shared_bitmap_manager_;
diff --git a/cc/trees/layer_tree_host_pixeltest_readback.cc b/cc/trees/layer_tree_host_pixeltest_readback.cc
index c35d66b7..d7f0a92 100644
--- a/cc/trees/layer_tree_host_pixeltest_readback.cc
+++ b/cc/trees/layer_tree_host_pixeltest_readback.cc
@@ -105,14 +105,14 @@
   }
 
   void ReadbackResultAsBitmap(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(proxy()->IsMainThread());
+    EXPECT_TRUE(task_runner_provider()->IsMainThread());
     EXPECT_TRUE(result->HasBitmap());
     result_bitmap_ = result->TakeBitmap().Pass();
     EndTest();
   }
 
   void ReadbackResultAsTexture(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(proxy()->IsMainThread());
+    EXPECT_TRUE(task_runner_provider()->IsMainThread());
     EXPECT_TRUE(result->HasTexture());
 
     TextureMailbox texture_mailbox;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index a1d5be2..9c04c7e 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -375,7 +375,7 @@
   void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
     if (!toggled_visibility_) {
       {
-        DebugScopedSetMainThread main(proxy());
+        DebugScopedSetMainThread main(task_runner_provider());
         layer_tree_host()->SetVisible(false);
       }
       toggled_visibility_ = true;
@@ -399,7 +399,7 @@
   void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override {
     if (!host_impl->visible()) {
       {
-        DebugScopedSetMainThread main(proxy());
+        DebugScopedSetMainThread main(task_runner_provider());
         layer_tree_host()->SetVisible(true);
       }
       EXPECT_TRUE(host_impl->visible());
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 51472759..74b225e 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -412,7 +412,7 @@
   }
 
   void HideAndReleaseOutputSurface() {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     layer_tree_host()->SetVisible(false);
     scoped_ptr<OutputSurface> surface =
         layer_tree_host()->ReleaseOutputSurface();
@@ -436,7 +436,7 @@
   }
 
   void MakeVisible() {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     layer_tree_host()->SetVisible(true);
   }
 
@@ -724,7 +724,7 @@
                           EvictTexturesOnImplThread,
                      base::Unretained(this)));
     } else {
-      DebugScopedSetImplThread impl(proxy());
+      DebugScopedSetImplThread impl(task_runner_provider());
       EvictTexturesOnImplThread();
     }
   }
@@ -1224,15 +1224,14 @@
   // the call to StepCompleteOnMainThread will not occur until after
   // the commit completes, because the main thread is blocked.
   void PostStepCompleteToMainThread() {
-    proxy()->MainThreadTaskRunner()->PostTask(
+    task_runner_provider()->MainThreadTaskRunner()->PostTask(
         FROM_HERE,
         base::Bind(&UIResourceLostTest::StepCompleteOnMainThreadInternal,
-                   base::Unretained(this),
-                   time_step_));
+                   base::Unretained(this), time_step_));
   }
 
   void PostLoseContextToImplThread() {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     ImplThreadTaskRunner()->PostTask(
         FROM_HERE,
         base::Bind(&LayerTreeHostContextTest::LoseContext,
@@ -1245,7 +1244,7 @@
 
  private:
   void StepCompleteOnMainThreadInternal(int step) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     StepCompleteOnMainThread(step);
   }
 };
@@ -1266,7 +1265,7 @@
 class UIResourceLostAfterCommit : public UIResourceLostTestSimple {
  public:
   void StepCompleteOnMainThread(int step) override {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     switch (step) {
       case 0:
         ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
@@ -1421,7 +1420,7 @@
 // commit.  Impl-side-painting only.
 class UIResourceLostBeforeActivateTree : public UIResourceLostTest {
   void StepCompleteOnMainThread(int step) override {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     switch (step) {
       case 0:
         ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
@@ -1504,7 +1503,7 @@
 class UIResourceLostEviction : public UIResourceLostTestSimple {
  public:
   void StepCompleteOnMainThread(int step) override {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     switch (step) {
       case 0:
         ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 0ddc7b7..28938e5 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -103,7 +103,7 @@
   }
 
   void CopyOutputCallback(size_t id, scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_TRUE(result->HasBitmap());
     scoped_ptr<SkBitmap> bitmap = result->TakeBitmap().Pass();
     EXPECT_EQ(result->size().ToString(),
@@ -250,7 +250,7 @@
   }
 
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_TRUE(result->IsEmpty());
     ++callback_count_;
   }
@@ -307,7 +307,7 @@
 
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
     ++callback_count_;
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString())
         << callback_count_;
     switch (callback_count_) {
@@ -403,7 +403,7 @@
   }
 
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString());
     EndTest();
   }
@@ -475,7 +475,7 @@
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
     // We should still get the content even if the copy requested layer was
     // completely clipped away.
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
     EndTest();
   }
@@ -542,7 +542,7 @@
   }
 
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
 
     // The first frame can't be drawn.
     switch (callback_count_) {
@@ -604,7 +604,7 @@
   void BeginTest() override { PostSetNeedsCommitToMainThread(); }
 
   void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
-    EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+    EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
     EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
     EXPECT_TRUE(result->HasTexture());
 
diff --git a/cc/trees/layer_tree_host_unittest_proxy.cc b/cc/trees/layer_tree_host_unittest_proxy.cc
index 370760e0..78545ef 100644
--- a/cc/trees/layer_tree_host_unittest_proxy.cc
+++ b/cc/trees/layer_tree_host_unittest_proxy.cc
@@ -84,14 +84,16 @@
   }
 
   const ThreadProxy::MainThreadOnly& ThreadProxyMainOnly() const {
+    DCHECK(task_runner_provider());
+    DCHECK(task_runner_provider()->HasImplThread());
     DCHECK(proxy());
-    DCHECK(proxy()->HasImplThread());
     return static_cast<const ThreadProxy*>(proxy())->main();
   }
 
   const ThreadProxy::CompositorThreadOnly& ThreadProxyImplOnly() const {
+    DCHECK(task_runner_provider());
+    DCHECK(task_runner_provider()->HasImplThread());
     DCHECK(proxy());
-    DCHECK(proxy()->HasImplThread());
     return static_cast<const ThreadProxy*>(proxy())->impl();
   }
 
diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc
index 5472bba2..7e4a8f8 100644
--- a/cc/trees/occlusion_tracker_perftest.cc
+++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -9,6 +9,7 @@
 #include "cc/debug/lap_timer.h"
 #include "cc/layers/layer_iterator.h"
 #include "cc/layers/solid_color_layer_impl.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
 #include "cc/test/fake_layer_tree_host_impl_client.h"
 #include "cc/test/fake_output_surface.h"
 #include "cc/test/fake_proxy.h"
@@ -34,14 +35,12 @@
       : timer_(kWarmupRuns,
                base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
                kTimeCheckInterval),
-        proxy_(base::ThreadTaskRunnerHandle::Get(), nullptr),
-        impl_(&proxy_),
         output_surface_(FakeOutputSurface::Create3d()) {}
   void CreateHost() {
     LayerTreeSettings settings;
-    host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_, &stats_,
-                                           &shared_bitmap_manager_, nullptr,
-                                           &task_graph_runner_, 1);
+    host_impl_ = LayerTreeHostImpl::Create(
+        settings, &client_, &impl_task_runner_provider_, &stats_,
+        &shared_bitmap_manager_, nullptr, &task_graph_runner_, 1);
     host_impl_->SetVisible(true);
     host_impl_->InitializeRenderer(output_surface_.get());
 
@@ -68,8 +67,7 @@
   LapTimer timer_;
   std::string test_name_;
   FakeLayerTreeHostImplClient client_;
-  FakeProxy proxy_;
-  DebugScopedSetImplThread impl_;
+  FakeImplTaskRunnerProvider impl_task_runner_provider_;
   FakeRenderingStatsInstrumentation stats_;
   TestSharedBitmapManager shared_bitmap_manager_;
   TestTaskGraphRunner task_graph_runner_;
diff --git a/cc/trees/proxy.cc b/cc/trees/proxy.cc
deleted file mode 100644
index 149f6f9..0000000
--- a/cc/trees/proxy.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/trees/proxy.h"
-
-#include "base/single_thread_task_runner.h"
-#include "cc/trees/blocking_task_runner.h"
-
-namespace cc {
-
-Proxy::Proxy(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-             scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
-    : TaskRunnerProvider(main_task_runner, impl_task_runner) {}
-
-Proxy::~Proxy() {
-  DCHECK(IsMainThread());
-}
-
-}  // namespace cc
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h
index 8780281..132a4ff6 100644
--- a/cc/trees/proxy.h
+++ b/cc/trees/proxy.h
@@ -28,11 +28,11 @@
 class OutputSurface;
 struct RendererCapabilities;
 
-// Abstract class responsible for proxying commands from the main-thread side of
-// the compositor over to the compositor implementation.
-class CC_EXPORT Proxy : public TaskRunnerProvider {
+// Abstract interface responsible for proxying commands from the main-thread
+// side of the compositor over to the compositor implementation.
+class CC_EXPORT Proxy {
  public:
-  ~Proxy() override;
+  virtual ~Proxy() {}
 
   virtual void FinishAllRendering() = 0;
 
@@ -85,13 +85,6 @@
 
   // Testing hooks
   virtual bool MainFrameWillHappenForTesting() = 0;
-
- protected:
-  Proxy(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-        scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Proxy);
 };
 
 }  // namespace cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 9ddf997..5288ae6 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -25,23 +25,21 @@
 scoped_ptr<Proxy> SingleThreadProxy::Create(
     LayerTreeHost* layer_tree_host,
     LayerTreeHostSingleThreadClient* client,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+    TaskRunnerProvider* task_runner_provider,
     scoped_ptr<BeginFrameSource> external_begin_frame_source) {
-  return make_scoped_ptr(new SingleThreadProxy(
-                                 layer_tree_host,
-                                 client,
-                                 main_task_runner,
-                                 external_begin_frame_source.Pass()));
+  return make_scoped_ptr(
+      new SingleThreadProxy(layer_tree_host, client, task_runner_provider,
+                            external_begin_frame_source.Pass()));
 }
 
 SingleThreadProxy::SingleThreadProxy(
     LayerTreeHost* layer_tree_host,
     LayerTreeHostSingleThreadClient* client,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+    TaskRunnerProvider* task_runner_provider,
     scoped_ptr<BeginFrameSource> external_begin_frame_source)
-    : Proxy(main_task_runner, NULL),
-      layer_tree_host_(layer_tree_host),
+    : layer_tree_host_(layer_tree_host),
       client_(client),
+      task_runner_provider_(task_runner_provider),
       external_begin_frame_source_(external_begin_frame_source.Pass()),
       next_frame_is_newly_committed_frame_(false),
 #if DCHECK_IS_ON()
@@ -55,7 +53,8 @@
       output_surface_creation_requested_(false),
       weak_factory_(this) {
   TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_);
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(layer_tree_host);
 
   if (layer_tree_host->settings().single_thread_proxy_scheduler &&
@@ -71,34 +70,34 @@
 
     scheduler_on_impl_thread_ = Scheduler::Create(
         this, scheduler_settings, layer_tree_host_->id(),
-        MainThreadTaskRunner(), external_begin_frame_source_.get(),
-        compositor_timing_history.Pass());
+        task_runner_provider_->MainThreadTaskRunner(),
+        external_begin_frame_source_.get(), compositor_timing_history.Pass());
   }
 }
 
 void SingleThreadProxy::Start() {
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
 }
 
 SingleThreadProxy::~SingleThreadProxy() {
   TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // Make sure Stop() got called or never Started.
   DCHECK(!layer_tree_host_impl_);
 }
 
 void SingleThreadProxy::FinishAllRendering() {
   TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   {
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetImplThread impl(task_runner_provider_);
     layer_tree_host_impl_->FinishAllRendering();
   }
 }
 
 bool SingleThreadProxy::IsStarted() const {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return layer_tree_host_impl_;
 }
 
@@ -110,7 +109,7 @@
 
 void SingleThreadProxy::SetVisible(bool visible) {
   TRACE_EVENT1("cc", "SingleThreadProxy::SetVisible", "visible", visible);
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
 
   layer_tree_host_impl_->SetVisible(visible);
 
@@ -121,13 +120,13 @@
 void SingleThreadProxy::SetThrottleFrameProduction(bool throttle) {
   TRACE_EVENT1("cc", "SingleThreadProxy::SetThrottleFrameProduction",
                "throttle", throttle);
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->SetThrottleFrameProduction(throttle);
 }
 
 void SingleThreadProxy::RequestNewOutputSurface() {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(layer_tree_host_->output_surface_lost());
   output_surface_creation_callback_.Cancel();
   if (output_surface_creation_requested_)
@@ -146,15 +145,15 @@
 }
 
 void SingleThreadProxy::SetOutputSurface(OutputSurface* output_surface) {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(layer_tree_host_->output_surface_lost());
   DCHECK(output_surface_creation_requested_);
   renderer_capabilities_for_main_thread_ = RendererCapabilities();
 
   bool success;
   {
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
+    DebugScopedSetImplThread impl(task_runner_provider_);
     success = layer_tree_host_impl_->InitializeRenderer(output_surface);
   }
 
@@ -173,32 +172,32 @@
 }
 
 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(!layer_tree_host_->output_surface_lost());
   return renderer_capabilities_for_main_thread_;
 }
 
 void SingleThreadProxy::SetNeedsAnimate() {
   TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   client_->ScheduleAnimation();
   if (animate_requested_)
     return;
   animate_requested_ = true;
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->SetNeedsBeginMainFrame();
 }
 
 void SingleThreadProxy::SetNeedsUpdateLayers() {
   TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   SetNeedsCommit();
 }
 
 void SingleThreadProxy::DoCommit() {
   TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
 
   // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 is
   // fixed.
@@ -215,14 +214,14 @@
     tracked_objects::ScopedTracker tracking_profile2(
         FROM_HERE_WITH_EXPLICIT_FUNCTION(
             "461509 SingleThreadProxy::DoCommit2"));
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
+    DebugScopedSetImplThread impl(task_runner_provider_);
 
     // This CapturePostTasks should be destroyed before CommitComplete() is
     // called since that goes out to the embedder, and we want the embedder
     // to receive its callbacks before that.
     commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks(
-        blocking_main_thread_task_runner()));
+        task_runner_provider_->blocking_main_thread_task_runner()));
 
     layer_tree_host_impl_->BeginCommit();
 
@@ -276,7 +275,7 @@
       << "Activation is expected to have synchronously occurred by now.";
   DCHECK(commit_blocking_task_runner_);
 
-  DebugScopedSetMainThread main(this);
+  DebugScopedSetMainThread main(task_runner_provider_);
   commit_blocking_task_runner_.reset();
   layer_tree_host_->CommitComplete();
   layer_tree_host_->DidBeginMainFrame();
@@ -285,31 +284,31 @@
 }
 
 void SingleThreadProxy::SetNeedsCommit() {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   client_->ScheduleComposite();
   if (commit_requested_)
     return;
   commit_requested_ = true;
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->SetNeedsBeginMainFrame();
 }
 
 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
   TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
-  DCHECK(Proxy::IsMainThread());
-  DebugScopedSetImplThread impl(this);
+  DCHECK(task_runner_provider_->IsMainThread());
+  DebugScopedSetImplThread impl(task_runner_provider_);
   client_->ScheduleComposite();
   SetNeedsRedrawRectOnImplThread(damage_rect);
 }
 
 void SingleThreadProxy::SetNextCommitWaitsForActivation() {
   // Activation always forced in commit, so nothing to do.
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
 }
 
 void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // Deferring commits only makes sense if there's a scheduler.
   if (!scheduler_on_impl_thread_)
     return;
@@ -326,12 +325,12 @@
 }
 
 bool SingleThreadProxy::CommitRequested() const {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return commit_requested_;
 }
 
 bool SingleThreadProxy::BeginMainFrameRequested() const {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // If there is no scheduler, then there can be no pending begin frame,
   // as all frames are all manually initiated by the embedder of cc.
   if (!scheduler_on_impl_thread_)
@@ -341,13 +340,13 @@
 
 void SingleThreadProxy::Stop() {
   TRACE_EVENT0("cc", "SingleThreadProxy::stop");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   {
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
+    DebugScopedSetImplThread impl(task_runner_provider_);
 
     BlockingTaskRunner::CapturePostTasks blocked(
-        blocking_main_thread_task_runner());
+        task_runner_provider_->blocking_main_thread_task_runner());
     scheduler_on_impl_thread_ = nullptr;
     layer_tree_host_impl_ = nullptr;
   }
@@ -362,21 +361,21 @@
 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
   TRACE_EVENT1(
       "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
-  DCHECK(Proxy::IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->SetCanDraw(can_draw);
 }
 
 void SingleThreadProxy::NotifyReadyToActivate() {
   TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate");
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->NotifyReadyToActivate();
 }
 
 void SingleThreadProxy::NotifyReadyToDraw() {
   TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToDraw");
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->NotifyReadyToDraw();
 }
@@ -423,8 +422,8 @@
     scoped_ptr<AnimationEventsVector> events) {
   TRACE_EVENT0(
       "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
-  DCHECK(Proxy::IsImplThread());
-  DebugScopedSetMainThread main(this);
+  DCHECK(task_runner_provider_->IsImplThread());
+  DebugScopedSetMainThread main(task_runner_provider_);
   layer_tree_host_->SetAnimationEvents(events.Pass());
 }
 
@@ -438,13 +437,13 @@
 }
 
 void SingleThreadProxy::WillPrepareTiles() {
-  DCHECK(Proxy::IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->WillPrepareTiles();
 }
 
 void SingleThreadProxy::DidPrepareTiles() {
-  DCHECK(Proxy::IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (scheduler_on_impl_thread_)
     scheduler_on_impl_thread_->DidPrepareTiles();
 }
@@ -454,7 +453,7 @@
 }
 
 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   renderer_capabilities_for_main_thread_ =
       layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities();
 }
@@ -462,7 +461,7 @@
 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
   TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread");
   {
-    DebugScopedSetMainThread main(this);
+    DebugScopedSetMainThread main(task_runner_provider_);
     // This must happen before we notify the scheduler as it may try to recreate
     // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE.
     layer_tree_host_->DidLoseOutputSurface();
@@ -516,7 +515,7 @@
 
 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
   TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately");
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
 #if DCHECK_IS_ON()
   DCHECK(!inside_impl_frame_);
 #endif
@@ -536,7 +535,7 @@
 
   // Start the impl frame.
   {
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetImplThread impl(task_runner_provider_);
     WillBeginImplFrame(begin_frame_args);
   }
 
@@ -554,7 +553,7 @@
 
   // Finish the impl frame.
   {
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetImplThread impl(task_runner_provider_);
     layer_tree_host_impl_->ActivateSyncTree();
     DCHECK(
         !layer_tree_host_impl_->active_tree()->needs_update_draw_properties());
@@ -581,7 +580,7 @@
 }
 
 bool SingleThreadProxy::ShouldComposite() const {
-  DCHECK(Proxy::IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   return layer_tree_host_impl_->visible() &&
          layer_tree_host_impl_->CanDraw();
 }
@@ -592,7 +591,7 @@
     output_surface_creation_callback_.Reset(
         base::Bind(&SingleThreadProxy::RequestNewOutputSurface,
                    weak_factory_.GetWeakPtr()));
-    MainThreadTaskRunner()->PostTask(
+    task_runner_provider_->MainThreadTaskRunner()->PostTask(
         FROM_HERE, output_surface_creation_callback_.callback());
   }
 }
@@ -604,7 +603,7 @@
   DrawResult draw_result;
   bool draw_frame;
   {
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetImplThread impl(task_runner_provider_);
     base::AutoReset<bool> mark_inside(&inside_draw_, true);
 
     // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
@@ -659,7 +658,7 @@
   }
 
   if (draw_frame) {
-    DebugScopedSetImplThread impl(this);
+    DebugScopedSetImplThread impl(task_runner_provider_);
 
     // This CapturePostTasks should be destroyed before
     // DidCommitAndDrawFrame() is called since that goes out to the
@@ -669,10 +668,10 @@
     // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
     // there as the main thread is not blocked, so any posted tasks inside
     // the swap buffers will execute first.
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
 
     BlockingTaskRunner::CapturePostTasks blocked(
-        blocking_main_thread_task_runner());
+        task_runner_provider_->blocking_main_thread_task_runner());
     // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
     // is fixed.
     tracked_objects::ScopedTracker tracking_profile8(
@@ -692,7 +691,7 @@
 
 void SingleThreadProxy::DidCommitAndDrawFrame() {
   if (next_frame_is_newly_committed_frame_) {
-    DebugScopedSetMainThread main(this);
+    DebugScopedSetMainThread main(task_runner_provider_);
     next_frame_is_newly_committed_frame_ = false;
     layer_tree_host_->DidCommitAndDrawFrame();
   }
@@ -742,7 +741,7 @@
   const BeginFrameArgs& begin_frame_args =
       layer_tree_host_impl_->CurrentBeginFrameArgs();
 
-  MainThreadTaskRunner()->PostTask(
+  task_runner_provider_->MainThreadTaskRunner()->PostTask(
       FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame,
                             weak_factory_.GetWeakPtr(), begin_frame_args));
 }
@@ -816,7 +815,7 @@
 
 void SingleThreadProxy::BeginMainFrameAbortedOnImplThread(
     CommitEarlyOutReason reason) {
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   DCHECK(scheduler_on_impl_thread_->CommitPending());
   DCHECK(!layer_tree_host_impl_->pending_tree());
 
@@ -825,7 +824,7 @@
 }
 
 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   LayerTreeHostImpl::FrameData frame;
   return DoComposite(&frame);
 }
@@ -836,29 +835,29 @@
 }
 
 void SingleThreadProxy::ScheduledActionCommit() {
-  DebugScopedSetMainThread main(this);
+  DebugScopedSetMainThread main(task_runner_provider_);
   DoCommit();
 }
 
 void SingleThreadProxy::ScheduledActionAnimate() {
   TRACE_EVENT0("cc", "ScheduledActionAnimate");
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   layer_tree_host_impl_->Animate();
 }
 
 void SingleThreadProxy::ScheduledActionActivateSyncTree() {
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   layer_tree_host_impl_->ActivateSyncTree();
 }
 
 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
-  DebugScopedSetMainThread main(this);
+  DebugScopedSetMainThread main(task_runner_provider_);
   DCHECK(scheduler_on_impl_thread_);
   // If possible, create the output surface in a post task.  Synchronously
   // creating the output surface makes tests more awkward since this differs
   // from the ThreadProxy behavior.  However, sometimes there is no
   // task runner.
-  if (Proxy::MainThreadTaskRunner()) {
+  if (task_runner_provider_->MainThreadTaskRunner()) {
     ScheduleRequestNewOutputSurface();
   } else {
     RequestNewOutputSurface();
@@ -867,7 +866,7 @@
 
 void SingleThreadProxy::ScheduledActionPrepareTiles() {
   TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles");
-  DebugScopedSetImplThread impl(this);
+  DebugScopedSetImplThread impl(task_runner_provider_);
   layer_tree_host_impl_->PrepareTiles();
 }
 
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index ece5dffd..4b1a2767 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -15,6 +15,7 @@
 #include "cc/trees/blocking_task_runner.h"
 #include "cc/trees/layer_tree_host_impl.h"
 #include "cc/trees/proxy.h"
+#include "cc/trees/task_runner_provider.h"
 
 namespace cc {
 
@@ -30,7 +31,7 @@
   static scoped_ptr<Proxy> Create(
       LayerTreeHost* layer_tree_host,
       LayerTreeHostSingleThreadClient* client,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+      TaskRunnerProvider* task_runner_provider_,
       scoped_ptr<BeginFrameSource> external_begin_frame_source);
   ~SingleThreadProxy() override;
 
@@ -119,11 +120,10 @@
   void CompositeImmediately(base::TimeTicks frame_begin_time);
 
  protected:
-  SingleThreadProxy(
-      LayerTreeHost* layer_tree_host,
-      LayerTreeHostSingleThreadClient* client,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_ptr<BeginFrameSource> external_begin_frame_source);
+  SingleThreadProxy(LayerTreeHost* layer_tree_host,
+                    LayerTreeHostSingleThreadClient* client,
+                    TaskRunnerProvider* task_runner_provider,
+                    scoped_ptr<BeginFrameSource> external_begin_frame_source);
 
  private:
   void BeginMainFrame(const BeginFrameArgs& begin_frame_args);
@@ -142,6 +142,8 @@
   LayerTreeHost* layer_tree_host_;
   LayerTreeHostSingleThreadClient* client_;
 
+  TaskRunnerProvider* task_runner_provider_;
+
   // Used on the Thread, but checked on main thread during
   // initialization/shutdown.
   scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
diff --git a/cc/trees/task_runner_provider.h b/cc/trees/task_runner_provider.h
index 884a242..38ca31f 100644
--- a/cc/trees/task_runner_provider.h
+++ b/cc/trees/task_runner_provider.h
@@ -11,6 +11,7 @@
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
 #include "base/threading/platform_thread.h"
 #include "base/time/time.h"
 #include "base/values.h"
@@ -30,6 +31,13 @@
 // Useful for assertion checks.
 class CC_EXPORT TaskRunnerProvider {
  public:
+  static scoped_ptr<TaskRunnerProvider> Create(
+      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
+    return make_scoped_ptr(
+        new TaskRunnerProvider(main_task_runner, impl_task_runner));
+  }
+
   base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
   bool HasImplThread() const;
   base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
@@ -49,11 +57,11 @@
     return blocking_main_thread_task_runner_.get();
   }
 
+ protected:
   TaskRunnerProvider(
       scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
 
- protected:
   friend class DebugScopedSetImplThread;
   friend class DebugScopedSetMainThread;
   friend class DebugScopedSetMainThreadBlocked;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 5bd9c71..592d7da 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -47,21 +47,17 @@
 
 scoped_ptr<Proxy> ThreadProxy::Create(
     LayerTreeHost* layer_tree_host,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-    scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
+    TaskRunnerProvider* task_runner_provider,
     scoped_ptr<BeginFrameSource> external_begin_frame_source) {
-  return make_scoped_ptr(new ThreadProxy(layer_tree_host,
-                                         main_task_runner,
-                                         impl_task_runner,
+  return make_scoped_ptr(new ThreadProxy(layer_tree_host, task_runner_provider,
                                          external_begin_frame_source.Pass()));
 }
 
 ThreadProxy::ThreadProxy(
     LayerTreeHost* layer_tree_host,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-    scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
+    TaskRunnerProvider* task_runner_provider,
     scoped_ptr<BeginFrameSource> external_begin_frame_source)
-    : Proxy(main_task_runner, impl_task_runner),
+    : task_runner_provider_(task_runner_provider),
       main_thread_only_vars_unsafe_(this, layer_tree_host),
       compositor_thread_vars_unsafe_(
           this,
@@ -69,12 +65,13 @@
           layer_tree_host->rendering_stats_instrumentation(),
           external_begin_frame_source.Pass()) {
   TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_);
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(this->main().layer_tree_host);
   // TODO(khushalsagar): Move this to LayerTreeHost#InitializeThreaded once
   // ThreadProxy is split. LayerTreeHost creates the channel and passes it to
   // ProxyMain#SetChannel.
-  SetChannel(ThreadedChannel::Create(this, main_task_runner, impl_task_runner));
+  SetChannel(ThreadedChannel::Create(this, task_runner_provider_));
 }
 
 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy,
@@ -109,7 +106,8 @@
       inside_draw(false),
       input_throttled_until_commit(false),
       smoothness_priority_expiration_notifier(
-          proxy->ImplThreadTaskRunner(),
+          proxy->task_runner_provider()
+              ->ImplThreadTaskRunner(),
           base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)),
           base::TimeDelta::FromMilliseconds(
               kSmoothnessTakesPriorityExpirationDelay * 1000)),
@@ -121,7 +119,7 @@
 
 ThreadProxy::~ThreadProxy() {
   TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(!main().started);
 }
 
@@ -131,18 +129,18 @@
 }
 
 void ThreadProxy::FinishAllRendering() {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(!main().defer_commits);
 
   // Make sure all GL drawing is finished on the impl thread.
-  DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+  DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
   CompletionEvent completion;
   main().channel_main->FinishAllRenderingOnImpl(&completion);
   completion.Wait();
 }
 
 bool ThreadProxy::IsStarted() const {
-  DCHECK(Proxy::IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return main().started;
 }
 
@@ -177,12 +175,12 @@
 
 void ThreadProxy::DidLoseOutputSurface() {
   TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->DidLoseOutputSurface();
 }
 
 void ThreadProxy::RequestNewOutputSurface() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->RequestNewOutputSurface();
 }
 
@@ -191,10 +189,10 @@
 }
 
 void ThreadProxy::ReleaseOutputSurface() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(main().layer_tree_host->output_surface_lost());
 
-  DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+  DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
   CompletionEvent completion;
   main().channel_main->ReleaseOutputSurfaceOnImpl(&completion);
   completion.Wait();
@@ -204,7 +202,7 @@
     bool success,
     const RendererCapabilities& capabilities) {
   TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
 
   if (!success) {
     main().layer_tree_host->DidFailToInitializeOutputSurface();
@@ -221,7 +219,7 @@
 
 bool ThreadProxy::SendCommitRequestToImplThreadIfNeeded(
     CommitPipelineStage required_stage) {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK_NE(NO_PIPELINE_STAGE, required_stage);
   bool already_posted =
       main().max_requested_pipeline_stage != NO_PIPELINE_STAGE;
@@ -238,18 +236,18 @@
 }
 
 void ThreadProxy::DidCompletePageScaleAnimation() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->DidCompletePageScaleAnimation();
 }
 
 const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(!main().layer_tree_host->output_surface_lost());
   return main().renderer_capabilities_main_thread_copy;
 }
 
 void ThreadProxy::SetNeedsAnimate() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) {
     TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsAnimate",
                          TRACE_EVENT_SCOPE_THREAD);
@@ -257,7 +255,7 @@
 }
 
 void ThreadProxy::SetNeedsUpdateLayers() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // If we are currently animating, make sure we also update the layers.
   if (main().current_pipeline_stage == ANIMATE_PIPELINE_STAGE) {
     main().final_pipeline_stage =
@@ -271,7 +269,7 @@
 }
 
 void ThreadProxy::SetNeedsCommit() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // If we are currently animating, make sure we don't skip the commit. Note
   // that requesting a commit during the layer update stage means we need to
   // schedule another full commit.
@@ -287,7 +285,7 @@
 }
 
 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->SetRendererCapabilitiesMainCopy(
       impl()
           .layer_tree_host_impl->GetRendererCapabilities()
@@ -296,7 +294,7 @@
 
 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
   TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->DidLoseOutputSurface();
   impl().scheduler->DidLoseOutputSurface();
 }
@@ -321,7 +319,7 @@
 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() {
   TRACE_EVENT0("cc,benchmark",
                "ThreadProxy::DidSwapBuffersCompleteOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->DidSwapBuffersComplete();
   impl().channel_impl->DidCompleteSwapBuffers();
 }
@@ -342,14 +340,14 @@
 
 void ThreadProxy::OnResourcelessSoftareDrawStateChanged(
     bool resourceless_draw) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetResourcelessSoftareDraw(resourceless_draw);
 }
 
 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
   TRACE_EVENT1(
       "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetCanDraw(can_draw);
 }
 
@@ -365,14 +363,14 @@
 
 void ThreadProxy::SetNeedsCommitOnImplThread() {
   TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetNeedsBeginMainFrame();
 }
 
 void ThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) {
   TRACE_EVENT1("cc", "ThreadProxy::SetVideoNeedsBeginFrames",
                "needs_begin_frames", needs_begin_frames);
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   // In tests the layer tree is destroyed after the scheduler is.
   if (impl().scheduler)
     impl().scheduler->SetVideoNeedsBeginFrames(needs_begin_frames);
@@ -382,7 +380,7 @@
     scoped_ptr<AnimationEventsVector> events) {
   TRACE_EVENT0("cc",
                "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->SetAnimationEvents(events.Pass());
 }
 
@@ -390,22 +388,22 @@
 
 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
   TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().channel_main->SetNeedsRedrawOnImpl(damage_rect);
 }
 
 void ThreadProxy::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   SetNeedsRedrawRectOnImplThread(damage_rect);
 }
 
 void ThreadProxy::SetNextCommitWaitsForActivation() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().commit_waits_for_activation = true;
 }
 
 void ThreadProxy::SetDeferCommits(bool defer_commits) {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   if (main().defer_commits == defer_commits)
     return;
 
@@ -419,12 +417,12 @@
 }
 
 void ThreadProxy::SetDeferCommitsOnImpl(bool defer_commits) const {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetDeferCommits(defer_commits);
 }
 
 bool ThreadProxy::CommitRequested() const {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   // TODO(skyostil): Split this into something like CommitRequested() and
   // CommitInProgress().
   return main().current_pipeline_stage != NO_PIPELINE_STAGE ||
@@ -432,50 +430,50 @@
 }
 
 bool ThreadProxy::BeginMainFrameRequested() const {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return main().max_requested_pipeline_stage != NO_PIPELINE_STAGE;
 }
 
 void ThreadProxy::SetNeedsRedrawOnImplThread() {
   TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetNeedsRedraw();
 }
 
 void ThreadProxy::SetNeedsAnimateOnImplThread() {
   TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetNeedsAnimate();
 }
 
 void ThreadProxy::SetNeedsPrepareTilesOnImplThread() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->SetNeedsPrepareTiles();
 }
 
 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().layer_tree_host_impl->SetViewportDamage(damage_rect);
   SetNeedsRedrawOnImplThread();
 }
 
 void ThreadProxy::MainThreadHasStoppedFlinging() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().channel_main->MainThreadHasStoppedFlingingOnImpl();
 }
 
 void ThreadProxy::MainThreadHasStoppedFlingingOnImpl() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().layer_tree_host_impl->MainThreadHasStoppedFlinging();
 }
 
 void ThreadProxy::NotifyInputThrottledUntilCommit() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().channel_main->SetInputThrottledUntilCommitOnImpl(true);
 }
 
 void ThreadProxy::SetInputThrottledUntilCommitOnImpl(bool is_throttled) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (is_throttled == impl().input_throttled_until_commit)
     return;
   impl().input_throttled_until_commit = is_throttled;
@@ -483,36 +481,36 @@
 }
 
 ThreadProxy::MainThreadOnly& ThreadProxy::main() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return main_thread_only_vars_unsafe_;
 }
 const ThreadProxy::MainThreadOnly& ThreadProxy::main() const {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   return main_thread_only_vars_unsafe_;
 }
 
 ThreadProxy::BlockedMainCommitOnly& ThreadProxy::blocked_main_commit() {
-  DCHECK(IsMainThreadBlocked());
   DCHECK(impl().commit_completion_event);
+  DCHECK(task_runner_provider_->IsMainThreadBlocked());
   return main_thread_blocked_commit_vars_unsafe_;
 }
 
 ThreadProxy::CompositorThreadOnly& ThreadProxy::impl() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   return compositor_thread_vars_unsafe_;
 }
 
 const ThreadProxy::CompositorThreadOnly& ThreadProxy::impl() const {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   return compositor_thread_vars_unsafe_;
 }
 
 void ThreadProxy::Start() {
-  DCHECK(IsMainThread());
-  DCHECK(Proxy::HasImplThread());
+  DCHECK(task_runner_provider_->IsMainThread());
+  DCHECK(task_runner_provider_->HasImplThread());
 
   // Create LayerTreeHostImpl.
-  DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+  DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
   CompletionEvent completion;
   main().channel_main->InitializeImplOnImpl(&completion,
                                             main().layer_tree_host);
@@ -525,7 +523,7 @@
 
 void ThreadProxy::Stop() {
   TRACE_EVENT0("cc", "ThreadProxy::Stop");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK(main().started);
 
   // Synchronously finishes pending GL operations and deletes the impl.
@@ -533,13 +531,13 @@
   // by the GL implementation due to the Finish can be executed by the
   // renderer before shutting it down.
   {
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
     CompletionEvent completion;
     main().channel_main->FinishGLOnImpl(&completion);
     completion.Wait();
   }
   {
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
 
     CompletionEvent completion;
     main().channel_main->LayerTreeHostClosedOnImpl(&completion);
@@ -557,7 +555,7 @@
 
 void ThreadProxy::FinishAllRenderingOnImpl(CompletionEvent* completion) {
   TRACE_EVENT0("cc", "ThreadProxy::FinishAllRenderingOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().layer_tree_host_impl->FinishAllRendering();
   completion->Signal();
 }
@@ -599,7 +597,7 @@
   base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now();
 
   TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   DCHECK_EQ(NO_PIPELINE_STAGE, main().current_pipeline_stage);
 
   if (main().defer_commits) {
@@ -691,13 +689,13 @@
   {
     TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit");
 
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
 
     // This CapturePostTasks should be destroyed before CommitComplete() is
     // called since that goes out to the embedder, and we want the embedder
     // to receive its callbacks before that.
     BlockingTaskRunner::CapturePostTasks blocked(
-        blocking_main_thread_task_runner());
+        task_runner_provider_->blocking_main_thread_task_runner());
 
     CompletionEvent completion;
     main().channel_main->StartCommitOnImpl(&completion, main().layer_tree_host,
@@ -714,7 +712,7 @@
 
 void ThreadProxy::BeginMainFrameNotExpectedSoon() {
   TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrameNotExpectedSoon");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->BeginMainFrameNotExpectedSoon();
 }
 
@@ -724,7 +722,8 @@
                                     bool hold_commit_for_activation) {
   TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread");
   DCHECK(!impl().commit_completion_event);
-  DCHECK(IsImplThread() && IsMainThreadBlocked());
+  DCHECK(task_runner_provider_->IsImplThread() &&
+         task_runner_provider_->IsMainThreadBlocked());
   DCHECK(impl().scheduler);
   DCHECK(impl().scheduler->CommitPending());
 
@@ -756,7 +755,7 @@
     base::TimeTicks main_thread_start_time) {
   TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason",
                CommitEarlyOutReasonToString(reason));
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   DCHECK(impl().scheduler);
   DCHECK(impl().scheduler->CommitPending());
   DCHECK(!impl().layer_tree_host_impl->pending_tree());
@@ -773,15 +772,15 @@
 
 void ThreadProxy::ScheduledActionAnimate() {
   TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
 
   impl().layer_tree_host_impl->Animate();
 }
 
 void ThreadProxy::ScheduledActionCommit() {
   TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit");
-  DCHECK(IsImplThread());
-  DCHECK(IsMainThreadBlocked());
+  DCHECK(task_runner_provider_->IsImplThread());
+  DCHECK(task_runner_provider_->IsMainThreadBlocked());
   DCHECK(impl().commit_completion_event);
   DCHECK(blocked_main_commit().layer_tree_host);
 
@@ -818,13 +817,13 @@
 
 void ThreadProxy::ScheduledActionActivateSyncTree() {
   TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().layer_tree_host_impl->ActivateSyncTree();
 }
 
 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
   TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->RequestNewOutputSurface();
 }
 
@@ -832,7 +831,7 @@
   TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
   DrawResult result;
 
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   DCHECK(impl().layer_tree_host_impl.get());
 
   base::AutoReset<bool> mark_inside(&impl().inside_draw, true);
@@ -931,26 +930,26 @@
 }
 
 void ThreadProxy::DidCommitAndDrawFrame() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->DidCommitAndDrawFrame();
 }
 
 void ThreadProxy::DidCompleteSwapBuffers() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->DidCompleteSwapBuffers();
 }
 
 void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) {
   TRACE_EVENT0("cc", "ThreadProxy::SetAnimationEvents");
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->SetAnimationEvents(events.Pass());
 }
 
 void ThreadProxy::InitializeImplOnImpl(CompletionEvent* completion,
                                        LayerTreeHost* layer_tree_host) {
   TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread");
-  DCHECK(IsImplThread());
-  DCHECK(IsMainThreadBlocked());
+  DCHECK(task_runner_provider_->IsImplThread());
+  DCHECK(task_runner_provider_->IsMainThreadBlocked());
   DCHECK(layer_tree_host);
 
   // TODO(khushalsagar): ThreadedChannel will create ProxyImpl here and pass a
@@ -966,10 +965,11 @@
       new CompositorTimingHistory(CompositorTimingHistory::RENDERER_UMA,
                                   impl().rendering_stats_instrumentation));
 
-  impl().scheduler = Scheduler::Create(
-      this, scheduler_settings, impl().layer_tree_host_id,
-      ImplThreadTaskRunner(), impl().external_begin_frame_source.get(),
-      compositor_timing_history.Pass());
+  impl().scheduler =
+      Scheduler::Create(this, scheduler_settings, impl().layer_tree_host_id,
+                        task_runner_provider_->ImplThreadTaskRunner(),
+                        impl().external_begin_frame_source.get(),
+                        compositor_timing_history.Pass());
 
   DCHECK_EQ(impl().scheduler->visible(),
             impl().layer_tree_host_impl->visible());
@@ -979,7 +979,7 @@
 
 void ThreadProxy::InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) {
   TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
 
   LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get();
   bool success = host_impl->InitializeRenderer(output_surface);
@@ -996,7 +996,7 @@
 }
 
 void ThreadProxy::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
 
   // Unlike DidLoseOutputSurfaceOnImplThread, we don't need to call
   // LayerTreeHost::DidLoseOutputSurface since it already knows.
@@ -1007,7 +1007,7 @@
 
 void ThreadProxy::FinishGLOnImpl(CompletionEvent* completion) {
   TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (impl().layer_tree_host_impl->output_surface()) {
     ContextProvider* context_provider =
         impl().layer_tree_host_impl->output_surface()->context_provider();
@@ -1019,8 +1019,8 @@
 
 void ThreadProxy::LayerTreeHostClosedOnImpl(CompletionEvent* completion) {
   TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
-  DCHECK(IsImplThread());
-  DCHECK(IsMainThreadBlocked());
+  DCHECK(task_runner_provider_->IsImplThread());
+  DCHECK(task_runner_provider_->IsMainThreadBlocked());
   impl().scheduler = nullptr;
   impl().external_begin_frame_source = nullptr;
   impl().layer_tree_host_impl = nullptr;
@@ -1033,10 +1033,10 @@
 }
 
 bool ThreadProxy::MainFrameWillHappenForTesting() {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   bool main_frame_will_happen = false;
   {
-    DebugScopedSetMainThreadBlocked main_thread_blocked(this);
+    DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
     CompletionEvent completion;
     main().channel_main->MainFrameWillHappenOnImplForTesting(
         &completion, &main_frame_will_happen);
@@ -1052,7 +1052,7 @@
 void ThreadProxy::MainFrameWillHappenOnImplForTesting(
     CompletionEvent* completion,
     bool* main_frame_will_happen) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   if (impl().layer_tree_host_impl->output_surface()) {
     *main_frame_will_happen = impl().scheduler->MainFrameForTestingWillHappen();
   } else {
@@ -1062,7 +1062,7 @@
 }
 
 void ThreadProxy::RenewTreePriority() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   bool smoothness_takes_priority =
       impl().layer_tree_host_impl->pinch_gesture_active() ||
       impl().layer_tree_host_impl->page_scale_animation_active() ||
@@ -1114,12 +1114,13 @@
 void ThreadProxy::PostDelayedAnimationTaskOnImplThread(
     const base::Closure& task,
     base::TimeDelta delay) {
-  Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, task, delay);
+  task_runner_provider_->ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE,
+                                                                 task, delay);
 }
 
 void ThreadProxy::DidActivateSyncTree() {
   TRACE_EVENT0("cc", "ThreadProxy::DidActivateSyncTreeOnImplThread");
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
 
   if (impl().next_commit_waits_for_activation) {
     TRACE_EVENT_INSTANT0(
@@ -1135,22 +1136,22 @@
 }
 
 void ThreadProxy::WillPrepareTiles() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->WillPrepareTiles();
 }
 
 void ThreadProxy::DidPrepareTiles() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->DidPrepareTiles();
 }
 
 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->DidCompletePageScaleAnimation();
 }
 
 void ThreadProxy::OnDrawForOutputSurface() {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().scheduler->OnDrawForOutputSurface();
 }
 
@@ -1164,7 +1165,7 @@
 void ThreadProxy::UpdateTopControlsStateOnImpl(TopControlsState constraints,
                                                TopControlsState current,
                                                bool animate) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().layer_tree_host_impl->top_controls_manager()->UpdateTopControlsState(
       constraints, current, animate);
 }
@@ -1172,7 +1173,7 @@
 void ThreadProxy::PostFrameTimingEventsOnImplThread(
     scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
     scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
-  DCHECK(IsImplThread());
+  DCHECK(task_runner_provider_->IsImplThread());
   impl().channel_impl->PostFrameTimingEventsOnMain(composite_events.Pass(),
                                                    main_frame_events.Pass());
 }
@@ -1180,7 +1181,7 @@
 void ThreadProxy::PostFrameTimingEventsOnMain(
     scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
     scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
-  DCHECK(IsMainThread());
+  DCHECK(task_runner_provider_->IsMainThread());
   main().layer_tree_host->RecordFrameTimingEvents(composite_events.Pass(),
                                                   main_frame_events.Pass());
 }
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 871d1b2..e11d370a 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -45,8 +45,7 @@
  public:
   static scoped_ptr<Proxy> Create(
       LayerTreeHost* layer_tree_host,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
+      TaskRunnerProvider* task_runner_provider,
       scoped_ptr<BeginFrameSource> external_begin_frame_source);
 
   ~ThreadProxy() override;
@@ -151,6 +150,7 @@
 
   const MainThreadOnly& main() const;
   const CompositorThreadOnly& impl() const;
+  TaskRunnerProvider* task_runner_provider() { return task_runner_provider_; }
 
   // Proxy implementation
   void FinishAllRendering() override;
@@ -239,11 +239,9 @@
   void SetChannel(scoped_ptr<ThreadedChannel> threaded_channel) override;
 
  protected:
-  ThreadProxy(
-      LayerTreeHost* layer_tree_host,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
-      scoped_ptr<BeginFrameSource> external_begin_frame_source);
+  ThreadProxy(LayerTreeHost* layer_tree_host,
+              TaskRunnerProvider* task_runner_provider,
+              scoped_ptr<BeginFrameSource> external_begin_frame_source);
 
  private:
   friend class ThreadProxyForTest;
@@ -309,6 +307,8 @@
 
   DrawResult DrawSwapInternal(bool forced_draw);
 
+  TaskRunnerProvider* task_runner_provider_;
+
   // Use accessors instead of this variable directly.
   MainThreadOnly main_thread_only_vars_unsafe_;
   MainThreadOnly& main();
diff --git a/cc/trees/threaded_channel.cc b/cc/trees/threaded_channel.cc
index 1bcd638..a2cb7831 100644
--- a/cc/trees/threaded_channel.cc
+++ b/cc/trees/threaded_channel.cc
@@ -12,21 +12,16 @@
 
 scoped_ptr<ThreadedChannel> ThreadedChannel::Create(
     ThreadProxy* thread_proxy,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-    scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
+    TaskRunnerProvider* task_runner_provider) {
   return make_scoped_ptr(
-      new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner));
+      new ThreadedChannel(thread_proxy, task_runner_provider));
 }
 
-ThreadedChannel::ThreadedChannel(
-    ThreadProxy* thread_proxy,
-    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-    scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
+ThreadedChannel::ThreadedChannel(ThreadProxy* thread_proxy,
+                                 TaskRunnerProvider* task_runner_provider)
     : proxy_main_(thread_proxy),
       proxy_impl_(thread_proxy),
-      proxy_(thread_proxy),
-      main_task_runner_(main_task_runner),
-      impl_task_runner_(impl_task_runner) {}
+      task_runner_provider_(task_runner_provider) {}
 
 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) {
   ImplThreadTaskRunner()->PostTask(
@@ -231,11 +226,11 @@
 }
 
 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const {
-  return main_task_runner_.get();
+  return task_runner_provider_->MainThreadTaskRunner();
 }
 
 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const {
-  return impl_task_runner_.get();
+  return task_runner_provider_->ImplThreadTaskRunner();
 }
 
 }  // namespace cc
diff --git a/cc/trees/threaded_channel.h b/cc/trees/threaded_channel.h
index 2c7140d..ca7fc04 100644
--- a/cc/trees/threaded_channel.h
+++ b/cc/trees/threaded_channel.h
@@ -70,8 +70,7 @@
       // sequence. Currently ThreadProxy implements both so we pass the pointer
       // and set ProxyImpl.
       ThreadProxy* thread_proxy,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
+      TaskRunnerProvider* task_runner_provider);
 
   ~ThreadedChannel() override;
 
@@ -128,8 +127,7 @@
 
  protected:
   ThreadedChannel(ThreadProxy* thread_proxy,
-                  scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-                  scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
+                  TaskRunnerProvider* task_runner_provider);
 
  private:
   base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
@@ -139,11 +137,7 @@
 
   ProxyImpl* proxy_impl_;
 
-  // TODO(khushalsagar): Temporary variable to access proxy for assertion checks
-  // Remove this once the proxy class is split and the complete
-  // implementation for controlling communication across threads is moved to
-  // ThreadedChannel.
-  Proxy* proxy_;
+  TaskRunnerProvider* task_runner_provider_;
 
   scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
 
diff --git a/cc/trees/threaded_channel_unittest.cc b/cc/trees/threaded_channel_unittest.cc
index 6371f78..e9b6d514 100644
--- a/cc/trees/threaded_channel_unittest.cc
+++ b/cc/trees/threaded_channel_unittest.cc
@@ -30,7 +30,9 @@
                               base::Unretained(this)));
   }
 
-  virtual void StartTestOnImplThread() { DCHECK(proxy()->IsImplThread()); }
+  virtual void StartTestOnImplThread() {
+    DCHECK(task_runner_provider()->IsImplThread());
+  }
 
   void AfterTest() override {}
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java
index 41161f2..87cb047 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java
@@ -44,16 +44,16 @@
     }
 
     /**
-    * Fetches matching rules and returns them via {@link #fetchMatchingRulesCallback}. While the
+    * Fetches matching rules and returns them via {@link #fetchMatchingRulesDone}. While the
     * fetch is underway, it is illegal to make calls to this method.
     */
     @CalledByNative
     protected void fetchMatchingRules() {
-        fetchMatchingRulesCallback(null, null, null);
+        fetchMatchingRulesDone(null, null, null);
     }
 
     /*
-     * {@link #fetchMatchingRulesCallback}  reports the result of {@link #fetchMatchingRules} to
+     * {@link #fetchMatchingRulesDone}  reports the result of {@link #fetchMatchingRules} to
      * the native.
      * @param appPackageName package name of the app that should be matched.
      * @domainPathRegex regex in RE2 syntax that is used for matching URLs.
@@ -62,13 +62,13 @@
      * The three vectors are should have equal length. All three vectors may be empty which
      * implies that no matching rules are active.
      */
-    protected void fetchMatchingRulesCallback(
+    protected void fetchMatchingRulesDone(
             String[] appPackageName, String[] domainPathRegEx, String[] label) {
         // Check if native object is destroyed. This may happen at the time of Chromium shutdown.
         if (mNativeExternalDataUseObserver == 0) {
             return;
         }
-        nativeFetchMatchingRulesCallback(
+        nativeFetchMatchingRulesDone(
                 mNativeExternalDataUseObserver, appPackageName, domainPathRegEx, label);
     }
 
@@ -108,7 +108,7 @@
         nativeOnReportDataUseDone(mNativeExternalDataUseObserver, success);
     }
 
-    public native void nativeFetchMatchingRulesCallback(long nativeExternalDataUseObserver,
+    public native void nativeFetchMatchingRulesDone(long nativeExternalDataUseObserver,
             String[] appPackageName, String[] domainPathRegEx, String[] label);
 
     public native void nativeOnReportDataUseDone(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java
index b70205cc..601b7d41 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java
@@ -32,6 +32,7 @@
 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable;
 import org.chromium.components.bookmarks.BookmarkId;
 import org.chromium.components.variations.VariationsAssociatedData;
+import org.chromium.ui.base.DeviceFormFactor;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
@@ -303,7 +304,8 @@
             // page and there is no network connection.
             if (mEnhancedBookmarksModel.getOfflinePageBridge() != null
                     && !mEnhancedBookmarksModel.getOfflinePageBridge().getAllPages().isEmpty()
-                    && !OfflinePageUtils.isConnected(ApplicationStatus.getApplicationContext())) {
+                    && !OfflinePageUtils.isConnected(mActivity.getApplicationContext())
+                    && !DeviceFormFactor.isTablet(mActivity.getApplicationContext())) {
                 UIState filterState = UIState.createFilterState(
                         EnhancedBookmarkFilter.OFFLINE_PAGES, mEnhancedBookmarksModel);
                 if (state.mState != UIState.STATE_LOADING) {
diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/cdm/MediaDrmCredentialManager.java
similarity index 90%
rename from content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java
rename to chrome/android/java/src/org/chromium/chrome/browser/media/cdm/MediaDrmCredentialManager.java
index 6e3ab7a7..d3efd9e 100644
--- a/content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/cdm/MediaDrmCredentialManager.java
@@ -2,15 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-package org.chromium.content.browser;
+package org.chromium.chrome.browser.media.cdm;
 
 import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.JNINamespace;
 
 /**
  * A wrapper of the android MediaDrmCredentialManager
  */
-@JNINamespace("content")
 public class MediaDrmCredentialManager {
 
     /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
index 3942175..467d523 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
@@ -21,6 +21,8 @@
 import android.widget.TextView;
 
 import org.chromium.chrome.R;
+import org.chromium.chrome.browser.media.cdm.MediaDrmCredentialManager;
+import org.chromium.chrome.browser.media.cdm.MediaDrmCredentialManager.MediaDrmCredentialManagerCallback;
 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
 import org.chromium.chrome.browser.preferences.ChromeBasePreference;
 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
@@ -31,8 +33,6 @@
 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
 import org.chromium.chrome.browser.preferences.ProtectedContentResetCredentialConfirmDialogFragment;
 import org.chromium.chrome.browser.widget.TintedDrawable;
-import org.chromium.content.browser.MediaDrmCredentialManager;
-import org.chromium.content.browser.MediaDrmCredentialManager.MediaDrmCredentialManagerCallback;
 import org.chromium.ui.widget.Toast;
 
 import java.util.ArrayList;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index c51d656..091e627c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -52,6 +52,7 @@
 import org.chromium.chrome.browser.dom_distiller.ReaderModeActivityDelegate;
 import org.chromium.chrome.browser.dom_distiller.ReaderModeManager;
 import org.chromium.chrome.browser.download.ChromeDownloadDelegate;
+import org.chromium.chrome.browser.enhancedbookmarks.EnhancedBookmarkUtils;
 import org.chromium.chrome.browser.fullscreen.FullscreenManager;
 import org.chromium.chrome.browser.help.HelpAndFeedback;
 import org.chromium.chrome.browser.infobar.InfoBarContainer;
@@ -2582,6 +2583,17 @@
     }
 
     /**
+     * Shows the list of offline pages. This should only be hit when offline pages feature is
+     * enabled.
+     */
+    @CalledByNative
+    public void showOfflinePages() {
+        // The offline pages filter view will be loaded by default when offline.
+        boolean shown = EnhancedBookmarkUtils.showEnhancedBookmarkIfEnabled(mActivity);
+        assert shown;
+    }
+
+    /**
      * Request that this tab receive focus. Currently, this function requests focus for the main
      * View (usually a ContentView).
      */
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index 72dfe469..3836721 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -4857,8 +4857,8 @@
   <message name="IDS_STATUSBAR_LAYOUT_UNITED_KINGDOM_DVORAK" desc="In the language menu button, this shows the input mode [UK Dvorak keyboard].">
     UK Dvorak
   </message>
-  <message name="IDS_STATUSBAR_LAYOUT_SLOVAKIA" desc="In the language menu button, this shows the input mode [Slovakian keyboard].">
-    Slovakian
+  <message name="IDS_STATUSBAR_LAYOUT_SLOVAKIA" desc="In the language menu button, this shows the input mode [Slovak keyboard].">
+    Slovak
   </message>
   <message name="IDS_STATUSBAR_LAYOUT_RUSSIA" desc="In the language menu button, this shows the input mode [Russian keyboard].">
     Russian
@@ -5104,8 +5104,8 @@
   <message name="IDS_IME_NAME_KEYBOARD_SERBIAN" desc="The input method name shows in system tray menu, this shows [Serbian keyboard].">
     Serbian keyboard
   </message>
-  <message name="IDS_IME_NAME_KEYBOARD_SLOVAKIAN" desc="The input method name shows in system tray menu, this shows [Slovakian keyboard].">
-    Slovakian keyboard
+  <message name="IDS_IME_NAME_KEYBOARD_SLOVAK" desc="The input method name shows in system tray menu, this shows [Slovak keyboard].">
+    Slovak keyboard
   </message>
   <message name="IDS_IME_NAME_KEYBOARD_SLOVENIAN" desc="The input method name shows in system tray menu, this shows [Slovenian keyboard].">
     Slovenian keyboard
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index e3aabdb..d066557 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8829,6 +8829,11 @@
           Show saved copy
         </message>
       </if>
+      <if expr="is_android">
+        <message name="IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES" desc="Label for the button on an error page to show pages that have been saved offline">
+          Show all saved pages
+        </message>
+      </if>
       <message name="IDS_ERRORPAGE_FUN_DISABLED" desc="Explanation for when easter egg has been disabled by administrator">
         The owner of this device turned off the dinosaur game.
       </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 2835fdc..2eac38e 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -727,6 +727,7 @@
       ":delta_file_proto",
       ":jni_headers",
       "//components/cdm/browser",
+      "//components/data_usage/android",
       "//components/enhanced_bookmarks",
       "//components/precache/content",
       "//components/precache/core",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 93ca2195..8ffb6c8c 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -34,7 +34,7 @@
   "+components/crash",
   "+components/crx_file",
   "+components/data_reduction_proxy",
-  "+components/data_usage/core",
+  "+components/data_usage",
   "+components/data_use_measurement/core",
   "+components/device_event_log",
   "+components/dom_distiller",
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc
index aad6140..50448bcd 100644
--- a/chrome/browser/android/chrome_jni_registrar.cc
+++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -92,6 +92,7 @@
 #include "chrome/browser/interests/android/interests_service.h"
 #include "chrome/browser/invalidation/invalidation_service_factory_android.h"
 #include "chrome/browser/lifetime/application_lifetime_android.h"
+#include "chrome/browser/media/android/cdm/media_drm_credential_manager.h"
 #include "chrome/browser/media/android/remote/record_cast_action.h"
 #include "chrome/browser/media/android/remote/remote_media_player_bridge.h"
 #include "chrome/browser/media/android/router/media_router_android.h"
@@ -279,6 +280,8 @@
     {"LayerTitleCache", chrome::android::RegisterLayerTitleCache},
     {"LocationSettings", LocationSettingsImpl::Register},
     {"LogoBridge", RegisterLogoBridge},
+    {"MediaDrmCredentialManager",
+     MediaDrmCredentialManager::RegisterMediaDrmCredentialManager},
     {"MostVisitedSites", MostVisitedSites::Register},
     {"NativeInfoBar", RegisterNativeInfoBar},
     {"ExternalEstimateProviderAndroid",
diff --git a/chrome/browser/android/data_usage/external_data_use_observer.cc b/chrome/browser/android/data_usage/external_data_use_observer.cc
index 07fbe9d4..9546296 100644
--- a/chrome/browser/android/data_usage/external_data_use_observer.cc
+++ b/chrome/browser/android/data_usage/external_data_use_observer.cc
@@ -139,7 +139,7 @@
       env, j_external_data_use_observer_.obj());
 }
 
-void ExternalDataUseObserver::FetchMatchingRulesCallback(
+void ExternalDataUseObserver::FetchMatchingRulesDone(
     JNIEnv* env,
     jobject obj,
     const base::android::JavaParamRef<jobjectArray>& app_package_name,
@@ -162,12 +162,12 @@
 
   io_task_runner_->PostTask(
       FROM_HERE,
-      base::Bind(&ExternalDataUseObserver::FetchMatchingRulesCallbackOnIOThread,
+      base::Bind(&ExternalDataUseObserver::FetchMatchingRulesDoneOnIOThread,
                  GetIOWeakPtr(), app_package_name_native,
                  domain_path_regex_native, label_native));
 }
 
-void ExternalDataUseObserver::FetchMatchingRulesCallbackOnIOThread(
+void ExternalDataUseObserver::FetchMatchingRulesDoneOnIOThread(
     const std::vector<std::string>& app_package_name,
     const std::vector<std::string>& domain_path_regex,
     const std::vector<std::string>& label) {
@@ -386,6 +386,45 @@
   return false;
 }
 
+ExternalDataUseObserver::DataUseReportKey::DataUseReportKey(
+    const std::string& label,
+    net::NetworkChangeNotifier::ConnectionType connection_type,
+    const std::string& mcc_mnc)
+    : label(label), connection_type(connection_type), mcc_mnc(mcc_mnc) {}
+
+bool ExternalDataUseObserver::DataUseReportKey::operator==(
+    const DataUseReportKey& other) const {
+  return label == other.label && connection_type == other.connection_type &&
+         mcc_mnc == other.mcc_mnc;
+}
+
+ExternalDataUseObserver::DataUseReport::DataUseReport(
+    const base::Time& start_time,
+    const base::Time& end_time,
+    int64_t bytes_downloaded,
+    int64_t bytes_uploaded)
+    : start_time(start_time),
+      end_time(end_time),
+      bytes_downloaded(bytes_downloaded),
+      bytes_uploaded(bytes_uploaded) {}
+
+size_t ExternalDataUseObserver::DataUseReportKeyHash::operator()(
+    const DataUseReportKey& k) const {
+  //  The hash is computed by hashing individual variables and combining them
+  //  using prime numbers. Prime numbers are used for multiplication because the
+  //  number of buckets used by map is always an even number. Using a prime
+  //  number ensures that for two different DataUseReportKey objects (say |j|
+  //  and |k|), if the hash value of |k.label| is equal to hash value of
+  //  |j.mcc_mnc|, then |j| and |k| map to different buckets. Large prime
+  //  numbers are used so that hash value is spread over a larger range.
+  std::hash<std::string> hash_function;
+  size_t hash = 1;
+  hash = hash * 23 + hash_function(k.label);
+  hash = hash * 43 + k.connection_type;
+  hash = hash * 83 + hash_function(k.mcc_mnc);
+  return hash;
+}
+
 ExternalDataUseObserver::MatchingRule::MatchingRule(
     const std::string& app_package_name,
     scoped_ptr<re2::RE2> pattern,
diff --git a/chrome/browser/android/data_usage/external_data_use_observer.h b/chrome/browser/android/data_usage/external_data_use_observer.h
index d9897c9..5caa620 100644
--- a/chrome/browser/android/data_usage/external_data_use_observer.h
+++ b/chrome/browser/android/data_usage/external_data_use_observer.h
@@ -73,7 +73,7 @@
   // non-zero length. The three vectors should have equal length. The vectors
   // may be empty which implies that no matching rules are active. Must be
   // called on UI thread.
-  void FetchMatchingRulesCallback(
+  void FetchMatchingRulesDone(
       JNIEnv* env,
       jobject obj,
       const base::android::JavaParamRef<jobjectArray>& app_package_name,
@@ -113,16 +113,9 @@
   struct DataUseReportKey {
     DataUseReportKey(const std::string& label,
                      net::NetworkChangeNotifier::ConnectionType connection_type,
-                     const std::string& mcc_mnc)
-        : label(label), connection_type(connection_type), mcc_mnc(mcc_mnc) {}
+                     const std::string& mcc_mnc);
 
-    bool operator==(const DataUseReportKey& other) const {
-      return (label == other.label &&
-              connection_type == other.connection_type &&
-              mcc_mnc == other.mcc_mnc);
-    }
-
-    virtual ~DataUseReportKey() {}
+    bool operator==(const DataUseReportKey& other) const;
 
     // Label provided by the matching rules.
     const std::string label;
@@ -148,13 +141,7 @@
     DataUseReport(const base::Time& start_time,
                   const base::Time& end_time,
                   int64_t bytes_downloaded,
-                  int64_t bytes_uploaded)
-        : start_time(start_time),
-          end_time(end_time),
-          bytes_downloaded(bytes_downloaded),
-          bytes_uploaded(bytes_uploaded) {}
-
-    virtual ~DataUseReport() {}
+                  int64_t bytes_uploaded);
 
     // Start time of |this| data report (in UTC since the standard Java epoch of
     // 1970-01-01 00:00:00).
@@ -174,22 +161,8 @@
   class DataUseReportKeyHash {
    public:
     // A simple heuristical hash function that satisifes the property that two
-    // equal data structures have the same hash value. The hash is computed by
-    // hashing individual variables and combining them using prime numbers.
-    // Prime numbers are used for multiplication because the number of buckets
-    // used by map is always an even number. Using a prime number ensures that
-    // for two different DataUseReportKey objects (say |j| and |k|), if the
-    // hash value of |k.label| is equal to hash value of |j.mcc_mnc|, then |j|
-    // and |k| map to different buckets. Large prime numbers are used so that
-    // hash value is spread over a larger range.
-    size_t operator()(const DataUseReportKey& k) const {
-      std::hash<std::string> hash_function;
-      size_t hash = 1;
-      hash = hash * 23 + hash_function(k.label);
-      hash = hash * 43 + k.connection_type;
-      hash = hash * 83 + hash_function(k.mcc_mnc);
-      return hash;
-    }
+    // equal data structures have the same hash value.
+    size_t operator()(const DataUseReportKey& k) const;
   };
 
   typedef base::hash_map<DataUseReportKey, DataUseReport, DataUseReportKeyHash>
@@ -231,10 +204,10 @@
                      data_use_sequence) override;
 
   // Fetches matching rules from Java. Must be called on the UI thread. Returns
-  // result asynchronously on UI thread via FetchMatchingRulesCallback.
+  // result asynchronously on UI thread via FetchMatchingRulesDone.
   void FetchMatchingRulesOnUIThread() const;
 
-  // Called by FetchMatchingRulesCallback on IO thread when new matching rules
+  // Called by FetchMatchingRulesDone on IO thread when new matching rules
   // Adds |data_use| to buffered reports. |data_use| is the data use report
   // received from DataUseAggregator. |data_use| should not be null. |label| is
   // a non-empty label that applies to |data_use|. |start_time| and |end_time|
@@ -252,9 +225,9 @@
   // submitted is the oldest one buffered.
   void SubmitBufferedDataUseReport();
 
-  // Called by |FetchMatchingRulesCallback| on IO thread when new matching rules
-  // have been fetched.
-  void FetchMatchingRulesCallbackOnIOThread(
+  // Called by FetchMatchingRulesDone on IO thread when new matching rules have
+  // been fetched.
+  void FetchMatchingRulesDoneOnIOThread(
       const std::vector<std::string>& app_package_name,
       const std::vector<std::string>& domain_path_regex,
       const std::vector<std::string>& label);
@@ -268,7 +241,7 @@
   // been submitted.
   void OnReportDataUseDoneOnIOThread(bool success);
 
-  // Called by FetchMatchingRulesCallbackIO to register multiple
+  // Called by FetchMatchingRulesDoneOnIOThread to register multiple
   // case-insensitive regular expressions. If the url of the data use request
   // matches any of the regular expression, the observation is passed to the
   // Java listener.
@@ -292,7 +265,7 @@
   // Maintains tab sessions.
   scoped_ptr<DataUseTabModel> data_use_tab_model_;
 
-  // True if callback from |FetchMatchingRulesCallback| is currently pending.
+  // True if callback from |FetchMatchingRulesDone| is currently pending.
   bool matching_rules_fetch_pending_;
 
   // True if callback from |SubmitDataUseReportCallback| is currently pending.
diff --git a/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc b/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc
index 9153ad447..92b3d67e 100644
--- a/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc
+++ b/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc
@@ -15,6 +15,7 @@
 #include "base/thread_task_runner_handle.h"
 #include "components/data_usage/core/data_use.h"
 #include "components/data_usage/core/data_use_aggregator.h"
+#include "components/data_usage/core/data_use_amortizer.h"
 #include "components/data_usage/core/data_use_annotator.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
@@ -37,7 +38,8 @@
     ui_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread(
         content::BrowserThread::UI);
     data_use_aggregator_.reset(new data_usage::DataUseAggregator(
-        scoped_ptr<data_usage::DataUseAnnotator>()));
+        scoped_ptr<data_usage::DataUseAnnotator>(),
+        scoped_ptr<data_usage::DataUseAmortizer>()));
     external_data_use_observer_.reset(new ExternalDataUseObserver(
         data_use_aggregator_.get(), io_task_runner_.get(),
         ui_task_runner_.get()));
@@ -247,7 +249,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
   EXPECT_EQ(0U, external_data_use_observer()->buffered_data_reports_.size());
@@ -279,7 +281,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
 
@@ -324,7 +326,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
 
@@ -392,7 +394,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
 
@@ -442,7 +444,7 @@
   labels.push_back(label_foo);
   labels.push_back(label_bar);
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       labels);
   EXPECT_EQ(0U, external_data_use_observer()->buffered_data_reports_.size());
@@ -521,7 +523,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
 
@@ -562,7 +564,7 @@
   url_regexes.push_back(
       "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*");
 
-  external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread(
+  external_data_use_observer()->FetchMatchingRulesDoneOnIOThread(
       std::vector<std::string>(url_regexes.size(), std::string()), url_regexes,
       std::vector<std::string>(url_regexes.size(), label));
 
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc
index 6749a2c5..6d6fcd0 100644
--- a/chrome/browser/android/offline_pages/offline_page_bridge.cc
+++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc
@@ -7,18 +7,15 @@
 #include "base/android/jni_array.h"
 #include "base/android/jni_string.h"
 #include "base/basictypes.h"
-#include "base/files/file_path.h"
 #include "base/strings/string_util.h"
 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
-#include "chrome/browser/download/download_prefs.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/profiles/profile_android.h"
 #include "components/offline_pages/offline_page_feature.h"
 #include "components/offline_pages/offline_page_item.h"
 #include "components/offline_pages/offline_page_model.h"
 #include "content/public/browser/browser_context.h"
-#include "content/public/browser/download_manager.h"
 #include "content/public/browser/web_contents.h"
 #include "jni/OfflinePageBridge_jni.h"
 #include "net/base/filename_util.h"
@@ -83,9 +80,8 @@
                                      jobject obj,
                                      content::BrowserContext* browser_context)
     : weak_java_ref_(env, obj),
-      offline_page_model_(OfflinePageModelFactory::GetForBrowserContext(
-          browser_context)),
-      browser_context_(browser_context) {
+      offline_page_model_(
+          OfflinePageModelFactory::GetForBrowserContext(browser_context)) {
   NotifyIfDoneLoading();
   offline_page_model_->AddObserver(this);
 }
@@ -171,8 +167,7 @@
   GURL url(web_contents->GetLastCommittedURL());
 
   scoped_ptr<OfflinePageArchiver> archiver(
-      new OfflinePageMHTMLArchiver(
-          web_contents, GetDownloadsPath(browser_context_)));
+      new OfflinePageMHTMLArchiver(web_contents));
 
   offline_page_model_->SavePage(
       url, bookmark_id, archiver.Pass(),
@@ -240,19 +235,6 @@
                         base::CompareCase::INSENSITIVE_ASCII);
 }
 
-// static
-base::FilePath OfflinePageBridge::GetDownloadsPath(
-    content::BrowserContext* browser_context) {
-  content::DownloadManager* manager =
-      content::BrowserContext::GetDownloadManager(browser_context);
-  if (!manager) {
-    DVLOG(1) << "No download manager available in offline page bridge";
-    return base::FilePath();
-  }
-
-  return DownloadPrefs::FromDownloadManager(manager)->DownloadPath();
-}
-
 static jlong Init(JNIEnv* env,
                   const JavaParamRef<jobject>& obj,
                   const JavaParamRef<jobject>& j_profile) {
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.h b/chrome/browser/android/offline_pages/offline_page_bridge.h
index c00fa14..dd105cf 100644
--- a/chrome/browser/android/offline_pages/offline_page_bridge.h
+++ b/chrome/browser/android/offline_pages/offline_page_bridge.h
@@ -9,10 +9,6 @@
 #include "base/android/jni_weak_ref.h"
 #include "components/offline_pages/offline_page_model.h"
 
-namespace base {
-class FilePath;
-}
-
 namespace content {
 class BrowserContext;
 }
@@ -71,14 +67,11 @@
 
  private:
   void NotifyIfDoneLoading() const;
-  static base::FilePath GetDownloadsPath(
-      content::BrowserContext* browser_context);
 
   JavaObjectWeakGlobalRef weak_java_ref_;
   // Not owned.
   OfflinePageModel* offline_page_model_;
-  // Not owned.
-  content::BrowserContext* browser_context_;
+
   DISALLOW_COPY_AND_ASSIGN(OfflinePageBridge);
 };
 
diff --git a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
index ba79d8ff..2f0cc9d9 100644
--- a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
+++ b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
@@ -55,18 +55,14 @@
 }
 
 OfflinePageMHTMLArchiver::OfflinePageMHTMLArchiver(
-    content::WebContents* web_contents,
-    const base::FilePath& archive_dir)
-    : archive_dir_(archive_dir),
-      web_contents_(web_contents),
+    content::WebContents* web_contents)
+    : web_contents_(web_contents),
       weak_ptr_factory_(this) {
   DCHECK(web_contents_);
 }
 
-OfflinePageMHTMLArchiver::OfflinePageMHTMLArchiver(
-    const base::FilePath& archive_dir)
-    : archive_dir_(archive_dir),
-      web_contents_(nullptr),
+OfflinePageMHTMLArchiver::OfflinePageMHTMLArchiver()
+    : web_contents_(nullptr),
       weak_ptr_factory_(this) {
 }
 
@@ -74,16 +70,18 @@
 }
 
 void OfflinePageMHTMLArchiver::CreateArchive(
+    const base::FilePath& archives_dir,
     const CreateArchiveCallback& callback) {
   DCHECK(callback_.is_null());
   DCHECK(!callback.is_null());
   callback_ = callback;
 
-  GenerateMHTML();
+  GenerateMHTML(archives_dir);
 }
 
-void OfflinePageMHTMLArchiver::GenerateMHTML() {
-  if (archive_dir_.empty()) {
+void OfflinePageMHTMLArchiver::GenerateMHTML(
+    const base::FilePath& archives_dir) {
+  if (archives_dir.empty()) {
     DVLOG(1) << "Archive path was empty. Can't create archive.";
     ReportFailure(ArchiverResult::ERROR_ARCHIVE_CREATION_FAILED);
     return;
@@ -101,17 +99,13 @@
     return;
   }
 
-  DoGenerateMHTML();
-}
-
-void OfflinePageMHTMLArchiver::DoGenerateMHTML() {
   // TODO(fgorski): Figure out if the actual URL can be different at
   // the end of MHTML generation. Perhaps we should pull it out after the MHTML
   // is generated.
   GURL url(web_contents_->GetLastCommittedURL());
   base::string16 title(web_contents_->GetTitle());
   base::FilePath file_path(
-      archive_dir_.Append(GenerateFileName(url, base::UTF16ToUTF8(title))));
+      archives_dir.Append(GenerateFileName(url, base::UTF16ToUTF8(title))));
 
   web_contents_->GenerateMHTML(
       file_path, base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone,
diff --git a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h
index 958664b..7d4dc6a 100644
--- a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h
+++ b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h
@@ -47,24 +47,20 @@
   static base::FilePath GenerateFileName(const GURL& url,
                                          const std::string& title);
 
-  OfflinePageMHTMLArchiver(content::WebContents* web_contents,
-                           const base::FilePath& archive_dir);
+  explicit OfflinePageMHTMLArchiver(content::WebContents* web_contents);
   ~OfflinePageMHTMLArchiver() override;
 
   // OfflinePageArchiver implementation:
-  void CreateArchive(const CreateArchiveCallback& callback) override;
+  void CreateArchive(const base::FilePath& archives_dir,
+                     const CreateArchiveCallback& callback) override;
 
  protected:
   // Allows to overload the archiver for testing.
-  explicit OfflinePageMHTMLArchiver(const base::FilePath& archive_dir);
+  OfflinePageMHTMLArchiver();
 
   // Try to generate MHTML.
   // Might be overridden for testing purpose.
-  virtual void GenerateMHTML();
-
-  // Actual call to generate MHTML.
-  // Might be overridden for testing purpose.
-  virtual void DoGenerateMHTML();
+  virtual void GenerateMHTML(const base::FilePath& archives_dir);
 
   // Callback for Generating MHTML.
   void OnGenerateMHTMLDone(const GURL& url,
@@ -80,9 +76,6 @@
   void ReportFailure(ArchiverResult result);
 
  private:
-  // Path to the archive directory. It the path is empty, creation of the
-  // archive will fail.
-  const base::FilePath archive_dir_;
   // Contents of the web page to be serialized. Not owned.
   content::WebContents* web_contents_;
 
diff --git a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver_unittest.cc b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver_unittest.cc
index c26747e..549ce146 100644
--- a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver_unittest.cc
+++ b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver_unittest.cc
@@ -32,14 +32,11 @@
     WEB_CONTENTS_MISSING,
   };
 
-  TestMHTMLArchiver(
-      const GURL& url,
-      const TestScenario test_scenario,
-      const base::FilePath& archive_dir);
+  TestMHTMLArchiver(const GURL& url, const TestScenario test_scenario);
   ~TestMHTMLArchiver() override;
 
  private:
-  void GenerateMHTML() override;
+  void GenerateMHTML(const base::FilePath& archives_dir) override;
 
   const GURL url_;
   const TestScenario test_scenario_;
@@ -47,19 +44,16 @@
   DISALLOW_COPY_AND_ASSIGN(TestMHTMLArchiver);
 };
 
-TestMHTMLArchiver::TestMHTMLArchiver(
-    const GURL& url,
-    const TestScenario test_scenario,
-    const base::FilePath& archive_dir)
-    : OfflinePageMHTMLArchiver(archive_dir),
-      url_(url),
+TestMHTMLArchiver::TestMHTMLArchiver(const GURL& url,
+                                     const TestScenario test_scenario)
+    : url_(url),
       test_scenario_(test_scenario) {
 }
 
 TestMHTMLArchiver::~TestMHTMLArchiver() {
 }
 
-void TestMHTMLArchiver::GenerateMHTML() {
+void TestMHTMLArchiver::GenerateMHTML(const base::FilePath& archives_dir) {
   if (test_scenario_ == TestScenario::WEB_CONTENTS_MISSING) {
     ReportFailure(ArchiverResult::ERROR_CONTENT_UNAVAILABLE);
     return;
@@ -142,8 +136,7 @@
 scoped_ptr<TestMHTMLArchiver> OfflinePageMHTMLArchiverTest::CreateArchiver(
     const GURL& url,
     TestMHTMLArchiver::TestScenario scenario) {
-  return scoped_ptr<TestMHTMLArchiver>(
-      new TestMHTMLArchiver(url, scenario, GetTestFilePath()));
+  return scoped_ptr<TestMHTMLArchiver>(new TestMHTMLArchiver(url, scenario));
 }
 
 void OfflinePageMHTMLArchiverTest::OnCreateArchiveDone(
@@ -172,7 +165,7 @@
   scoped_ptr<TestMHTMLArchiver> archiver(
       CreateArchiver(page_url,
                      TestMHTMLArchiver::TestScenario::WEB_CONTENTS_MISSING));
-  archiver->CreateArchive(callback());
+  archiver->CreateArchive(GetTestFilePath(), callback());
 
   EXPECT_EQ(archiver.get(), last_archiver());
   EXPECT_EQ(OfflinePageArchiver::ArchiverResult::ERROR_CONTENT_UNAVAILABLE,
@@ -186,7 +179,7 @@
   scoped_ptr<TestMHTMLArchiver> archiver(
       CreateArchiver(page_url,
                      TestMHTMLArchiver::TestScenario::NOT_ABLE_TO_ARCHIVE));
-  archiver->CreateArchive(callback());
+  archiver->CreateArchive(GetTestFilePath(), callback());
 
   EXPECT_EQ(archiver.get(), last_archiver());
   EXPECT_EQ(OfflinePageArchiver::ArchiverResult::ERROR_ARCHIVE_CREATION_FAILED,
@@ -201,7 +194,7 @@
   scoped_ptr<TestMHTMLArchiver> archiver(
       CreateArchiver(page_url,
                      TestMHTMLArchiver::TestScenario::SUCCESS));
-  archiver->CreateArchive(callback());
+  archiver->CreateArchive(GetTestFilePath(), callback());
   PumpLoop();
 
   EXPECT_EQ(archiver.get(), last_archiver());
diff --git a/chrome/browser/android/offline_pages/offline_page_model_factory.cc b/chrome/browser/android/offline_pages/offline_page_model_factory.cc
index 8b5a15b..cb9e9f57a 100644
--- a/chrome/browser/android/offline_pages/offline_page_model_factory.cc
+++ b/chrome/browser/android/offline_pages/offline_page_model_factory.cc
@@ -10,7 +10,7 @@
 #include "base/sequenced_task_runner.h"
 #include "chrome/browser/profiles/incognito_helpers.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_constants.h"
 #include "components/keyed_service/content/browser_context_dependency_manager.h"
 #include "components/offline_pages/offline_page_metadata_store_impl.h"
 #include "components/offline_pages/offline_page_model.h"
@@ -39,15 +39,21 @@
 
 KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor(
     content::BrowserContext* context) const {
+  Profile* profile = Profile::FromBrowserContext(context);
   scoped_refptr<base::SequencedTaskRunner> background_task_runner =
       content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
           content::BrowserThread::GetBlockingPool()->GetSequenceToken());
-  base::FilePath store_path;
-  CHECK(PathService::Get(chrome::DIR_OFFLINE_PAGE_METADATA, &store_path));
+
+  base::FilePath store_path =
+      profile->GetPath().Append(chrome::kOfflinePageMetadataDirname);
   scoped_ptr<OfflinePageMetadataStoreImpl> metadata_store(
       new OfflinePageMetadataStoreImpl(background_task_runner, store_path));
 
-  return new OfflinePageModel(metadata_store.Pass(), background_task_runner);
+  base::FilePath archives_dir =
+      profile->GetPath().Append(chrome::kOfflinePageArchviesDirname);
+
+  return new OfflinePageModel(metadata_store.Pass(), archives_dir,
+                              background_task_runner);
 }
 
 content::BrowserContext* OfflinePageModelFactory::GetBrowserContextToUse(
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc
index 029e636..2d0e15b5 100644
--- a/chrome/browser/android/tab_android.cc
+++ b/chrome/browser/android/tab_android.cc
@@ -287,6 +287,20 @@
   }
 }
 
+bool TabAndroid::HasOfflinePages() const {
+   if (!offline_pages::IsOfflinePagesEnabled())
+    return false;
+  offline_pages::OfflinePageModel* offline_page_model =
+      offline_pages::OfflinePageModelFactory::GetForBrowserContext(
+          GetProfile());
+  return !offline_page_model->GetAllPages().empty();
+}
+
+void TabAndroid::ShowOfflinePages() {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_Tab_showOfflinePages(env, weak_java_tab_.get(env).obj());
+}
+
 void TabAndroid::SwapTabContents(content::WebContents* old_contents,
                                  content::WebContents* new_contents,
                                  bool did_start_load,
diff --git a/chrome/browser/android/tab_android.h b/chrome/browser/android/tab_android.h
index d1a05d6..ccf65d01 100644
--- a/chrome/browser/android/tab_android.h
+++ b/chrome/browser/android/tab_android.h
@@ -126,6 +126,9 @@
       chrome::NavigateParams* params,
       content::NavigationController::LoadURLParams* load_url_params);
 
+  bool HasOfflinePages() const;
+  void ShowOfflinePages();
+
   // Overridden from CoreTabHelperDelegate:
   void SwapTabContents(content::WebContents* old_contents,
                        content::WebContents* new_contents,
diff --git a/chrome/browser/autofill/autofill_server_browsertest.cc b/chrome/browser/autofill/autofill_server_browsertest.cc
index 6ba735f..18498d1 100644
--- a/chrome/browser/autofill/autofill_server_browsertest.cc
+++ b/chrome/browser/autofill/autofill_server_browsertest.cc
@@ -20,6 +20,7 @@
 #include "components/autofill/core/browser/personal_data_manager.h"
 #include "components/autofill/core/browser/personal_data_manager_observer.h"
 #include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/compression/compression_utils.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
 #include "net/url_request/test_url_fetcher_factory.h"
@@ -91,6 +92,13 @@
   DISALLOW_COPY_AND_ASSIGN(WindowedNetworkObserver);
 };
 
+// Compresses |data| and returns the result.
+std::string Compress(const std::string& data) {
+  std::string compressed_data;
+  EXPECT_TRUE(compression::GzipCompress(data, &compressed_data));
+  return compressed_data;
+}
+
 }  // namespace
 
 class AutofillServerTest : public InProcessBrowserTest  {
@@ -149,7 +157,7 @@
       "<field signature=\"3494787134\" name=\"three\" type=\"text\"/>"
       "<field signature=\"1236501728\" name=\"four\" type=\"text\"/></form>"
       "</autofillquery>";
-  WindowedNetworkObserver query_network_observer(kQueryRequest);
+  WindowedNetworkObserver query_network_observer(Compress(kQueryRequest));
   ui_test_utils::NavigateToURL(
       browser(), GURL(std::string(kDataURIPrefix) + kFormHtml));
   query_network_observer.Wait();
@@ -174,7 +182,7 @@
       " autocomplete=\"off\" autofilltype=\"2\"/>"
       "</autofillupload>";
 
-  WindowedNetworkObserver upload_network_observer(kUploadRequest);
+  WindowedNetworkObserver upload_network_observer(Compress(kUploadRequest));
   content::WebContents* web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
   content::SimulateMouseClick(
@@ -203,7 +211,7 @@
       "<field signature=\"2750915947\" name=\"two\" type=\"text\"/>"
       "<field signature=\"116843943\" name=\"three\" type=\"password\"/>"
       "</form></autofillquery>";
-  WindowedNetworkObserver query_network_observer(kQueryRequest);
+  WindowedNetworkObserver query_network_observer(Compress(kQueryRequest));
   ui_test_utils::NavigateToURL(
       browser(), GURL(std::string(kDataURIPrefix) + kFormHtml));
   query_network_observer.Wait();
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index fb18e51d..48d69db 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -765,8 +765,8 @@
 #endif  // defined(OS_ANDROID)
 
   // Record collected startup metrics.
-  startup_metric_utils::RecordBrowserMainMessageLoopStart(base::Time::Now(),
-                                                          is_first_run);
+  startup_metric_utils::RecordBrowserMainMessageLoopStart(
+      base::TimeTicks::Now(), is_first_run);
 }
 
 // -----------------------------------------------------------------------------
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index 7bcfa25..f463ef30 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -298,7 +298,7 @@
     {"__MSG_KEYBOARD_RUSSIAN__", IDS_IME_NAME_KEYBOARD_RUSSIAN},
     {"__MSG_KEYBOARD_SERBIAN__", IDS_IME_NAME_KEYBOARD_SERBIAN},
     {"__MSG_KEYBOARD_SINHALA__", IDS_IME_NAME_KEYBOARD_SINHALA},
-    {"__MSG_KEYBOARD_SLOVAKIAN__", IDS_IME_NAME_KEYBOARD_SLOVAKIAN},
+    {"__MSG_KEYBOARD_SLOVAK__", IDS_IME_NAME_KEYBOARD_SLOVAK},
     {"__MSG_KEYBOARD_SLOVENIAN__", IDS_IME_NAME_KEYBOARD_SLOVENIAN},
     {"__MSG_KEYBOARD_SORANIKURDISH_AR__",
      IDS_IME_NAME_KEYBOARD_SORANIKURDISH_AR},
diff --git a/chrome/browser/chromeos/login/webview_login_browsertest.cc b/chrome/browser/chromeos/login/webview_login_browsertest.cc
index 93009ca..bfb1fa2 100644
--- a/chrome/browser/chromeos/login/webview_login_browsertest.cc
+++ b/chrome/browser/chromeos/login/webview_login_browsertest.cc
@@ -21,62 +21,77 @@
     OobeBaseTest::SetUpCommandLine(command_line);
   }
 
+ protected:
+  void ClickNext() {
+    ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
+  }
+
+  void ExpectIdentifierPage() {
+    // First page: no back button, no close button, #identifier input field.
+    JsExpect("!$('gaia-navigation').backVisible");
+    JsExpect("!$('gaia-navigation').closeVisible");
+    JsExpect("$('signin-frame').src.indexOf('#identifier') != -1");
+  }
+
+  void ExpectPasswordPage() {
+    // Second page: back button, no close button, #challengepassword input
+    // field.
+    JsExpect("$('gaia-navigation').backVisible");
+    JsExpect("!$('gaia-navigation').closeVisible");
+    JsExpect("$('signin-frame').src.indexOf('#challengepassword') != -1");
+  }
+
  private:
   DISALLOW_COPY_AND_ASSIGN(WebviewLoginTest);
 };
 
+// Basic signin with username and password.
 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, Basic) {
   WaitForGaiaPageLoad();
 
-  JsExpect("!$('gaia-navigation').closeVisible");
+  ExpectIdentifierPage();
 
   SetSignFormField("identifier", OobeBaseTest::kFakeUserEmail);
-  ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
-
-  JsExpect("!$('gaia-navigation').closeVisible");
+  ClickNext();
+  ExpectPasswordPage();
 
   content::WindowedNotificationObserver session_start_waiter(
       chrome::NOTIFICATION_SESSION_STARTED,
       content::NotificationService::AllSources());
 
   SetSignFormField("password", OobeBaseTest::kFakeUserPassword);
-  ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
+  ClickNext();
 
   session_start_waiter.Wait();
 }
 
-// Flaky: http://crbug.com/512648.
+// Fails: http://crbug.com/512648.
 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, DISABLED_BackButton) {
   WaitForGaiaPageLoad();
 
-  // Start: no back button, first page.
-  JsExpect("!$('gaia-navigation').backVisible");
-  JsExpect("$('signin-frame').src.indexOf('#identifier') != -1");
+  // Start with identifer page.
+  ExpectIdentifierPage();
 
-  // Next step: back button active, second page.
+  // Move to password page.
   SetSignFormField("identifier", OobeBaseTest::kFakeUserEmail);
-  ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
-  JsExpect("$('gaia-navigation').backVisible");
-  JsExpect("$('signin-frame').src.indexOf('#challengepassword') != -1");
+  ClickNext();
+  ExpectPasswordPage();
 
-  // One step back: no back button, first page.
-  ASSERT_TRUE(
-      content::ExecuteScript(GetLoginUI()->GetWebContents(),
-                             "$('gaia-navigation').$.backButton.click();"));
-  JsExpect("!$('gaia-navigation').backVisible");
-  JsExpect("$('signin-frame').src.indexOf('#identifier') != -1");
+  // Click back to identifier page.
+  JS().Evaluate("$('gaia-navigation').$.backButton.click();");
+  ExpectIdentifierPage();
 
-  // Next step (again): back button active, second page, user id remembered.
-  ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
-  JsExpect("$('gaia-navigation').backVisible");
-  JsExpect("$('signin-frame').src.indexOf('#challengepassword') != -1");
+  // Click next to password page, user id is remembered.
+  ClickNext();
+  ExpectPasswordPage();
 
   content::WindowedNotificationObserver session_start_waiter(
       chrome::NOTIFICATION_SESSION_STARTED,
       content::NotificationService::AllSources());
 
+  // Finish sign-up.
   SetSignFormField("password", OobeBaseTest::kFakeUserPassword);
-  ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
+  ClickNext();
 
   session_start_waiter.Wait();
 }
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc
new file mode 100644
index 0000000..26c425e
--- /dev/null
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc
@@ -0,0 +1,87 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h"
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_content_client.h"
+#include "chrome/common/chrome_switches.h"
+#include "net/base/net_errors.h"
+#include "net/cert/cert_verifier.h"
+#include "net/cert/cert_verify_result.h"
+#include "net/cert/x509_certificate.h"
+#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_context_builder.h"
+
+namespace extensions {
+
+// Class verifies certificate by its fingerprint received using different
+// channel. It's the only know information about device with self-signed
+// certificate.
+class FingerprintVerifier : public net::CertVerifier {
+ public:
+  explicit FingerprintVerifier(
+      const net::SHA256HashValue& certificate_fingerprint)
+      : certificate_fingerprint_(certificate_fingerprint) {}
+
+  int Verify(net::X509Certificate* cert,
+             const std::string& hostname,
+             const std::string& ocsp_response,
+             int flags,
+             net::CRLSet* crl_set,
+             net::CertVerifyResult* verify_result,
+             const net::CompletionCallback& callback,
+             scoped_ptr<Request>* out_req,
+             const net::BoundNetLog& net_log) override {
+    // Mark certificate as invalid as we didn't check it.
+    verify_result->Reset();
+    verify_result->verified_cert = cert;
+    verify_result->cert_status = net::CERT_STATUS_INVALID;
+
+    auto fingerprint =
+        net::X509Certificate::CalculateFingerprint256(cert->os_cert_handle());
+
+    return certificate_fingerprint_.Equals(fingerprint) ? net::OK
+                                                        : net::ERR_CERT_INVALID;
+  }
+
+ private:
+  net::SHA256HashValue certificate_fingerprint_;
+
+  DISALLOW_COPY_AND_ASSIGN(FingerprintVerifier);
+};
+
+PrivetV3ContextGetter::PrivetV3ContextGetter(
+    const scoped_refptr<base::SingleThreadTaskRunner>& net_task_runner,
+    const net::SHA256HashValue& certificate_fingerprint)
+    : verifier_(new FingerprintVerifier(certificate_fingerprint)),
+      net_task_runner_(net_task_runner) {
+  CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+      switches::kEnablePrivetV3));
+}
+
+net::URLRequestContext* PrivetV3ContextGetter::GetURLRequestContext() {
+  DCHECK(net_task_runner_->BelongsToCurrentThread());
+  if (!context_) {
+    net::URLRequestContextBuilder builder;
+    builder.set_proxy_service(net::ProxyService::CreateDirect());
+    builder.SetSpdyAndQuicEnabled(false, false);
+    builder.DisableHttpCache();
+    builder.SetCertVerifier(verifier_.Pass());
+    builder.set_user_agent(::GetUserAgent());
+    context_ = builder.Build();
+  }
+  return context_.get();
+}
+
+scoped_refptr<base::SingleThreadTaskRunner>
+PrivetV3ContextGetter::GetNetworkTaskRunner() const {
+  return net_task_runner_;
+}
+
+PrivetV3ContextGetter::~PrivetV3ContextGetter() {
+  DCHECK(net_task_runner_->BelongsToCurrentThread());
+}
+
+}  // namespace extensions
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h
new file mode 100644
index 0000000..5bef50ba
--- /dev/null
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_CONTEXT_GETTER_H_
+#define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_CONTEXT_GETTER_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+#include "net/url_request/url_request_context_getter.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace net {
+class CertVerifier;
+class URLRequestContext;
+struct SHA256HashValue;
+}
+
+namespace extensions {
+
+class PrivetV3ContextGetter : public net::URLRequestContextGetter {
+ public:
+  PrivetV3ContextGetter(
+      const scoped_refptr<base::SingleThreadTaskRunner>& net_task_runner,
+      const net::SHA256HashValue& certificate_fingerprint);
+
+  net::URLRequestContext* GetURLRequestContext() override;
+
+  scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
+      const override;
+
+ protected:
+  ~PrivetV3ContextGetter() override;
+
+ private:
+  scoped_ptr<net::CertVerifier> verifier_;
+  scoped_ptr<net::URLRequestContext> context_;
+  scoped_refptr<base::SingleThreadTaskRunner> net_task_runner_;
+
+  DISALLOW_COPY_AND_ASSIGN(PrivetV3ContextGetter);
+};
+
+}  // namespace extensions
+
+#endif  // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_CONTEXT_GETTER_H_
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index ec1f91ea..35ed57e4 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -43,6 +43,7 @@
 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h"
+#include "components/data_usage/core/data_use_amortizer.h"
 #include "components/net_log/chrome_net_log.h"
 #include "components/policy/core/common/policy_service.h"
 #include "components/proxy_config/pref_proxy_config_tracker.h"
@@ -115,6 +116,7 @@
 #include "base/android/build_info.h"
 #include "chrome/browser/android/data_usage/external_data_use_observer.h"
 #include "chrome/browser/android/net/external_estimate_provider_android.h"
+#include "components/data_usage/android/traffic_stats_amortizer.h"
 #endif
 
 #if defined(OS_CHROMEOS)
@@ -606,9 +608,15 @@
       extension_event_router_forwarder_;
 #endif
 
+  scoped_ptr<data_usage::DataUseAmortizer> data_use_amortizer;
+#if defined(OS_ANDROID)
+  data_use_amortizer.reset(new data_usage::android::TrafficStatsAmortizer());
+#endif
+
   data_use_aggregator_.reset(new data_usage::DataUseAggregator(
       scoped_ptr<data_usage::DataUseAnnotator>(
-          new chrome_browser_data_usage::TabIdAnnotator())));
+          new chrome_browser_data_usage::TabIdAnnotator()),
+      data_use_amortizer.Pass()));
 
   // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
   // is fixed.
diff --git a/chrome/browser/local_discovery/privet_http_impl.cc b/chrome/browser/local_discovery/privet_http_impl.cc
index 4c534ce..b3e168a 100644
--- a/chrome/browser/local_discovery/privet_http_impl.cc
+++ b/chrome/browser/local_discovery/privet_http_impl.cc
@@ -11,19 +11,15 @@
 #include "base/command_line.h"
 #include "base/location.h"
 #include "base/rand_util.h"
-#include "base/single_thread_task_runner.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/thread_task_runner_handle.h"
+#include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h"
 #include "chrome/browser/local_discovery/privet_constants.h"
 #include "chrome/common/chrome_content_client.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/cloud_print/cloud_print_constants.h"
 #include "net/base/url_util.h"
-#include "net/cert/cert_verifier.h"
-#include "net/cert/cert_verify_result.h"
-#include "net/url_request/url_request_context.h"
-#include "net/url_request/url_request_context_builder.h"
 #include "url/gurl.h"
 
 #if defined(ENABLE_PRINT_PREVIEW)
@@ -89,85 +85,6 @@
   return url.ReplaceComponents(replacements);
 }
 
-// Class verifies certificate by its fingerprint received using different
-// channel. It's the only know information about device with self-signed
-// certificate.
-class FingerprintVerifier : public net::CertVerifier {
- public:
-  explicit FingerprintVerifier(
-      const net::SHA256HashValue& certificate_fingerprint)
-      : certificate_fingerprint_(certificate_fingerprint) {}
-
-  int Verify(net::X509Certificate* cert,
-             const std::string& hostname,
-             const std::string& ocsp_response,
-             int flags,
-             net::CRLSet* crl_set,
-             net::CertVerifyResult* verify_result,
-             const net::CompletionCallback& callback,
-             scoped_ptr<Request>* out_req,
-             const net::BoundNetLog& net_log) override {
-    // Mark certificate as invalid as we didn't check it.
-    verify_result->Reset();
-    verify_result->verified_cert = cert;
-    verify_result->cert_status = net::CERT_STATUS_INVALID;
-
-    auto fingerprint =
-        net::X509Certificate::CalculateFingerprint256(cert->os_cert_handle());
-
-    return certificate_fingerprint_.Equals(fingerprint) ? net::OK
-                                                        : net::ERR_CERT_INVALID;
-  }
-
- private:
-  net::SHA256HashValue certificate_fingerprint_;
-
-  DISALLOW_COPY_AND_ASSIGN(FingerprintVerifier);
-};
-
-class PrivetContextGetter : public net::URLRequestContextGetter {
- public:
-  PrivetContextGetter(
-      const scoped_refptr<base::SingleThreadTaskRunner>& net_task_runner,
-      const net::SHA256HashValue& certificate_fingerprint)
-      : verifier_(new FingerprintVerifier(certificate_fingerprint)),
-        net_task_runner_(net_task_runner) {
-    CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
-        switches::kEnablePrivetV3));
-  }
-
-  net::URLRequestContext* GetURLRequestContext() override {
-    DCHECK(net_task_runner_->BelongsToCurrentThread());
-    if (!context_) {
-      net::URLRequestContextBuilder builder;
-      builder.set_proxy_service(net::ProxyService::CreateDirect());
-      builder.SetSpdyAndQuicEnabled(false, false);
-      builder.DisableHttpCache();
-      builder.SetCertVerifier(verifier_.Pass());
-      builder.set_user_agent(::GetUserAgent());
-      context_ = builder.Build();
-    }
-    return context_.get();
-  }
-
-  scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
-      const override {
-    return net_task_runner_;
-  }
-
- protected:
-  ~PrivetContextGetter() override {
-    DCHECK(net_task_runner_->BelongsToCurrentThread());
-  }
-
- private:
-  scoped_ptr<net::CertVerifier> verifier_;
-  scoped_ptr<net::URLRequestContext> context_;
-  scoped_refptr<base::SingleThreadTaskRunner> net_task_runner_;
-
-  DISALLOW_COPY_AND_ASSIGN(PrivetContextGetter);
-};
-
 }  // namespace
 
 PrivetInfoOperationImpl::PrivetInfoOperationImpl(
@@ -826,7 +743,7 @@
     const net::SHA256HashValue& certificate_fingerprint) {
   use_https_ = true;
   host_port_.set_port(port);
-  context_getter_ = new PrivetContextGetter(
+  context_getter_ = new extensions::PrivetV3ContextGetter(
       context_getter_->GetNetworkTaskRunner(), certificate_fingerprint);
 }
 
diff --git a/chrome/browser/mac/mac_startup_profiler.cc b/chrome/browser/mac/mac_startup_profiler.cc
index 95aa7d8d..91a8719 100644
--- a/chrome/browser/mac/mac_startup_profiler.cc
+++ b/chrome/browser/mac/mac_startup_profiler.cc
@@ -20,24 +20,19 @@
 }
 
 void MacStartupProfiler::Profile(Location location) {
-  profiled_times_[location] = base::Time::Now();
+  profiled_ticks_[location] = base::TimeTicks::Now();
 }
 
 void MacStartupProfiler::RecordMetrics() {
-  const base::Time main_entry_time = startup_metric_utils::MainEntryPointTime();
-  DCHECK(!main_entry_time.is_null());
+  const base::TimeTicks main_entry_ticks =
+      startup_metric_utils::MainEntryPointTicks();
+  DCHECK(!main_entry_ticks.is_null());
   DCHECK(!recorded_metrics_);
 
   recorded_metrics_ = true;
 
-  for (std::map<Location, base::Time>::const_iterator it =
-           profiled_times_.begin();
-       it != profiled_times_.end();
-       ++it) {
-    const base::Time& location_time = it->second;
-    base::TimeDelta delta = location_time - main_entry_time;
-    RecordHistogram(it->first, delta);
-  }
+  for (const std::pair<Location, base::TimeTicks>& entry : profiled_ticks_)
+    RecordHistogram(entry.first, entry.second - main_entry_ticks);
 }
 
 const std::string MacStartupProfiler::HistogramName(Location location) {
diff --git a/chrome/browser/mac/mac_startup_profiler.h b/chrome/browser/mac/mac_startup_profiler.h
index 05dcf6c..da36c60 100644
--- a/chrome/browser/mac/mac_startup_profiler.h
+++ b/chrome/browser/mac/mac_startup_profiler.h
@@ -51,7 +51,7 @@
   void RecordHistogram(Location location, const base::TimeDelta& delta);
 
   // Keeps track of the time at which each initialization phase was reached.
-  std::map<Location, base::Time> profiled_times_;
+  std::map<Location, base::TimeTicks> profiled_ticks_;
 
   // Whether UMA metrics have been recorded. Only record UMA metrics once.
   bool recorded_metrics_;
diff --git a/content/browser/media/android/media_drm_credential_manager.cc b/chrome/browser/media/android/cdm/media_drm_credential_manager.cc
similarity index 91%
rename from content/browser/media/android/media_drm_credential_manager.cc
rename to chrome/browser/media/android/cdm/media_drm_credential_manager.cc
index 11b7463d..26cbeca 100644
--- a/content/browser/media/android/media_drm_credential_manager.cc
+++ b/chrome/browser/media/android/cdm/media_drm_credential_manager.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "content/browser/media/android/media_drm_credential_manager.h"
+#include "chrome/browser/media/android/cdm/media_drm_credential_manager.h"
 
 #include "base/android/jni_android.h"
 #include "base/android/scoped_java_ref.h"
@@ -25,17 +25,15 @@
     const ScopedJavaGlobalRef<jobject>& j_media_drm_credential_manager_callback,
     bool succeeded) {
   JNIEnv* env = base::android::AttachCurrentThread();
-  content::Java_MediaDrmCredentialManagerCallback_onCredentialResetFinished(
+  Java_MediaDrmCredentialManagerCallback_onCredentialResetFinished(
       env, j_media_drm_credential_manager_callback.obj(), succeeded);
 }
 
 }  // namespace
 
-namespace content {
+MediaDrmCredentialManager::MediaDrmCredentialManager() {}
 
-MediaDrmCredentialManager::MediaDrmCredentialManager() {};
-
-MediaDrmCredentialManager::~MediaDrmCredentialManager() {};
+MediaDrmCredentialManager::~MediaDrmCredentialManager() {}
 
 // static
 MediaDrmCredentialManager* MediaDrmCredentialManager::GetInstance() {
@@ -115,5 +113,3 @@
 bool MediaDrmCredentialManager::RegisterMediaDrmCredentialManager(JNIEnv* env) {
   return RegisterNativesImpl(env);
 }
-
-}  // namespace content
diff --git a/content/browser/media/android/media_drm_credential_manager.h b/chrome/browser/media/android/cdm/media_drm_credential_manager.h
similarity index 89%
rename from content/browser/media/android/media_drm_credential_manager.h
rename to chrome/browser/media/android/cdm/media_drm_credential_manager.h
index d5cbb0c..5bf88eb 100644
--- a/content/browser/media/android/media_drm_credential_manager.h
+++ b/chrome/browser/media/android/cdm/media_drm_credential_manager.h
@@ -2,18 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
-#define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
+#ifndef CHROME_BROWSER_MEDIA_ANDROID_CDM_MEDIA_DRM_CREDENTIAL_MANAGER_H_
+#define CHROME_BROWSER_MEDIA_ANDROID_CDM_MEDIA_DRM_CREDENTIAL_MANAGER_H_
 
 #include <jni.h>
 #include <string>
 
 #include "base/callback.h"
+#include "base/macros.h"
 #include "base/memory/singleton.h"
 #include "media/base/android/media_drm_bridge.h"
 
-namespace content {
-
 // This class manages the media DRM credentials on Android.
 class MediaDrmCredentialManager {
  public:
@@ -60,6 +59,4 @@
   DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager);
 };
 
-}  // namespace content
-
-#endif  // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
+#endif  // CHROME_BROWSER_MEDIA_ANDROID_CDM_MEDIA_DRM_CREDENTIAL_MANAGER_H_
diff --git a/chrome/browser/media/router/media_router.gyp b/chrome/browser/media/router/media_router.gyp
index 186c749..69136ce 100644
--- a/chrome/browser/media/router/media_router.gyp
+++ b/chrome/browser/media/router/media_router.gyp
@@ -27,9 +27,6 @@
       ],
       'conditions': [
         [ 'OS!="android" and OS!="ios"', {
-          'include_dirs': [
-            '<(DEPTH)/third_party/mojo/src',
-          ],
           'dependencies': [
             # media_router_type_converters.h needs the generated file.
             'media_router_mojo_gen',
@@ -40,7 +37,7 @@
             '<@(media_router_non_android_sources)',
           ]
         }],
-      ]     
+      ]
     },
     {
       # Mojo compiler for the Media Router internal API.
@@ -56,9 +53,6 @@
     {
       'target_name': 'media_router_mojo',
       'type': 'static_library',
-      'include_dirs': [
-        '<(DEPTH)/third_party/mojo/src',
-      ],
       'dependencies': [
         'media_router_mojo_gen',
       ],
@@ -73,7 +67,6 @@
       'type': 'static_library',
       'include_dirs': [
         '<(DEPTH)',
-        '<(DEPTH)/third_party/mojo/src',
       ],
       'dependencies': [
         'media_router',
diff --git a/chrome/browser/metrics/first_web_contents_profiler.cc b/chrome/browser/metrics/first_web_contents_profiler.cc
index 17662e9..8626bf4 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.cc
+++ b/chrome/browser/metrics/first_web_contents_profiler.cc
@@ -56,7 +56,7 @@
   }
 
   collected_paint_metric_ = true;
-  const base::Time now = base::Time::Now();
+  const base::TimeTicks now = base::TimeTicks::Now();
   // Record the old metric unconditionally.
   startup_metric_utils::RecordDeprecatedFirstWebContentsNonEmptyPaint(now);
   if (!finished_)
@@ -78,7 +78,7 @@
   }
 
   collected_load_metric_ = true;
-  const base::Time now = base::Time::Now();
+  const base::TimeTicks now = base::TimeTicks::Now();
   // Record the old metric unconditionally.
   startup_metric_utils::RecordDeprecatedFirstWebContentsMainFrameLoad(now);
   if (!finished_)
@@ -102,7 +102,7 @@
 
   collected_main_navigation_start_metric_ = true;
   startup_metric_utils::RecordFirstWebContentsMainNavigationStart(
-      base::Time::Now());
+      base::TimeTicks::Now());
 }
 
 void FirstWebContentsProfiler::DidFinishNavigation(
@@ -138,7 +138,7 @@
 
   collected_main_navigation_finished_metric_ = true;
   startup_metric_utils::RecordFirstWebContentsMainNavigationFinished(
-      base::Time::Now());
+      base::TimeTicks::Now());
 }
 
 void FirstWebContentsProfiler::WasHidden() {
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 852c7552..507ce90f 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -34,6 +34,7 @@
 #include "chrome/browser/net/safe_search_util.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/task_management/task_manager_interface.h"
+#include "chrome/common/chrome_constants.h"
 #include "chrome/common/pref_names.h"
 #include "components/content_settings/core/browser/cookie_settings.h"
 #include "components/data_usage/core/data_use_aggregator.h"
@@ -678,6 +679,15 @@
   if (external_storage_path.IsParent(path))
     return true;
 
+  // Allow to load offline pages, which are stored in the $PROFILE_PATH/Offline
+  // Pages/archives.
+  if (!profile_path_.empty()) {
+    const base::FilePath offline_page_archives =
+        profile_path_.Append(chrome::kOfflinePageArchviesDirname);
+    if (offline_page_archives.IsParent(path))
+      return true;
+  }
+
   // Whitelist of other allowed directories.
   static const char* const kLocalAccessWhiteList[] = {
       "/sdcard",
diff --git a/chrome/browser/net/chrome_network_delegate_unittest.cc b/chrome/browser/net/chrome_network_delegate_unittest.cc
index 39f29d05..69435bca 100644
--- a/chrome/browser/net/chrome_network_delegate_unittest.cc
+++ b/chrome/browser/net/chrome_network_delegate_unittest.cc
@@ -23,6 +23,7 @@
 #include "components/content_settings/core/browser/cookie_settings.h"
 #include "components/content_settings/core/common/pref_names.h"
 #include "components/data_usage/core/data_use_aggregator.h"
+#include "components/data_usage/core/data_use_amortizer.h"
 #include "components/data_usage/core/data_use_annotator.h"
 #include "components/syncable_prefs/testing_pref_service_syncable.h"
 #include "content/public/browser/resource_request_info.h"
@@ -101,7 +102,8 @@
  public:
   FakeDataUseAggregator()
       : data_usage::DataUseAggregator(
-            scoped_ptr<data_usage::DataUseAnnotator>()),
+            scoped_ptr<data_usage::DataUseAnnotator>(),
+            scoped_ptr<data_usage::DataUseAmortizer>()),
         on_the_record_tx_bytes_(0),
         on_the_record_rx_bytes_(0),
         off_the_record_tx_bytes_(0),
diff --git a/chrome/browser/net/net_error_tab_helper.cc b/chrome/browser/net/net_error_tab_helper.cc
index 8e325f9b..a0e73cf 100644
--- a/chrome/browser/net/net_error_tab_helper.cc
+++ b/chrome/browser/net/net_error_tab_helper.cc
@@ -22,6 +22,10 @@
 #include "net/base/net_errors.h"
 #include "url/gurl.h"
 
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/tab_android.h"
+#endif
+
 using content::BrowserContext;
 using content::BrowserThread;
 using content::WebContents;
@@ -118,6 +122,10 @@
     return;
 
   is_error_page_ = is_error_page;
+
+#if defined(OS_ANDROID)
+  SetHasOfflinePages(render_frame_host);
+#endif
 }
 
 void NetErrorTabHelper::DidCommitProvisionalLoadForFrame(
@@ -167,6 +175,9 @@
   IPC_BEGIN_MESSAGE_MAP(NetErrorTabHelper, message)
     IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RunNetworkDiagnostics,
                         RunNetworkDiagnostics)
+#if defined(OS_ANDROID)
+    IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowOfflinePages, ShowOfflinePages)
+#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
 
@@ -274,4 +285,24 @@
   ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url);
 }
 
+#if defined(OS_ANDROID)
+void NetErrorTabHelper::SetHasOfflinePages(
+  content::RenderFrameHost* render_frame_host) {
+  DCHECK(web_contents());
+  TabAndroid* tab = TabAndroid::FromWebContents(web_contents());
+  bool has_offline_pages = tab && tab->HasOfflinePages();
+  render_frame_host->Send(
+      new ChromeViewMsg_SetHasOfflinePages(
+          render_frame_host->GetRoutingID(),
+          has_offline_pages));
+}
+
+void NetErrorTabHelper::ShowOfflinePages() {
+  DCHECK(web_contents());
+  TabAndroid* tab = TabAndroid::FromWebContents(web_contents());
+  if (tab)
+    tab->ShowOfflinePages();
+}
+#endif
+
 }  // namespace chrome_browser_net
diff --git a/chrome/browser/net/net_error_tab_helper.h b/chrome/browser/net/net_error_tab_helper.h
index 4e6b83e..ef4b6198 100644
--- a/chrome/browser/net/net_error_tab_helper.h
+++ b/chrome/browser/net/net_error_tab_helper.h
@@ -102,6 +102,12 @@
   // testing.
   virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url);
 
+  // Relates to offline pages handling.
+#if defined(OS_ANDROID)
+  void SetHasOfflinePages(content::RenderFrameHost* render_frame_host);
+  void ShowOfflinePages();
+#endif
+
   // True if the last provisional load that started was for an error page.
   bool is_error_page_;
 
diff --git a/chrome/browser/net/spdyproxy/OWNERS b/chrome/browser/net/spdyproxy/OWNERS
index 2cc8050..d29cfb6 100644
--- a/chrome/browser/net/spdyproxy/OWNERS
+++ b/chrome/browser/net/spdyproxy/OWNERS
@@ -1,3 +1,5 @@
 bengr@chromium.org
+kundaji@chromium.org
+megjablon@chromium.org
 sclittle@chromium.org
-megjablon@chromium.org
\ No newline at end of file
+tbansal@chromium.org
\ No newline at end of file
diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
index 362fea5d..df0f1b92 100644
--- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc
+++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
@@ -33,6 +33,7 @@
 #include "ui/gfx/codec/png_codec.h"
 #include "ui/gfx/geometry/point.h"
 #include "ui/gfx/screen.h"
+#include "ui/gfx/switches.h"
 
 namespace {
 
@@ -273,6 +274,9 @@
 
     ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line));
 
+    // Allows us to use the same reference image on HiDPI/Retina displays.
+    command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1");
+
 #if !defined(OS_CHROMEOS)
     // These pixel tests are flaky on MSan bots with hardware rendering.
     // However, ChromeOS does not support software compositing.
diff --git a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
index 8753d0f..53aa148 100644
--- a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
+++ b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
@@ -847,7 +847,7 @@
       "options_page": "hmm_options.html?code=xkb:se::swe"
     },
     {
-      "name": "__MSG_keyboard_slovakian__",
+      "name": "__MSG_keyboard_slovak__",
       "type": "ime",
       "id": "xkb:sk::slo",
       "description": "",
diff --git a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
index bd05625..8eb595f0 100644
--- a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
+++ b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
@@ -718,7 +718,7 @@
       "input_view": "inputview.html?id=se.compact.qwerty&language=sv&passwordLayout=se.compact.qwerty&name=keyboard_swedish"
     },
     {
-      "name": "__MSG_keyboard_slovakian__",
+      "name": "__MSG_keyboard_slovak__",
       "type": "ime",
       "id": "xkb:sk::slo",
       "description": "",
diff --git a/chrome/browser/resources/settings/reset_page/powerwash_dialog.html b/chrome/browser/resources/settings/reset_page/powerwash_dialog.html
new file mode 100644
index 0000000..472239dd3
--- /dev/null
+++ b/chrome/browser/resources/settings/reset_page/powerwash_dialog.html
@@ -0,0 +1,25 @@
+<link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/classes/iron-flex-layout.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-checkbox/paper-checkbox.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-dialog/paper-dialog.html">
+
+<dom-module id="settings-powerwash-dialog">
+  <template>
+    <paper-dialog modal id="dialog">
+      <h2 i18n-content="powerwashDialogTitle"></h2>
+      <div i18n-content="powerwashDialogBody"></div>
+      <div class="layout center horizontal" id="buttonContainer">
+        <paper-button i18n-content="learnMore"
+            on-tap="onLearnMoreTap_" id="learnMore"></paper-button>
+        <div class="layout center buttons flex-1">
+          <paper-button on-tap="onCancelTap_" id="cancel"
+              i18n-content="cancel"></paper-button>
+          <paper-button  on-tap="onRestartTap_"
+              i18n-content="powerwashDialogButton"></paper-button>
+        </div>
+      </div>
+    </paper-dialog>
+  </template>
+  <script src="powerwash_dialog.js"></script>
+</dom-module>
diff --git a/chrome/browser/resources/settings/reset_page/powerwash_dialog.js b/chrome/browser/resources/settings/reset_page/powerwash_dialog.js
new file mode 100644
index 0000000..cd91533
--- /dev/null
+++ b/chrome/browser/resources/settings/reset_page/powerwash_dialog.js
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'settings-reset-page' is the settings page containing reset
+ * settings.
+ *
+ * @group Chrome Settings Elements
+ * @element settings-reset-page
+ */
+Polymer({
+  is: 'settings-powerwash-dialog',
+
+  open: function() {
+    this.$.dialog.open();
+  },
+
+  /** @private */
+  onCancelTap_: function() {
+    this.$.dialog.close();
+  },
+
+  /** @private */
+  onRestartTap_: function() {
+    this.$.dialog.close();
+  },
+
+  /** @private */
+  onLearnMoreTap_: function() {
+    window.open(loadTimeData.getString('powerwashLearnMoreUrl'));
+  },
+});
diff --git a/chrome/browser/resources/settings/reset_page/reset_page.html b/chrome/browser/resources/settings/reset_page/reset_page.html
index ac983c1..13f77b3 100644
--- a/chrome/browser/resources/settings/reset_page/reset_page.html
+++ b/chrome/browser/resources/settings/reset_page/reset_page.html
@@ -1,14 +1,24 @@
 <link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
 <link rel="import" href="chrome://md-settings/reset_page/reset_profile_dialog.html">
 
+<if expr="chromeos">
+<link rel="import" href="chrome://md-settings/reset_page/powerwash_dialog.html">
+</if>
+
 <dom-module id="settings-reset-page">
   <link rel="import" type="css"
       href="chrome://md-settings/settings_page/settings_page.css">
   <template>
-    <div on-tap="onShowDialog_">
+    <div on-tap="onShowResetProfileDialog_">
       <div i18n-content="resetPageTitle"></div>
       <div i18n-content="resetPageDescription"></div>
     </div>
+<if expr="chromeos">
+    <div on-tap="onShowPowerwashDialog_">
+      <div i18n-content="powerwashTitle"></div>
+      <div i18n-content="powerwashDescription"></div>
+    </div>
+</if>
   </template>
   <script src="reset_page.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/settings/reset_page/reset_page.js b/chrome/browser/resources/settings/reset_page/reset_page.js
index c0a5777..ab42ba5 100644
--- a/chrome/browser/resources/settings/reset_page/reset_page.js
+++ b/chrome/browser/resources/settings/reset_page/reset_page.js
@@ -23,8 +23,23 @@
 
 
   /** @private */
-  onShowDialog_: function() {
-     var dialog = document.createElement('settings-reset-profile-dialog');
+  onShowResetProfileDialog_: function() {
+     this.showDialog_('settings-reset-profile-dialog');
+  },
+
+  /** @private */
+  onShowPowerwashDialog_: function() {
+     this.showDialog_('settings-powerwash-dialog');
+  },
+
+
+  /**
+   * Creates and shows the specified dialog.
+   * @param {string} dialogName
+   * @private
+   */
+  showDialog_: function(dialogName) {
+     var dialog = document.createElement(dialogName);
      this.shadowRoot.appendChild(dialog);
      dialog.open();
 
diff --git a/chrome/browser/resources/settings/settings_resources.grd b/chrome/browser/resources/settings/settings_resources.grd
index d19e897d..1e16817 100644
--- a/chrome/browser/resources/settings/settings_resources.grd
+++ b/chrome/browser/resources/settings/settings_resources.grd
@@ -223,6 +223,12 @@
       <structure name="IDR_SETTINGS_DOWNLOADS_PAGE_JS"
                  file="downloads_page/downloads_page.js"
                  type="chrome_html" />
+      <structure name="IDR_SETTINGS_POWERWASH_DIALOG_HTML"
+                 file="reset_page/powerwash_dialog.html"
+                 type="chrome_html" />
+      <structure name="IDR_SETTINGS_POWERWASH_DIALOG_JS"
+                 file="reset_page/powerwash_dialog.js"
+                 type="chrome_html" />
       <structure name="IDR_SETTINGS_RESET_PAGE_HTML"
                  file="reset_page/reset_page.html"
                  type="chrome_html" />
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 80c16f7b..845e362 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -1431,15 +1431,8 @@
 
   // Measure the amount of IO during the filter build.
   base::IoCounters io_before, io_after;
-  base::ProcessHandle handle = base::GetCurrentProcessHandle();
   scoped_ptr<base::ProcessMetrics> metric(
-#if !defined(OS_MACOSX)
-      base::ProcessMetrics::CreateProcessMetrics(handle)
-#else
-      // Getting stats only for the current process is enough, so NULL is fine.
-      base::ProcessMetrics::CreateProcessMetrics(handle, NULL)
-#endif
-  );
+      base::ProcessMetrics::CreateCurrentProcessMetrics());
 
   // IoCounters are currently not supported on Mac, and may not be
   // available for Linux, so we check the result and only show IO
diff --git a/chrome/browser/sync/test/DEPS b/chrome/browser/sync/test/DEPS
deleted file mode 100644
index ae5fc9f6..0000000
--- a/chrome/browser/sync/test/DEPS
+++ /dev/null
@@ -1,5 +0,0 @@
-include_rules = [
-  # Used for tests (in sync_test.cc)
-  # TODO(shadi): Remove this once crbug.com/527505 is fixed and updated tests.
-  "+chrome/browser/ui/views/profiles/profile_chooser_view.h",
-]
diff --git a/chrome/browser/sync/test/integration/multiple_client_preferences_sync_test.cc b/chrome/browser/sync/test/integration/multiple_client_preferences_sync_test.cc
index b4a95c8f..e1e21a47 100644
--- a/chrome/browser/sync/test/integration/multiple_client_preferences_sync_test.cc
+++ b/chrome/browser/sync/test/integration/multiple_client_preferences_sync_test.cc
@@ -19,8 +19,6 @@
   MultipleClientPreferencesSyncTest() : SyncTest(MULTIPLE_CLIENT) {}
   ~MultipleClientPreferencesSyncTest() override {}
 
-  bool TestUsesSelfNotifications() override { return false; }
-
  private:
   DISALLOW_COPY_AND_ASSIGN(MultipleClientPreferencesSyncTest);
 };
diff --git a/chrome/browser/sync/test/integration/single_client_e2e_test.cc b/chrome/browser/sync/test/integration/single_client_e2e_test.cc
index 4d8ab290..a90b8d4 100644
--- a/chrome/browser/sync/test/integration/single_client_e2e_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_e2e_test.cc
@@ -8,7 +8,6 @@
  public:
   SingleClientE2ETest() : SyncTest(SINGLE_CLIENT) {}
   ~SingleClientE2ETest() override {}
-  bool TestUsesSelfNotifications() override { return false; }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(SingleClientE2ETest);
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index e673d39..0245fc6 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -44,7 +44,6 @@
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/host_desktop.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
 #include "chrome/common/chrome_constants.h"
@@ -330,14 +329,20 @@
 // ProfileManager::CreateProfileAsync() for proper profile creation.
 // static
 Profile* SyncTest::MakeProfileForUISignin(
-    const base::FilePath::StringType name) {
+    const base::FilePath::StringType name,
+    bool path_outside_user_data_dir) {
   // For multi profile UI signin, profile paths should be outside user data dir.
   // Otherwise, we get an error that the profile has already signed in on this
   // device.
   // Note that prefix |name| is implemented only on Win. On other platforms the
   // com.google.Chrome.XXXXXX prefix is used.
   base::FilePath profile_path;
-  CHECK(base::CreateNewTempDirectory(name, &profile_path));
+  if (path_outside_user_data_dir) {
+    CHECK(base::CreateNewTempDirectory(name, &profile_path));
+  } else {
+    PathService::Get(chrome::DIR_USER_DATA, &profile_path);
+    profile_path = profile_path.Append(name);
+  }
 
   ProfileManager* profile_manager = g_browser_process->profile_manager();
   base::RunLoop run_loop;
@@ -471,7 +476,9 @@
   // If running against an EXTERNAL_LIVE_SERVER, we need to signin profiles
   // using real GAIA server. This requires creating profiles with no test hooks.
   if (UsingExternalServers()) {
-    profiles_[index] = MakeProfileForUISignin(profile_name);
+    bool path_outside_user_data_dir = (num_clients_ > 1);
+    profiles_[index] =
+        MakeProfileForUISignin(profile_name, path_outside_user_data_dir);
   } else {
     // Without need of real GAIA authentication, we create new test profiles.
     profiles_[index] = MakeProfile(profile_name);
@@ -617,17 +624,6 @@
       LoginUIServiceFactory::GetForProfile(GetProfile(i))->
           SyncConfirmationUIClosed(false /* configure_sync_first */);
     }
-
-    // With external servers, profile paths are created outside user_data_dir.
-    // This causes the ProfileManager to show an avatar bubble without an anchor
-    // view. The bubble is then not destroyed at shutdown, crbug.com/527505.
-    // This is a fix to explicitly close the bubble early on.
-    // ProfileChooserView is available on few platforms including Linux which is
-    // the only supported platform for ExternalServers.
-#if defined(OS_LINUX)
-    // TODO(shadi): Remove this hack once crbug.com/527505 is fixed.
-    ProfileChooserView::Hide();
-#endif  // defined(OS_LINUX)
   }
 
   return true;
@@ -954,7 +950,8 @@
 }
 
 bool SyncTest::TestUsesSelfNotifications() {
-  return true;
+  // Default is True unless we are running against external servers.
+  return !UsingExternalServers();
 }
 
 bool SyncTest::EnableEncryption(int index) {
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h
index 1f90c7f..b31f3651 100644
--- a/chrome/browser/sync/test/integration/sync_test.h
+++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -272,8 +272,11 @@
 
  private:
   // Helper to ProfileManager::CreateProfileAsync that creates a new profile
-  // used for UI Signin. Blocks until profile is created.
-  static Profile* MakeProfileForUISignin(const base::FilePath::StringType name);
+  // used for UI Signin. Blocks until profile is created. If
+  // |path_outside_user_data_dir| is true then profile's path is created outside
+  // user data dir which allows signing-in multiple profiles to same account.
+  static Profile* MakeProfileForUISignin(const base::FilePath::StringType name,
+                                         bool path_outside_user_data_dir);
 
   // Callback for CreateNewProfile() method. It runs the quit_closure once
   // profile is created successfully.
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index da8bfb9..4db78df 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1423,7 +1423,7 @@
     return;
   window_has_shown_ = true;
 
-  startup_metric_utils::RecordBrowserWindowDisplay(base::Time::Now());
+  startup_metric_utils::RecordBrowserWindowDisplay(base::TimeTicks::Now());
 
   // Nothing to do for non-tabbed windows.
   if (!is_type_tabbed())
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
index 5a70bc5..e0627c79 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
@@ -7,6 +7,7 @@
 #include <cmath>
 
 #include "base/mac/mac_util.h"
+#import "base/mac/sdk_forward_declarations.h"
 #include "base/stl_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "chrome/browser/search/search.h"
@@ -274,19 +275,21 @@
     [popup_ setAnimations:@{@"frame" : [NSNull null]}];
   }
 
-  if (!animate && base::mac::IsOSElCapitanOrLater()) {
-    // When using the animator to make |popup_| larger on El Capitan, for some
-    // reason the window does not get redrawn. There's no animation in this case
-    // anyway, so just force the frame change. See http://crbug.com/538590 .
-    [popup_ setFrame:popup_frame display:YES];
-  } else {
-    [NSAnimationContext beginGrouping];
-    // Don't use the GTM addition for the "Steve" slowdown because this can
-    // happen async from user actions and the effects could be a surprise.
-    [[NSAnimationContext currentContext] setDuration:kShrinkAnimationDuration];
-    [[popup_ animator] setFrame:popup_frame display:YES];
-    [NSAnimationContext endGrouping];
+  [NSAnimationContext beginGrouping];
+  // Don't use the GTM addition for the "Steve" slowdown because this can
+  // happen async from user actions and the effects could be a surprise.
+  [[NSAnimationContext currentContext] setDuration:kShrinkAnimationDuration];
+  // When using the animator to update |popup_| on El Capitan, for some reason
+  // the window does not get redrawn. Use a completion handler to make sure
+  // |popup_| gets redrawn once the animation completes. See
+  // http://crbug.com/538590 and http://crbug.com/551007 .
+  if (base::mac::IsOSElCapitanOrLater()) {
+    [[NSAnimationContext currentContext] setCompletionHandler:^{
+      [popup_ display];
+    }];
   }
+  [[popup_ animator] setFrame:popup_frame display:YES];
+  [NSAnimationContext endGrouping];
 
   if (!animate) {
     // Restore the original animations dictionary.  This does not reinstate any
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
index 20d64e9..0dac7ae 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
@@ -156,9 +156,12 @@
   DesktopWindowTreeHostWin::HandleCreate();
   browser_window_property_manager_ =
       BrowserWindowPropertyManager::CreateBrowserWindowPropertyManager(
-          browser_view_);
-  if (browser_window_property_manager_)
-    browser_window_property_manager_->UpdateWindowProperties(GetHWND());
+          browser_view_, GetHWND());
+}
+
+void BrowserDesktopWindowTreeHostWin::HandleDestroying() {
+  browser_window_property_manager_.reset();
+  DesktopWindowTreeHostWin::HandleDestroying();
 }
 
 void BrowserDesktopWindowTreeHostWin::HandleFrameChanged() {
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h
index 26f20c22..4a4409a 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h
@@ -43,6 +43,7 @@
   int GetInitialShowState() const override;
   bool GetClientAreaInsets(gfx::Insets* insets) const override;
   void HandleCreate() override;
+  void HandleDestroying() override;
   void HandleFrameChanged() override;
   bool PreHandleMSG(UINT message,
                     WPARAM w_param,
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
index 59996a15..4c801d9 100644
--- a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
+++ b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
@@ -24,9 +24,12 @@
 
 using extensions::ExtensionRegistry;
 
-BrowserWindowPropertyManager::BrowserWindowPropertyManager(BrowserView* view)
-    : view_(view) {
-  DCHECK(view_);
+BrowserWindowPropertyManager::BrowserWindowPropertyManager(BrowserView* view,
+                                                           HWND hwnd)
+    : view_(view),
+      hwnd_(hwnd) {
+  // At this point, the HWND is unavailable from BrowserView.
+  DCHECK(hwnd);
   profile_pref_registrar_.Init(view_->browser()->profile()->GetPrefs());
 
   // Monitor the profile icon version on Windows so that we can set the browser
@@ -38,10 +41,10 @@
 }
 
 BrowserWindowPropertyManager::~BrowserWindowPropertyManager() {
+  ui::win::ClearWindowPropertyStore(hwnd_);
 }
 
-void BrowserWindowPropertyManager::UpdateWindowProperties(HWND hwnd) {
-  DCHECK(hwnd);
+void BrowserWindowPropertyManager::UpdateWindowProperties() {
   Browser* browser = view_->browser();
   Profile* profile = browser->profile();
 
@@ -65,8 +68,8 @@
         web_app::GetExtensionIdFromApplicationName(browser->app_name()),
         ExtensionRegistry::EVERYTHING);
     if (extension) {
-      ui::win::SetAppIdForWindow(app_id, hwnd);
-      web_app::UpdateRelaunchDetailsForApp(profile, extension, hwnd);
+      ui::win::SetAppIdForWindow(app_id, hwnd_);
+      web_app::UpdateRelaunchDetailsForApp(profile, extension, hwnd_);
       return;
     }
   }
@@ -92,22 +95,23 @@
       icon_path_string,
       command_line_string,
       pinned_name,
-      hwnd);
+      hwnd_);
 }
 
 // static
 scoped_ptr<BrowserWindowPropertyManager>
     BrowserWindowPropertyManager::CreateBrowserWindowPropertyManager(
-        BrowserView* view) {
+        BrowserView* view, HWND hwnd) {
   if (base::win::GetVersion() < base::win::VERSION_WIN7 ||
-      view->browser()->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) {
+      view->browser()->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
     return scoped_ptr<BrowserWindowPropertyManager>();
-  }
 
-  return scoped_ptr<BrowserWindowPropertyManager>(
-      new BrowserWindowPropertyManager(view));
+  scoped_ptr<BrowserWindowPropertyManager> browser_window_property_manager(
+      new BrowserWindowPropertyManager(view, hwnd));
+  browser_window_property_manager->UpdateWindowProperties();
+  return browser_window_property_manager.Pass();
 }
 
 void BrowserWindowPropertyManager::OnProfileIconVersionChange() {
-  UpdateWindowProperties(views::HWNDForNativeWindow(view_->GetNativeWindow()));
+  UpdateWindowProperties();
 }
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_win.h b/chrome/browser/ui/views/frame/browser_window_property_manager_win.h
index 1f08655..c626ce1 100644
--- a/chrome/browser/ui/views/frame/browser_window_property_manager_win.h
+++ b/chrome/browser/ui/views/frame/browser_window_property_manager_win.h
@@ -16,19 +16,18 @@
  public:
   virtual ~BrowserWindowPropertyManager();
 
-  void UpdateWindowProperties(HWND hwnd);
-
   static scoped_ptr<BrowserWindowPropertyManager>
-      CreateBrowserWindowPropertyManager(BrowserView* view);
+      CreateBrowserWindowPropertyManager(BrowserView* view, HWND hwnd);
 
  private:
-  explicit BrowserWindowPropertyManager(BrowserView* view);
+  BrowserWindowPropertyManager(BrowserView* view, HWND hwnd);
 
+  void UpdateWindowProperties();
   void OnProfileIconVersionChange();
 
   PrefChangeRegistrar profile_pref_registrar_;
-
   BrowserView* view_;
+  const HWND hwnd_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserWindowPropertyManager);
 };
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 4c29832..90d2eac 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -650,90 +650,109 @@
   int y = toolbar_bounds.y();
   int h = toolbar_bounds.height();
 
-  // Gross hack: We split the toolbar images into two pieces, since sometimes
-  // (popup mode) the toolbar isn't tall enough to show the whole image.  The
-  // split happens between the top shadow section and the bottom gradient
-  // section so that we never break the gradient.
-  int split_point = kFrameShadowThickness * 2;
+  const bool normal_mode = browser_view()->IsTabStripVisible();
+  if (normal_mode) {
+    // Normal mode toolbar.  We need to create a separate layer to hold the
+    // background, so we can mask off the corners before compositing onto the
+    // frame.
+    canvas->sk_canvas()->saveLayer(
+        gfx::RectToSkRect(gfx::Rect(x - kContentEdgeShadowThickness, y,
+                                    w + kContentEdgeShadowThickness * 2, h)),
+        nullptr);
+  }
+
+  // The top stroke is drawn using the IDR_CONTENT_TOP_XXX images, which overlay
+  // the toolbar.  The top 2 px of these images is the actual top stroke +
+  // shadow, and is partly transparent, so the toolbar background shouldn't be
+  // drawn over it.  Furthermore, the toolbar may be in popup mode, where we
+  // don't want rounded corners at all, and in that case dividing the toolbar
+  // assets at this point, plus manipulating the horizontal offset of the top
+  // pieces, lets us make the toolbar look almost as if it's intended to have
+  // square corners.
+  const int kPreMDToolbarTopEdgeExclusion = 2;
+  const int split_point = std::min(kPreMDToolbarTopEdgeExclusion, h);
   int bottom_y = y + split_point;
+  int bottom_edge_height = h - split_point;
+
   ui::ThemeProvider* tp = GetThemeProvider();
-  gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed(
-      IDR_CONTENT_TOP_LEFT_CORNER);
-  int bottom_edge_height = std::min(toolbar_left->height(), h) - split_point;
+  if (bottom_edge_height) {
+    // Avoid theming popup or app windows.
+    gfx::ImageSkia* theme_toolbar = normal_mode ?
+        tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR) :
+        ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+            IDR_THEME_TOOLBAR);
+    // Tile the toolbar image starting at the frame edge on the left and where
+    // the horizontal tabstrip is (or would be) on the top.
+    canvas->TileImageInt(
+        *theme_toolbar, x + GetThemeBackgroundXInset(),
+        bottom_y - GetTopInset(false) - Tab::GetYInsetForActiveTabBackground(),
+        x, bottom_y, w, bottom_edge_height);
+  }
 
-  // Split our canvas out so we can mask out the corners of the toolbar
-  // without masking out the frame.
-  canvas->SaveLayerAlpha(
-      255, gfx::Rect(x - kClientEdgeThickness, y, w + kClientEdgeThickness * 3,
-                     h));
-
-  // Paint the bottom rect.
-  canvas->FillRect(gfx::Rect(x, bottom_y, w, bottom_edge_height),
-                   tp->GetColor(ThemeProperties::COLOR_TOOLBAR));
-
-  // Tile the toolbar image starting at the frame edge on the left and where the
-  // horizontal tabstrip is (or would be) on the top.
-  gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR);
-  canvas->TileImageInt(
-      *theme_toolbar, x + GetThemeBackgroundXInset(),
-      bottom_y - GetTopInset(false) - Tab::GetYInsetForActiveTabBackground(),
-      x, bottom_y, w, theme_toolbar->height());
-
-  // Draw rounded corners for the tab.
-  gfx::ImageSkia* toolbar_left_mask =
-      tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK);
-  gfx::ImageSkia* toolbar_right_mask =
-      tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK);
-
-  // We mask out the corners by using the DestinationIn transfer mode,
-  // which keeps the RGB pixels from the destination and the alpha from
-  // the source.
-  SkPaint paint;
-  paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
-
-  // Mask the left edge.
-  int left_x = x - kContentEdgeShadowThickness;
-  canvas->DrawImageInt(*toolbar_left_mask, 0, 0, toolbar_left_mask->width(),
-                       split_point, left_x, y, toolbar_left_mask->width(),
-                       split_point, false, paint);
-  canvas->DrawImageInt(*toolbar_left_mask, 0,
-      toolbar_left_mask->height() - bottom_edge_height,
-      toolbar_left_mask->width(), bottom_edge_height, left_x, bottom_y,
-      toolbar_left_mask->width(), bottom_edge_height, false, paint);
-
-  // Mask the right edge.
-  int right_x =
-      x + w - toolbar_right_mask->width() + kContentEdgeShadowThickness;
-  canvas->DrawImageInt(*toolbar_right_mask, 0, 0, toolbar_right_mask->width(),
-                       split_point, right_x, y, toolbar_right_mask->width(),
-                       split_point, false, paint);
-  canvas->DrawImageInt(*toolbar_right_mask, 0,
-      toolbar_right_mask->height() - bottom_edge_height,
-      toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y,
-      toolbar_right_mask->width(), bottom_edge_height, false, paint);
-  canvas->Restore();
-
-  canvas->DrawImageInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point,
-                       left_x, y, toolbar_left->width(), split_point, false);
-  canvas->DrawImageInt(*toolbar_left, 0,
-      toolbar_left->height() - bottom_edge_height, toolbar_left->width(),
-      bottom_edge_height, left_x, bottom_y, toolbar_left->width(),
-      bottom_edge_height, false);
-
+  const int left_x = x - kContentEdgeShadowThickness;
+  gfx::ImageSkia* toolbar_left =
+      tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER);
   gfx::ImageSkia* toolbar_center =
       tp->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER);
-  canvas->TileImageInt(*toolbar_center, 0, 0, left_x + toolbar_left->width(),
-      y, right_x - (left_x + toolbar_left->width()),
-      split_point);
+  gfx::ImageSkia* toolbar_right =
+      tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER);
+  const int right_x =
+      x + w - toolbar_right->width() + kContentEdgeShadowThickness;
+  if (normal_mode) {
+    // Draw rounded corners for the tab.
+    gfx::ImageSkia* toolbar_left_mask =
+        tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK);
+    gfx::ImageSkia* toolbar_right_mask =
+        tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK);
 
-  gfx::ImageSkia* toolbar_right = tp->GetImageSkiaNamed(
-      IDR_CONTENT_TOP_RIGHT_CORNER);
-  canvas->DrawImageInt(*toolbar_right, 0, 0, toolbar_right->width(),
-      split_point, right_x, y, toolbar_right->width(), split_point, false);
-  canvas->DrawImageInt(*toolbar_right, 0,
-      toolbar_right->height() - bottom_edge_height, toolbar_right->width(),
-      bottom_edge_height, right_x, bottom_y, toolbar_right->width(),
-      bottom_edge_height, false);
+    // We mask out the corners by using the DestinationIn transfer mode,
+    // which keeps the RGB pixels from the destination and the alpha from
+    // the source.
+    SkPaint paint;
+    paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
+
+    // Mask the left edge.
+    canvas->DrawImageInt(*toolbar_left_mask, 0, 0, toolbar_left_mask->width(),
+                         h, left_x, y, toolbar_left_mask->width(), h, false,
+                         paint);
+
+    // Mask the right edge.
+    canvas->DrawImageInt(*toolbar_right_mask, 0, 0, toolbar_right_mask->width(),
+                         h, right_x, y, toolbar_right_mask->width(), h, false,
+                         paint);
+    canvas->Restore();
+
+    canvas->DrawImageInt(*toolbar_left, 0, 0, toolbar_left->width(),
+                         h, left_x, y, toolbar_left->width(), h, false);
+
+    canvas->TileImageInt(*toolbar_center, 0, 0, left_x + toolbar_left->width(),
+                         y, right_x - (left_x + toolbar_left->width()),
+                         split_point);
+
+    canvas->DrawImageInt(*toolbar_right, 0, 0, toolbar_right->width(), h,
+                         right_x, y, toolbar_right->width(), h, false);
+  } else {
+    canvas->DrawImageInt(*toolbar_left, 1, 0, toolbar_left->width() - 1,
+                         split_point, left_x, y, toolbar_left->width() - 1,
+                         split_point, false);
+    const int right_corner_x = right_x + 1;
+    canvas->DrawImageInt(*toolbar_right, 0, 0, toolbar_right->width() - 1,
+                         split_point, right_corner_x, y,
+                         toolbar_right->width() - 1, split_point, false);
+    canvas->TileImageInt(
+        *toolbar_center, 0, 0, left_x + toolbar_left->width() - 1, y,
+        right_corner_x - (left_x + toolbar_left->width() - 1), split_point);
+    if (bottom_edge_height) {
+      canvas->DrawImageInt(
+          *toolbar_left, 0, toolbar_left->height() - bottom_edge_height,
+          toolbar_left->width(), bottom_edge_height, left_x, bottom_y,
+          toolbar_left->width(), bottom_edge_height, false);
+      canvas->DrawImageInt(
+          *toolbar_right, 0, toolbar_right->height() - bottom_edge_height,
+          toolbar_right->width(), bottom_edge_height, right_x, bottom_y,
+          toolbar_right->width(), bottom_edge_height, false);
+    }
+  }
 
   // Draw the content/toolbar separator.
   if (ui::MaterialDesignController::IsModeMaterial()) {
@@ -764,20 +783,10 @@
   SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR);
 
   if (browser_view()->IsToolbarVisible()) {
-    // The client edge images always start below the toolbar corner images.  The
-    // client edge filled rects start there or at the bottom of the toolbar,
-    // whichever is shorter.
+    // The client edge images start below the toolbar.
     gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds());
-
-    gfx::ImageSkia* content_top_left_corner =
-        tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER);
-    // TODO(oshima): Sanity checks for crbug.com/374273. Remove when it's fixed.
-    CHECK(content_top_left_corner);
-    CHECK(!content_top_left_corner->isNull());
-
-    image_top += toolbar_bounds.y() + content_top_left_corner->height();
-    client_area_top = std::min(image_top,
-        client_area_top + toolbar_bounds.bottom() - kClientEdgeThickness);
+    client_area_top += toolbar_bounds.bottom();
+    image_top = client_area_top;
   } else if (!browser_view()->IsTabStripVisible()) {
     // The toolbar isn't going to draw a client edge for us, so draw one
     // ourselves.
diff --git a/chrome/browser/ui/webui/media_router/media_router_ui.cc b/chrome/browser/ui/webui/media_router/media_router_ui.cc
index afb9c42..fa815e1 100644
--- a/chrome/browser/ui/webui/media_router/media_router_ui.cc
+++ b/chrome/browser/ui/webui/media_router/media_router_ui.cc
@@ -224,6 +224,7 @@
       MediaSourceForTab(SessionTabHelper::IdForTab(initiator)));
   query_result_manager_->StartSinksQuery(
       MediaCastMode::TAB_MIRROR, mirroring_source);
+  UpdateCastModes();
 }
 
 void MediaRouterUI::OnDefaultPresentationChanged(
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
index c2587e6e..47b8387 100644
--- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -246,6 +246,24 @@
   html_source->AddString(
       "resetPageLearnMoreUrl",
       chrome::kResetProfileSettingsLearnMoreURL);
+
+#if defined(OS_CHROMEOS)
+  html_source->AddLocalizedString(
+      "powerwashTitle", IDS_OPTIONS_FACTORY_RESET);
+  html_source->AddString(
+      "powerwashDescription",
+      l10n_util::GetStringFUTF16(
+          IDS_OPTIONS_FACTORY_RESET_DESCRIPTION,
+          l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+  html_source->AddLocalizedString(
+      "powerwashDialogTitle", IDS_OPTIONS_FACTORY_RESET_HEADING);
+  html_source->AddLocalizedString(
+      "powerwashDialogBody", IDS_OPTIONS_FACTORY_RESET_WARNING);
+  html_source->AddLocalizedString(
+      "powerwashDialogButton", IDS_RELAUNCH_BUTTON);
+  html_source->AddLocalizedString(
+      "powerwashLearnMoreUrl", IDS_FACTORY_RESET_HELP_URL);
+#endif
 }
 
 void AddDateTimeStrings(content::WebUIDataSource* html_source) {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index b86b437..314abd0f 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -613,6 +613,8 @@
       'browser/manifest/manifest_icon_downloader.h',
       'browser/manifest/manifest_icon_selector.cc',
       'browser/manifest/manifest_icon_selector.h',
+      'browser/media/android/cdm/media_drm_credential_manager.cc',
+      'browser/media/android/cdm/media_drm_credential_manager.h',
       'browser/media/android/remote/record_cast_action.cc',
       'browser/media/android/remote/record_cast_action.h',
       'browser/media/android/remote/remote_media_player_bridge.cc',
@@ -1817,6 +1819,7 @@
       'android/java/src/org/chromium/chrome/browser/JavaExceptionReporter.java',
       'android/java/src/org/chromium/chrome/browser/IntentHelper.java',
       'android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java',
+      'android/java/src/org/chromium/chrome/browser/media/cdm/MediaDrmCredentialManager.java',
       'android/java/src/org/chromium/chrome/browser/media/remote/RecordCastAction.java',
       'android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java',
       'android/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java',
@@ -3664,6 +3667,7 @@
             '../build/android/ndk.gyp:cpu_features',
             '../components/components.gyp:cdm_browser',
             '../components/components.gyp:data_reduction_proxy_content',
+            '../components/components.gyp:data_usage_android',
             '../components/components.gyp:enhanced_bookmarks',
             '../components/components.gyp:offline_pages',
             '../components/components.gyp:precache_content',
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 6506ab8..a901ea1 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -293,6 +293,8 @@
       'browser/extensions/api/font_settings/font_settings_api.h',
       'browser/extensions/api/gcd_private/gcd_private_api.cc',
       'browser/extensions/api/gcd_private/gcd_private_api.h',
+      'browser/extensions/api/gcd_private/privet_v3_context_getter.cc',
+      'browser/extensions/api/gcd_private/privet_v3_context_getter.h',
       'browser/extensions/api/gcd_private/privet_v3_session.cc',
       'browser/extensions/api/gcd_private/privet_v3_session.h',
       'browser/extensions/api/gcm/gcm_api.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index bbf0c97c..d20e49c 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2117,6 +2117,7 @@
         '../components/components.gyp:autofill_content_test_support',
         '../components/components.gyp:captive_portal_test_support',
         '../components/components.gyp:certificate_reporting',
+        '../components/components.gyp:compression',
         '../components/components.gyp:dom_distiller_content_browser',
         '../components/components.gyp:dom_distiller_content_renderer',
         '../components/components.gyp:dom_distiller_test_support',
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 206f8e22..49e4009a 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -151,8 +151,10 @@
 const base::FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
 const base::FilePath::CharType kNetworkPersistentStateFilename[] =
     FPL("Network Persistent State");
+const base::FilePath::CharType kOfflinePageArchviesDirname[] =
+    FPL("Offline Pages/archives");
 const base::FilePath::CharType kOfflinePageMetadataDirname[] =
-    FPL("Offline Pages");
+    FPL("Offline Pages/metadata");
 const base::FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
 const base::FilePath::CharType kProtectedPreferencesFilenameDeprecated[] =
     FPL("Protected Preferences");
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index bc13ee0..933a3c3 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -67,6 +67,7 @@
 extern const base::FilePath::CharType kLocalStorePoolName[];
 extern const base::FilePath::CharType kMediaCacheDirname[];
 extern const base::FilePath::CharType kNetworkPersistentStateFilename[];
+extern const base::FilePath::CharType kOfflinePageArchviesDirname[];
 extern const base::FilePath::CharType kOfflinePageMetadataDirname[];
 extern const base::FilePath::CharType kPreferencesFilename[];
 extern const base::FilePath::CharType kProtectedPreferencesFilenameDeprecated[];
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index f28a320..f17ba29b7 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -571,13 +571,6 @@
       cur = cur.Append(kGCMStoreDirname);
       break;
 #endif  // !defined(OS_ANDROID)
-#if defined(OS_ANDROID)
-    case chrome::DIR_OFFLINE_PAGE_METADATA:
-      if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
-        return false;
-      cur = cur.Append(kOfflinePageMetadataDirname);
-      break;
-#endif  // defined(OS_ANDROID)
 #if defined(OS_LINUX)
     case chrome::FILE_COMPONENT_FLASH_HINT:
       if (!PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN,
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index 13fc22b..581fdc06 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -127,10 +127,6 @@
   DIR_GLOBAL_GCM_STORE,         // Directory where the global GCM instance
                                 // stores its data.
 #endif
-#if defined(OS_ANDROID)
-  DIR_OFFLINE_PAGE_METADATA,    // Directory where offline page metadata is
-                                // stored.
-#endif
 
   // Valid only in development environment; TODO(darin): move these
   DIR_GEN_TEST_DATA,            // Directory where generated test data resides.
diff --git a/chrome/common/localized_error.cc b/chrome/common/localized_error.cc
index 8a6455a..30fed8b 100644
--- a/chrome/common/localized_error.cc
+++ b/chrome/common/localized_error.cc
@@ -554,6 +554,7 @@
                                 bool is_post,
                                 bool stale_copy_in_cache,
                                 bool can_show_network_diagnostics_dialog,
+                                bool has_offline_pages,
                                 const std::string& locale,
                                 const std::string& accept_languages,
                                 scoped_ptr<error_page::ErrorPageParams> params,
@@ -766,6 +767,19 @@
     error_strings->Set("showSavedCopyButton", show_saved_copy_button);
   }
 
+#if defined(OS_ANDROID)
+  if (has_offline_pages) {
+    base::DictionaryValue* show_saved_pages_button = new base::DictionaryValue;
+    show_saved_pages_button->SetString(
+        "msg",
+        l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES));
+    show_saved_pages_button->SetString(
+        "title",
+        l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES));
+    error_strings->Set("showSavedPagesButton", show_saved_pages_button);
+  }
+#endif
+
 #if defined(OS_CHROMEOS)
   // ChromeOS has its own diagnostics extension, which doesn't rely on a
   // browser-initiated dialog.
diff --git a/chrome/common/localized_error.h b/chrome/common/localized_error.h
index c79c72ce..3237481 100644
--- a/chrome/common/localized_error.h
+++ b/chrome/common/localized_error.h
@@ -34,6 +34,7 @@
                          bool is_post,
                          bool stale_copy_in_cache,
                          bool can_show_network_diagnostics_dialog,
+                         bool has_offline_pages,
                          const std::string& locale,
                          const std::string& accept_languages,
                          scoped_ptr<error_page::ErrorPageParams> params,
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index c93b41d..e096a93 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -322,6 +322,13 @@
 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetCanShowNetworkDiagnosticsDialog,
                     bool /* can_show_network_diagnostics_dialog */)
 
+#if defined(OS_ANDROID)
+// Tells the renderer whether or not an offline page exists. This is used to
+// decide if "show saved pages" button will be provided on certain error page.
+IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetHasOfflinePages,
+                    bool /* has_offline_pages */)
+#endif
+
 // Provides the information needed by the renderer process to contact a
 // navigation correction service.  Handled by the NetErrorHelper.
 IPC_MESSAGE_ROUTED5(ChromeViewMsg_SetNavigationCorrectionInfo,
@@ -334,6 +341,12 @@
 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_RunNetworkDiagnostics,
                     GURL /* failed_url */)
 
+#if defined(OS_ANDROID)
+// Message sent from the renderer to the browser to show the UI for offline
+// pages.
+IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_ShowOfflinePages)
+#endif
+
 //-----------------------------------------------------------------------------
 // Misc messages
 // These are messages sent from the renderer to the browser process.
diff --git a/chrome/renderer/net/net_error_helper.cc b/chrome/renderer/net/net_error_helper.cc
index ef29146..492c9d3 100644
--- a/chrome/renderer/net/net_error_helper.cc
+++ b/chrome/renderer/net/net_error_helper.cc
@@ -145,6 +145,9 @@
                         OnSetCanShowNetworkDiagnosticsDialog);
     IPC_MESSAGE_HANDLER(ChromeViewMsg_SetNavigationCorrectionInfo,
                         OnSetNavigationCorrectionInfo);
+#if defined(OS_ANDROID)
+    IPC_MESSAGE_HANDLER(ChromeViewMsg_SetHasOfflinePages, OnSetHasOfflinePages)
+#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
 
@@ -171,10 +174,12 @@
     const blink::WebURLError& error,
     bool is_failed_post,
     bool can_show_network_diagnostics_dialog,
+    bool has_offline_pages,
     scoped_ptr<ErrorPageParams> params,
     bool* reload_button_shown,
     bool* show_saved_copy_button_shown,
     bool* show_cached_copy_button_shown,
+    bool* show_saved_pages_button_shown,
     std::string* error_html) const {
   error_html->clear();
 
@@ -189,6 +194,7 @@
                                error.unreachableURL, is_failed_post,
                                error.staleCopyInCache,
                                can_show_network_diagnostics_dialog,
+                               has_offline_pages,
                                RenderThread::Get()->GetLocale(),
                                render_frame()->GetRenderView()->
                                    GetAcceptLanguages(),
@@ -198,6 +204,8 @@
         error_strings.Get("showSavedCopyButton", nullptr);
     *show_cached_copy_button_shown =
         error_strings.Get("cacheButton", nullptr);
+    *show_saved_pages_button_shown =
+        error_strings.Get("showSavedPagesButton", nullptr);
     // "t" is the id of the template's root node.
     *error_html = webui::GetTemplatesHtml(template_html, &error_strings, "t");
   }
@@ -216,7 +224,8 @@
 
 void NetErrorHelper::UpdateErrorPage(const blink::WebURLError& error,
                                      bool is_failed_post,
-                                     bool can_show_network_diagnostics_dialog) {
+                                     bool can_show_network_diagnostics_dialog,
+                                     bool has_offline_pages) {
   base::DictionaryValue error_strings;
   LocalizedError::GetStrings(error.reason,
                              error.domain.utf8(),
@@ -224,6 +233,7 @@
                              is_failed_post,
                              error.staleCopyInCache,
                              can_show_network_diagnostics_dialog,
+                             has_offline_pages,
                              RenderThread::Get()->GetLocale(),
                              render_frame()->GetRenderView()->
                                  GetAcceptLanguages(),
@@ -310,6 +320,13 @@
       render_frame()->GetRoutingID(), page_url));
 }
 
+void NetErrorHelper::ShowOfflinePages() {
+#if defined(OS_ANDROID)
+  render_frame()->Send(new ChromeViewHostMsg_ShowOfflinePages(
+      render_frame()->GetRoutingID()));
+#endif
+}
+
 void NetErrorHelper::OnNetErrorInfo(int status_num) {
   DCHECK(status_num >= 0 && status_num < error_page::DNS_PROBE_MAX);
 
@@ -353,3 +370,9 @@
     const std::string& data) {
   tracking_fetcher_.reset();
 }
+
+#if defined(OS_ANDROID)
+void NetErrorHelper::OnSetHasOfflinePages(bool has_offline_pages) {
+  core_->OnSetHasOfflinePages(has_offline_pages);
+}
+#endif
diff --git a/chrome/renderer/net/net_error_helper.h b/chrome/renderer/net/net_error_helper.h
index 9ec1d44..935cd5df 100644
--- a/chrome/renderer/net/net_error_helper.h
+++ b/chrome/renderer/net/net_error_helper.h
@@ -83,16 +83,19 @@
       const blink::WebURLError& error,
       bool is_failed_post,
       bool can_use_local_diagnostics_service,
+      bool has_offline_pages,
       scoped_ptr<error_page::ErrorPageParams> params,
       bool* reload_button_shown,
       bool* show_saved_copy_button_shown,
       bool* show_cached_copy_button_shown,
+      bool* show_saved_pages_button_shown,
       std::string* html) const override;
   void LoadErrorPage(const std::string& html, const GURL& failed_url) override;
   void EnablePageHelperFunctions() override;
   void UpdateErrorPage(const blink::WebURLError& error,
                        bool is_failed_post,
-                       bool can_use_local_diagnostics_service) override;
+                       bool can_use_local_diagnostics_service,
+                       bool has_offline_pages) override;
   void FetchNavigationCorrections(
       const GURL& navigation_correction_url,
       const std::string& navigation_correction_request_body) override;
@@ -102,6 +105,7 @@
   void ReloadPage(bool ignore_cache) override;
   void LoadPageFromCache(const GURL& page_url) override;
   void DiagnoseError(const GURL& page_url) override;
+  void ShowOfflinePages() override;
 
   void OnNetErrorInfo(int status);
   void OnSetCanShowNetworkDiagnosticsDialog(
@@ -117,6 +121,9 @@
 
   void OnTrackingRequestComplete(const blink::WebURLResponse& response,
                                  const std::string& data);
+#if defined(OS_ANDROID)
+  void OnSetHasOfflinePages(bool has_offline_pages);
+#endif
 
   scoped_ptr<content::ResourceFetcher> correction_fetcher_;
   scoped_ptr<content::ResourceFetcher> tracking_fetcher_;
diff --git a/chrome/renderer/net/net_error_page_controller.cc b/chrome/renderer/net/net_error_page_controller.cc
index 495c5b1..f9a2ed3 100644
--- a/chrome/renderer/net/net_error_page_controller.cc
+++ b/chrome/renderer/net/net_error_page_controller.cc
@@ -43,6 +43,10 @@
   return ButtonClick(error_page::NetErrorHelperCore::SHOW_SAVED_COPY_BUTTON);
 }
 
+bool NetErrorPageController::ShowSavedPagesButtonClick() {
+  return ButtonClick(error_page::NetErrorHelperCore::SHOW_SAVED_PAGES_BUTTON);
+}
+
 bool NetErrorPageController::ReloadButtonClick() {
   return ButtonClick(error_page::NetErrorHelperCore::RELOAD_BUTTON);
 }
@@ -92,6 +96,8 @@
              isolate)
       .SetMethod("showSavedCopyButtonClick",
                  &NetErrorPageController::ShowSavedCopyButtonClick)
+      .SetMethod("showSavedPagesButtonClick",
+                 &NetErrorPageController::ShowSavedPagesButtonClick)
       .SetMethod("reloadButtonClick",
                  &NetErrorPageController::ReloadButtonClick)
       .SetMethod("detailsButtonClick",
diff --git a/chrome/renderer/net/net_error_page_controller.h b/chrome/renderer/net/net_error_page_controller.h
index cafd562..95216cbf 100644
--- a/chrome/renderer/net/net_error_page_controller.h
+++ b/chrome/renderer/net/net_error_page_controller.h
@@ -54,6 +54,9 @@
   // Execute a "Show saved copy" button click.
   bool ShowSavedCopyButtonClick();
 
+  // Execute a "Show saved pages" button click.
+  bool ShowSavedPagesButtonClick();
+
   // Execute a "Reload" button click.
   bool ReloadButtonClick();
 
diff --git a/chrome/renderer/resources/neterror.html b/chrome/renderer/resources/neterror.html
index 338c30f..9e8973a4 100644
--- a/chrome/renderer/resources/neterror.html
+++ b/chrome/renderer/resources/neterror.html
@@ -37,6 +37,12 @@
             jsselect="showSavedCopyButton"
             jscontent="msg" jsvalues="title:title; .primary:primary">
         </button>
+        <button id="show-saved-pages-button"
+            class="blue-button text-button"
+            onclick="showSavedPagesButtonClick()"
+            jsselect="showSavedPagesButton"
+            jscontent="msg" jsvalues="title:title; .primary:primary">
+        </button>
       </div>
       <button id="details-button" class="text-button small-link"
          onclick="detailsButtonClick(); toggleHelpBox()"
diff --git a/chrome/renderer/resources/neterror.js b/chrome/renderer/resources/neterror.js
index d21700a..5bab31d 100644
--- a/chrome/renderer/resources/neterror.js
+++ b/chrome/renderer/resources/neterror.js
@@ -114,6 +114,12 @@
   }
 }
 
+function showSavedPagesButtonClick() {
+  if (window.errorPageController) {
+    errorPageController.showSavedPagesButtonClick();
+  }
+}
+
 function detailsButtonClick() {
   if (window.errorPageController)
     errorPageController.detailsButtonClick();
@@ -150,13 +156,27 @@
   var reloadButton = document.getElementById('reload-button');
   var detailsButton = document.getElementById('details-button');
   var showSavedCopyButton = document.getElementById('show-saved-copy-button');
+  var showSavedPagesButton = document.getElementById('show-saved-pages-button');
+
+  // "Show save pages" button will only be provided in ERR_INTERNET_DISCONNECTED
+  // page where "Reload" button will not be provided.
+  var reloadButtonVisible = loadTimeData.valueExists('reloadButton') &&
+      loadTimeData.getValue('reloadButton').msg;
+  var showSavedCopyButtonVisible =
+      loadTimeData.valueExists('showSavedCopyButton') &&
+      loadTimeData.getValue('showSavedCopyButton').msg;
+  var showSavedPagesButtonVisible =
+      loadTimeData.valueExists('showSavedPagesButton') &&
+      loadTimeData.getValue('showSavedPagesButton').msg;
 
   var primaryButton, secondaryButton;
   if (showSavedCopyButton.primary) {
     primaryButton = showSavedCopyButton;
-    secondaryButton = reloadButton;
+    secondaryButton =
+        showSavedPagesButtonVisible ? showSavedPagesButton : reloadButton;
   } else {
-    primaryButton = reloadButton;
+    primaryButton =
+        showSavedPagesButtonVisible ? showSavedPagesButton : reloadButton;
     secondaryButton = showSavedCopyButton;
   }
 
@@ -175,7 +195,8 @@
   }
 
   if (reloadButton.style.display == 'none' &&
-      showSavedCopyButton.style.display == 'none') {
+      showSavedCopyButton.style.display == 'none' &&
+      showSavedPagesButton.style.display == 'none') {
     detailsButton.classList.add('singular');
   }
 
@@ -188,17 +209,13 @@
 </if>
 
   // Show control buttons.
-  if (loadTimeData.valueExists('reloadButton') &&
-          loadTimeData.getValue('reloadButton').msg ||
-      loadTimeData.valueExists('showSavedCopyButton') &&
-          loadTimeData.getValue('showSavedCopyButton').msg) {
+  if (reloadButtonVisible || showSavedCopyButtonVisible ||
+      showSavedPagesButtonVisible) {
     controlButtonDiv.hidden = false;
 
     // Set the secondary button state in the cases of two call to actions.
-    if (loadTimeData.valueExists('reloadButton') &&
-            loadTimeData.getValue('reloadButton').msg &&
-        loadTimeData.valueExists('showSavedCopyButton') &&
-            loadTimeData.getValue('showSavedCopyButton').msg) {
+    if ((reloadButtonVisible || showSavedPagesButtonVisible) &&
+        showSavedCopyButtonVisible) {
       secondaryButton.classList.add('secondary-button');
     }
   }
diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc
index 050b53f..9046263 100644
--- a/chrome/test/base/tracing.cc
+++ b/chrome/test/base/tracing.cc
@@ -56,9 +56,9 @@
 
   bool BeginTracing(const std::string& category_patterns) {
     DCHECK_CURRENTLY_ON(BrowserThread::UI);
-    return content::TracingController::GetInstance()->EnableRecording(
+    return content::TracingController::GetInstance()->StartTracing(
         base::trace_event::TraceConfig(category_patterns, ""),
-        content::TracingController::EnableRecordingDoneCallback());
+        content::TracingController::StartTracingDoneCallback());
   }
 
   bool BeginTracingWithWatch(const std::string& category_patterns,
@@ -74,7 +74,7 @@
                        base::Unretained(this)))) {
       return false;
     }
-    if (!content::TracingController::GetInstance()->EnableRecording(
+    if (!content::TracingController::GetInstance()->StartTracing(
             base::trace_event::TraceConfig(category_patterns, ""),
             base::Bind(&InProcessTraceController::OnEnableTracingComplete,
                        base::Unretained(this)))) {
@@ -108,7 +108,7 @@
     DCHECK_CURRENTLY_ON(BrowserThread::UI);
     using namespace base::debug;
 
-    if (!content::TracingController::GetInstance()->DisableRecording(
+    if (!content::TracingController::GetInstance()->StopTracing(
             new StringTraceSink(
                 json_trace_output,
                 base::Bind(&InProcessTraceController::OnTracingComplete,
diff --git a/chrome/test/data/webui/extensions/cr_extensions_browsertest.js b/chrome/test/data/webui/extensions/cr_extensions_browsertest.js
index 7430d6f..c59d30e 100644
--- a/chrome/test/data/webui/extensions/cr_extensions_browsertest.js
+++ b/chrome/test/data/webui/extensions/cr_extensions_browsertest.js
@@ -34,6 +34,7 @@
 
   /** @override */
   extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
+    'extension_test_util.js',
     'extension_item_test.js',
     'extension_service_test.js',
     'extension_sidebar_test.js',
@@ -47,12 +48,12 @@
 
 TEST_F('CrExtensionsBrowserTest', 'ExtensionSidebarLayoutTest', function() {
   extension_sidebar_tests.registerTests();
-  mocha.grep('test sidebar layout').run();
+  mocha.grep(assert(extension_sidebar_tests.testNames.Layout)).run();
 });
 TEST_F('CrExtensionsBrowserTest', 'ExtensionSidebarClickHandlerTest',
        function() {
   extension_sidebar_tests.registerTests();
-  mocha.grep('test sidebar click handlers').run();
+  mocha.grep(assert(extension_sidebar_tests.testNames.ClickHandlers)).run();
 });
 
 function CrExtensionsBrowserTestWithInstalledExtension() {}
@@ -95,21 +96,22 @@
 
 TEST_F('CrExtensionsBrowserTestWithInstalledExtension',
        'ExtensionServiceToggleEnableTest', function() {
-  extension_service_tests.registerToggleEnableTests();
-  mocha.run();
+  extension_service_tests.registerTests();
+  mocha.grep(assert(extension_service_tests.testNames.EnableAndDisable)).run();
 });
 TEST_F('CrExtensionsBrowserTestWithInstalledExtension',
        'ExtensionServiceToggleIncognitoTest', function() {
-  extension_service_tests.registerToggleIncognitoTests();
-  mocha.run();
+  extension_service_tests.registerTests();
+  mocha.grep(
+      assert(extension_service_tests.testNames.ToggleIncognitoMode)).run();
 });
 TEST_F('CrExtensionsBrowserTestWithInstalledExtension',
        'ExtensionServiceUninstallTest', function() {
-  extension_service_tests.registerUninstallTests();
-  mocha.run();
+  extension_service_tests.registerTests();
+  mocha.grep(assert(extension_service_tests.testNames.Uninstall)).run();
 });
 TEST_F('CrExtensionsBrowserTestWithInstalledExtension',
        'ExtensionServiceProfileSettingsTest', function() {
-  extension_service_tests.registerProfileSettingsTests();
-  mocha.run();
+  extension_service_tests.registerTests();
+  mocha.grep(assert(extension_service_tests.testNames.ProfileSettings)).run();
 });
diff --git a/chrome/test/data/webui/extensions/extension_item_test.js b/chrome/test/data/webui/extensions/extension_item_test.js
index 4b385ac..f56b008 100644
--- a/chrome/test/data/webui/extensions/extension_item_test.js
+++ b/chrome/test/data/webui/extensions/extension_item_test.js
@@ -7,27 +7,13 @@
   /**
    * A mock delegate for the item, capable of testing functionality.
    * @constructor
+   * @extends {extension_test_util.ClickMock}
    * @implements {extensions.ItemDelegate}
    */
   function MockDelegate() {}
 
   MockDelegate.prototype = {
-    /**
-     * Tests clicking on an element and expected a delegate call from the
-     * item.
-     * @param {HTMLElement} element The element to click on.
-     * @param {string} callName The function expected to be called.
-     * @param {Array<?>=} opt_expectedArgs The arguments the function is
-     *     expected to be called with.
-     */
-    testClickingCalls: function(element, callName, opt_expectedArgs) {
-      var mock = new MockController();
-      var mockMethod = mock.createFunctionMock(this, callName);
-      MockMethod.prototype.addExpectation.apply(
-          mockMethod, opt_expectedArgs);
-      MockInteractions.tap(element);
-      mock.verifyMocks();
-    },
+    __proto__: extension_test_util.ClickMock.prototype,
 
     /** @override */
     deleteItem: function(id) {},
@@ -70,30 +56,6 @@
     views: [{url: baseUrl + 'foo.html'}, {url: baseUrl + 'bar.html'}],
   };
 
-  /**
-   * Tests that the element's visibility matches |expectedVisible| and,
-   * optionally, has specific content.
-   * @param {HTMLElement} item The item to query for the element.
-   * @param {boolean} expectedVisible Whether the element should be
-   *     visible.
-   * @param {string} selector The selector to find the element.
-   * @param {string=} opt_expected The expected textContent value.
-   */
-  function testVisible(item, expectedVisible, selector, opt_expected) {
-    var element = item.$$(selector);
-    var elementIsVisible = !!element;
-    // Iterate through the parents of the element (up to the item's root)
-    // and check if each is visible. If one is not, then the element
-    // itself is not.
-    for (var e = element; elementIsVisible && e != item.shadowRoot;
-         e = e.parentNode) {
-      elementIsVisible = !e.hidden && e.offsetWidth > 0;
-    }
-    expectEquals(expectedVisible, elementIsVisible, selector);
-    if (expectedVisible && opt_expected && element)
-      expectEquals(opt_expected, element.textContent, selector);
-  }
-
   // The normal elements, which should always be shown.
   var normalElements = [
     {selector: '#name', text: extensionData.name},
@@ -127,7 +89,8 @@
    */
   function testElementsVisibility(item, elements, visibility) {
     elements.forEach(function(element) {
-      testVisible(item, visibility, element.selector, element.text);
+      extension_test_util.testVisible(
+          item, element.selector, visibility, element.text);
     });
   }
 
diff --git a/chrome/test/data/webui/extensions/extension_service_test.js b/chrome/test/data/webui/extensions/extension_service_test.js
index 7be85466..24fb0fd 100644
--- a/chrome/test/data/webui/extensions/extension_service_test.js
+++ b/chrome/test/data/webui/extensions/extension_service_test.js
@@ -4,15 +4,6 @@
 
 /** @fileoverview Suite of tests for extension-item. */
 cr.define('extension_service_tests', function() {
-  /** @const */
-  var kExtensionId = 'ldnnhddmnhbkjipkidpdiheffobcpfmf';
-
-  /** @const */
-  var EventType = chrome.developerPrivate.EventType;
-
-  /** @const */
-  var ExtensionState = chrome.developerPrivate.ExtensionState;
-
   /** @constructor */
   function ChangeListener() {}
 
@@ -67,14 +58,28 @@
                function() { return true; });
   }
 
-  function registerToggleEnableTests() {
-    suite('ExtensionServiceTest', function() {
-      // The 2-second timeout that Mocha has by default isn't nearly enough for
-      // our slower bots, like Dr. Memory. Just disable Mocha timeouts and let
-      // the C++ fixtures handle it.
-      this.timeout(0);
+  var testNames = {
+    EnableAndDisable: 'enable and disable',
+    ToggleIncognitoMode: 'toggle incognito mode',
+    Uninstall: 'uninstall',
+    ProfileSettings: 'profile settings',
+  };
 
+  function registerTests() {
+    suite('ExtensionServiceTest', function() {
+      /** @const{string} */
+      var kExtensionId = 'ldnnhddmnhbkjipkidpdiheffobcpfmf';
+
+      /** @const */
+      var EventType = chrome.developerPrivate.EventType;
+
+      /** @const */
+      var ExtensionState = chrome.developerPrivate.ExtensionState;
+
+      /** @type {extensions.Service} */
       var service;
+
+      /** @type {extensions.Manager} */
       var manager;
 
       suiteSetup(function() {
@@ -87,7 +92,7 @@
         manager = document.getElementsByTagName('extensions-manager')[0];
       });
 
-      test('Test extension service enable and disable', function(done) {
+      test(testNames.EnableAndDisable, function(done) {
         var item = manager.getItem(kExtensionId);
         assertTrue(!!item);
         expectEquals(kExtensionId, item.id);
@@ -109,27 +114,8 @@
           done();
         });
       });
-    });
-  }
 
-  function registerToggleIncognitoTests() {
-    suite('ExtensionServiceToggleIncognitoTest', function() {
-      this.timeout(0);
-
-      var service;
-      var manager;
-
-      suiteSetup(function() {
-        return PolymerTest.importHtml('chrome://extensions/service.html');
-      });
-
-      // Initialize an extension item before each test.
-      setup(function() {
-        service = extensions.Service.getInstance();
-        manager = document.getElementsByTagName('extensions-manager')[0];
-      });
-
-      test('Test extension service toggle incognito mode', function(done) {
+      test(testNames.ToggleIncognitoMode, function(done) {
         var item = manager.getItem(kExtensionId);
         assertTrue(!!item);
         expectTrue(item.data.incognitoAccess.isEnabled);
@@ -154,27 +140,8 @@
           done();
         });
       });
-    });
-  }
 
-  function registerUninstallTests() {
-    suite('ExtensionServiceUninstallTest', function() {
-      this.timeout(0);
-
-      var service;
-      var manager;
-
-      suiteSetup(function() {
-        return PolymerTest.importHtml('chrome://extensions/service.html');
-      });
-
-      // Initialize an extension item before each test.
-      setup(function() {
-        service = extensions.Service.getInstance();
-        manager = document.querySelector('extensions-manager');
-      });
-
-      test('Test extension service uninstall', function(done) {
+      test(testNames.Uninstall, function(done) {
         var item = manager.getItem(kExtensionId);
         assertTrue(!!item);
         var uninstallListener =
@@ -187,27 +154,8 @@
           done();
         });
       });
-    });
-  }
 
-  function registerProfileSettingsTests() {
-    suite('ExtensionServiceProfileSettingsTest', function() {
-      this.timeout(0);
-
-      var service;
-      var manager;
-
-      suiteSetup(function() {
-        return PolymerTest.importHtml('chrome://extensions/service.html');
-      });
-
-      // Initialize an extension item before each test.
-      setup(function() {
-        service = extensions.Service.getInstance();
-        manager = document.getElementsByTagName('extensions-manager')[0];
-      });
-
-      test('Test extension service profile settings', function(done) {
+      test(testNames.ProfileSettings, function(done) {
         var item = manager.getItem(kExtensionId);
         assertTrue(!!item);
         expectFalse(item.inDevMode);
@@ -231,9 +179,7 @@
 
   return {
     ChangeListener: ChangeListener,
-    registerToggleEnableTests: registerToggleEnableTests,
-    registerToggleIncognitoTests: registerToggleIncognitoTests,
-    registerUninstallTests: registerUninstallTests,
-    registerProfileSettingsTests: registerProfileSettingsTests,
+    registerTests: registerTests,
+    testNames: testNames,
   };
 });
diff --git a/chrome/test/data/webui/extensions/extension_sidebar_test.js b/chrome/test/data/webui/extensions/extension_sidebar_test.js
index a1911871..59cb165 100644
--- a/chrome/test/data/webui/extensions/extension_sidebar_test.js
+++ b/chrome/test/data/webui/extensions/extension_sidebar_test.js
@@ -4,33 +4,16 @@
 
 /** @fileoverview Suite of tests for extension-sidebar. */
 cr.define('extension_sidebar_tests', function() {
-  /** @type {extensions.Sidebar} */
-  var sidebar;
-
   /**
-   * A mock delegate for the sidebar, capable of testing functionality.
+   * A mock delegate for the sidebar.
    * @constructor
    * @implements {extensions.SidebarDelegate}
+   * @extends {extension_test_util.ClickMock}
    */
   function MockDelegate() {}
 
   MockDelegate.prototype = {
-    /**
-     * Tests clicking on an element and expected a delegate call from the
-     * sidebar.
-     * @param {HTMLElement} element The element to click on.
-     * @param {string} callName The function expected to be called.
-     * @param {Array<?>=} opt_expectedArgs The arguments the function is
-     *     expected to be called with.
-     */
-    testClickingCalls: function(element, callName, opt_expectedArgs) {
-      var mock = new MockController();
-      var mockMethod = mock.createFunctionMock(this, callName);
-      MockMethod.prototype.addExpectation.apply(
-          mockMethod, opt_expectedArgs);
-      MockInteractions.tap(element);
-      mock.verifyMocks();
-    },
+    __proto__: extension_test_util.ClickMock.prototype,
 
     /** @override */
     setProfileInDevMode: function(inDevMode) {},
@@ -45,24 +28,19 @@
     updateAllExtensions: function() {},
   };
 
-  /**
-   * Tests that the element's visibility matches |expectedVisible|.
-   * @param {boolean} expectedVisible Whether the element should be
-   *     visible.
-   * @param {string} selector The selector to find the element.
-   */
-  function testVisible(selector, expectedVisible) {
-    var element = sidebar.$$(selector);
-    var rect = element ? element.getBoundingClientRect() : null;
-    var isVisible = !!rect && (rect.width * rect.height > 0);
-    expectEquals(expectedVisible, isVisible, selector);
-  }
+  var testNames = {
+    Layout: 'layout',
+    ClickHandlers: 'click handlers',
+  };
 
   function registerTests() {
     suite('ExtensionSidebarTest', function() {
       /** @type {MockDelegate} */
       var mockDelegate;
 
+      /** @type {extensions.Sidebar} */
+      var sidebar;
+
       // Import cr_settings_checkbox.html before running suite.
       suiteSetup(function() {
         return PolymerTest.importHtml('chrome://extensions/sidebar.html');
@@ -74,7 +52,8 @@
         sidebar.setDelegate(mockDelegate);
       });
 
-      test('test sidebar layout', function() {
+      test(testNames.Layout, function() {
+        var testVisible = extension_test_util.testVisible.bind(null, sidebar);
         testVisible('#load-unpacked', false);
         testVisible('#pack-extensions', false);
         testVisible('#update-now', false);
@@ -87,7 +66,7 @@
         testVisible('#update-now', true);
       });
 
-      test('test sidebar click handlers', function() {
+      test(testNames.ClickHandlers, function() {
         sidebar.set('inDevMode', true);
         Polymer.dom.flush();
 
@@ -109,5 +88,6 @@
 
   return {
     registerTests: registerTests,
+    testNames: testNames,
   };
 });
diff --git a/chrome/test/data/webui/extensions/extension_test_util.js b/chrome/test/data/webui/extensions/extension_test_util.js
new file mode 100644
index 0000000..ccea8dfe
--- /dev/null
+++ b/chrome/test/data/webui/extensions/extension_test_util.js
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Common utilities for extension ui tests. */
+cr.define('extension_test_util', function() {
+  /**
+   * A mock to test that clicking on an element calls a specific method.
+   * @constructor
+   */
+  function ClickMock() {}
+
+  ClickMock.prototype = {
+    /**
+     * Tests clicking on an element and expecting a call.
+     * @param {HTMLElement} element The element to click on.
+     * @param {string} callName The function expected to be called.
+     * @param {Array<*>=} opt_expectedArgs The arguments the function is
+     *     expected to be called with.
+     */
+    testClickingCalls: function(element, callName, opt_expectedArgs) {
+      var mock = new MockController();
+      var mockMethod = mock.createFunctionMock(this, callName);
+      MockMethod.prototype.addExpectation.apply(
+          mockMethod, opt_expectedArgs);
+      MockInteractions.tap(element);
+      mock.verifyMocks();
+    },
+  };
+
+  /**
+   * Tests that the element's visibility matches |expectedVisible| and,
+   * optionally, has specific content if it is visible.
+   * @param {!HTMLElement} parentEl The parent element to query for the element.
+   * @param {string} selector The selector to find the element.
+   * @param {boolean} expectedVisible Whether the element should be
+   *     visible.
+   * @param {string=} opt_expected The expected textContent value.
+   */
+  function testVisible(parentEl, selector, expectedVisible, opt_expected) {
+    var element = parentEl.$$(selector);
+    var rect = element ? element.getBoundingClientRect() : null;
+    var isVisible = !!rect && rect.width * rect.height > 0;
+    expectEquals(expectedVisible, isVisible, selector);
+    if (expectedVisible && opt_expected && element)
+      expectEquals(opt_expected, element.textContent, selector);
+  }
+
+  return {
+    ClickMock: ClickMock,
+    testVisible: testVisible,
+  };
+});
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn
index 1223add..730ffe54 100644
--- a/chromecast/browser/BUILD.gn
+++ b/chromecast/browser/BUILD.gn
@@ -162,6 +162,8 @@
   deps = [
     ":test_support",
     "//base",
+    "//content/test:test_support",
+    "//media/base:test_support",
     "//testing/gtest",
     "//url",
   ]
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index bb9b317f..1e34da9 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -9,6 +9,9 @@
 #include <signal.h>
 #include <sys/prctl.h>
 #endif
+#if defined(OS_LINUX)
+#include <fontconfig/fontconfig.h>
+#endif
 
 #include "base/command_line.h"
 #include "base/files/file_util.h"
@@ -255,6 +258,23 @@
 #endif  // defined(OS_ANDROID)
 }
 
+void CastBrowserMainParts::ToolkitInitialized() {
+#if defined(OS_LINUX)
+  // Without this call, the FontConfig library gets implicitly initialized
+  // on the first call to FontConfig. Since it's not safe to initialize it
+  // concurrently from multiple threads, we explicitly initialize it here
+  // to prevent races when there are multiple renderer's querying the library:
+  // http://crbug.com/404311
+  // Also, implicit initialization can cause a long delay on the first
+  // rendering if the font cache has to be regenerated for some reason. Doing it
+  // explicitly here helps in cases where the browser process is starting up in
+  // the background (resources have not yet been granted to cast) since it
+  // prevents the long delay the user would have seen on first rendering. Note
+  // that future calls to FcInit() are safe no-ops per the FontConfig interface.
+  FcInit();
+#endif
+}
+
 int CastBrowserMainParts::PreCreateThreads() {
 #if defined(OS_ANDROID)
   // GPU process is started immediately after threads are created, requiring
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h
index 6acd6d0..84e03b3 100644
--- a/chromecast/browser/cast_browser_main_parts.h
+++ b/chromecast/browser/cast_browser_main_parts.h
@@ -29,6 +29,7 @@
   // content::BrowserMainParts implementation:
   void PreMainMessageLoopStart() override;
   void PostMainMessageLoopStart() override;
+  void ToolkitInitialized() override;
   int PreCreateThreads() override;
   void PreMainMessageLoopRun() override;
   bool MainMessageLoopRun(int* result_code) override;
diff --git a/chromecast/browser/test/chromecast_shell_browser_test.cc b/chromecast/browser/test/chromecast_shell_browser_test.cc
index bc83b4c..d617f25e 100644
--- a/chromecast/browser/test/chromecast_shell_browser_test.cc
+++ b/chromecast/browser/test/chromecast_shell_browser_test.cc
@@ -3,12 +3,21 @@
 // found in the LICENSE file.
 
 #include "base/macros.h"
+#include "base/strings/string_split.h"
+#include "base/strings/utf_string_conversions.h"
 #include "chromecast/browser/test/chromecast_browser_test.h"
+#include "content/public/test/browser_test_utils.h"
+#include "media/base/test_data_util.h"
 #include "url/gurl.h"
 #include "url/url_constants.h"
 
 namespace chromecast {
 namespace shell {
+namespace {
+const char kEnded[] = "ENDED";
+const char kError[] = "ERROR";
+const char kFailed[] = "FAILED";
+}
 
 class ChromecastShellBrowserTest : public ChromecastBrowserTest {
  public:
@@ -19,9 +28,45 @@
     NavigateToURL(web_contents(), url_);
   }
 
+  void PlayVideo(const std::string& media_file) {
+    PlayMedia("video", media_file);
+  }
+
  private:
   const GURL url_;
 
+  void PlayMedia(const std::string& tag,
+                 const std::string& media_file) {
+    base::StringPairs query_params;
+    query_params.push_back(std::make_pair(tag, media_file));
+    RunMediaTestPage("player.html", query_params, kEnded);
+  }
+
+  void RunMediaTestPage(const std::string& html_page,
+                        const base::StringPairs& query_params,
+                        const std::string& expected_title) {
+    std::string query = media::GetURLQueryString(query_params);
+    GURL gurl = content::GetFileUrlWithQuery(
+        media::GetTestDataFilePath(html_page),
+        query);
+
+    std::string final_title = RunTest(gurl, expected_title);
+    EXPECT_EQ(expected_title, final_title);
+  }
+
+  std::string RunTest(const GURL& gurl,
+                      const std::string& expected_title) {
+    content::TitleWatcher title_watcher(web_contents(),
+                                        base::ASCIIToUTF16(expected_title));
+    title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(kEnded));
+    title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(kError));
+    title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(kFailed));
+
+    NavigateToURL(web_contents(), gurl);
+    base::string16 result = title_watcher.WaitAndGetTitle();
+    return base::UTF16ToASCII(result);
+  }
+
   DISALLOW_COPY_AND_ASSIGN(ChromecastShellBrowserTest);
 };
 
@@ -32,5 +77,9 @@
   EXPECT_TRUE(true);
 }
 
+IN_PROC_BROWSER_TEST_F(ChromecastShellBrowserTest, MediaPlayback) {
+  PlayVideo("bear.mp4");
+}
+
 }  // namespace shell
 }  // namespace chromecast
diff --git a/chromecast/chromecast_tests.gypi b/chromecast/chromecast_tests.gypi
index f3c6249..53316ba1f 100644
--- a/chromecast/chromecast_tests.gypi
+++ b/chromecast/chromecast_tests.gypi
@@ -348,6 +348,8 @@
           'type': '<(gtest_target_type)',
           'dependencies': [
             'cast_shell_test_support',
+            '../content/content_shell_and_tests.gyp:test_support_content',
+            '../media/media.gyp:media_test_support',
             '../testing/gtest.gyp:gtest',
           ],
           'defines': [
@@ -356,6 +358,15 @@
           'sources': [
             'browser/test/chromecast_shell_browser_test.cc',
           ],
+          'conditions': [
+            ['chromecast_branding=="public"', {
+              'dependencies': [
+                # Link default libcast_media_1.0 statically to prevent
+                # linking dynamically against dummy implementation.
+                'media/media.gyp:libcast_media_1.0_default_core',
+              ],
+            }],
+          ],
         },
         # GN target: //chromecast/app:cast_shell_unittests
         {
diff --git a/chromecast/renderer/media/hole_frame_factory.cc b/chromecast/renderer/media/hole_frame_factory.cc
index 62dad08..5d9adda 100644
--- a/chromecast/renderer/media/hole_frame_factory.cc
+++ b/chromecast/renderer/media/hole_frame_factory.cc
@@ -27,12 +27,14 @@
     gl->BindTexture(GL_TEXTURE_2D, texture_);
     image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM(1, 1, GL_RGBA,
                                                        GL_READ_WRITE_CHROMIUM);
-    gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
+    if (image_id_) {
+      gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
 
-    gl->GenMailboxCHROMIUM(mailbox_.name);
-    gl->ProduceTextureDirectCHROMIUM(texture_, GL_TEXTURE_2D, mailbox_.name);
+      gl->GenMailboxCHROMIUM(mailbox_.name);
+      gl->ProduceTextureDirectCHROMIUM(texture_, GL_TEXTURE_2D, mailbox_.name);
 
-    sync_token_ = gpu::SyncToken(gl->InsertSyncPointCHROMIUM());
+      sync_token_ = gpu::SyncToken(gl->InsertSyncPointCHROMIUM());
+    }
   }
 }
 
@@ -43,15 +45,17 @@
     CHECK(lock);
     gpu::gles2::GLES2Interface* gl = lock->ContextGL();
     gl->BindTexture(GL_TEXTURE_2D, texture_);
-    gl->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
+    if (image_id_)
+      gl->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
     gl->DeleteTextures(1, &texture_);
-    gl->DestroyImageCHROMIUM(image_id_);
+    if (image_id_)
+      gl->DestroyImageCHROMIUM(image_id_);
   }
 }
 
 scoped_refptr<::media::VideoFrame> HoleFrameFactory::CreateHoleFrame(
     const gfx::Size& size) {
-  if (texture_) {
+  if (texture_ && image_id_) {
     scoped_refptr<::media::VideoFrame> frame =
         ::media::VideoFrame::WrapNativeTexture(
             ::media::PIXEL_FORMAT_XRGB,
diff --git a/components/OWNERS b/components/OWNERS
index e1596ab..9b448b10 100644
--- a/components/OWNERS
+++ b/components/OWNERS
@@ -64,10 +64,12 @@
 per-file cronet*=xunjieli@chromium.org
 
 per-file data_reduction_proxy*=bengr@chromium.org
-per-file data_reduction_proxy*=marq@chromium.org
 per-file data_reduction_proxy*=bolian@chromium.org
-per-file data_reduction_proxy*=sclittle@chromium.org
+per-file data_reduction_proxy*=kundaji@chromium.org
+per-file data_reduction_proxy*=marq@chromium.org
 per-file data_reduction_proxy*=megjablon@chromium.org
+per-file data_reduction_proxy*=sclittle@chromium.org
+per-file data_reduction_proxy*=tbansal@chromium.org
 
 per-file data_usage*=bengr@chromium.org
 per-file data_usage*=sclittle@chromium.org
diff --git a/components/autofill.gypi b/components/autofill.gypi
index 19ff103..b4dfa77c 100644
--- a/components/autofill.gypi
+++ b/components/autofill.gypi
@@ -88,6 +88,7 @@
         'autofill_core_common',
         'components_resources.gyp:components_resources',
         'components_strings.gyp:components_strings',
+        'compression',
         'data_use_measurement_core',
         'infobars_core',
         'keyed_service_core',
diff --git a/components/autofill/core/DEPS b/components/autofill/core/DEPS
index 2ee4fb8..5af6466 100644
--- a/components/autofill/core/DEPS
+++ b/components/autofill/core/DEPS
@@ -1,4 +1,5 @@
 include_rules = [
+  "+components/compression",
   "+components/os_crypt",
   "+components/pref_registry",
   "+components/rappor",
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn
index 28ad3c59..7ac95fe 100644
--- a/components/autofill/core/browser/BUILD.gn
+++ b/components/autofill/core/browser/BUILD.gn
@@ -149,6 +149,7 @@
     "//base:i18n",
     "//base:prefs",
     "//components/autofill/core/common",
+    "//components/compression",
     "//components/data_use_measurement/core",
     "//components/infobars/core",
     "//components/keyed_service/core",
@@ -275,6 +276,7 @@
     "//base:prefs_test_support",
     "//base/test:test_support",
     "//components/autofill/core/common",
+    "//components/compression",
     "//components/os_crypt",
     "//components/rappor:test_support",
     "//components/resources",
diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc
index 565b2b75..4f2a391 100644
--- a/components/autofill/core/browser/autofill_download_manager.cc
+++ b/components/autofill/core/browser/autofill_download_manager.cc
@@ -14,6 +14,7 @@
 #include "components/autofill/core/browser/autofill_xml_parser.h"
 #include "components/autofill/core/browser/form_structure.h"
 #include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/compression/compression_utils.h"
 #include "components/data_use_measurement/core/data_use_user_data.h"
 #include "components/variations/net/variations_http_header_provider.h"
 #include "net/base/load_flags.h"
@@ -193,6 +194,16 @@
   DCHECK(request_context);
   GURL request_url = GetRequestUrl(request_data.request_type);
 
+  std::string compressed_data;
+  if (!compression::GzipCompress(form_xml, &compressed_data)) {
+    NOTREACHED();
+    return false;
+  }
+
+  AutofillMetrics::LogPayloadCompressionRatio(
+      static_cast<int>(100 * compressed_data.size() / form_xml.size()),
+      request_data.request_type);
+
   // Id is ignored for regular chrome, in unit test id's for fake fetcher
   // factory will be 0, 1, 2, ...
   net::URLFetcher* fetcher =
@@ -203,11 +214,12 @@
   url_fetchers_[fetcher] = request_data;
   fetcher->SetAutomaticallyRetryOn5xx(false);
   fetcher->SetRequestContext(request_context);
-  fetcher->SetUploadData("text/plain", form_xml);
+  fetcher->SetUploadData("text/xml", compressed_data);
   fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
                         net::LOAD_DO_NOT_SEND_COOKIES);
-  // Add Chrome experiment state to the request headers.
+  // Add Chrome experiment state and GZIP encoding to the request headers.
   net::HttpRequestHeaders headers;
+  headers.SetHeaderIfMissing("content-encoding", "gzip");
   variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders(
       fetcher->GetOriginalURL(), driver_->IsOffTheRecord(), false, &headers);
   fetcher->SetExtraRequestHeaders(headers.ToString());
diff --git a/components/autofill/core/browser/autofill_download_manager.h b/components/autofill/core/browser/autofill_download_manager.h
index eaf7b49..e1c8b9ff 100644
--- a/components/autofill/core/browser/autofill_download_manager.h
+++ b/components/autofill/core/browser/autofill_download_manager.h
@@ -91,6 +91,7 @@
  private:
   friend class AutofillDownloadTest;
   FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest);
+  FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, UploadRequestIsGzipped);
 
   struct FormRequestData;
   typedef std::list<std::pair<std::string, std::string> > QueryRequestCache;
diff --git a/components/autofill/core/browser/autofill_download_manager_unittest.cc b/components/autofill/core/browser/autofill_download_manager_unittest.cc
index b5ba01c25..042aba1 100644
--- a/components/autofill/core/browser/autofill_download_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_download_manager_unittest.cc
@@ -20,6 +20,8 @@
 #include "components/autofill/core/browser/form_structure.h"
 #include "components/autofill/core/browser/test_autofill_driver.h"
 #include "components/autofill/core/common/form_data.h"
+#include "components/compression/compression_utils.h"
+#include "net/http/http_request_headers.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "net/url_request/url_request_status.h"
 #include "net/url_request/url_request_test_util.h"
@@ -45,6 +47,13 @@
   fetcher->delegate()->OnURLFetchComplete(fetcher);
 }
 
+// Compresses |data| and returns the result.
+std::string Compress(const std::string& data) {
+  std::string compressed_data;
+  EXPECT_TRUE(compression::GzipCompress(data, &compressed_data));
+  return compressed_data;
+}
+
 }  // namespace
 
 // This tests AutofillDownloadManager. AutofillDownloadTest implements
@@ -548,4 +557,119 @@
   EXPECT_EQ(responses[0], responses_.front().response);
 }
 
+TEST_F(AutofillDownloadTest, QueryRequestIsGzipped) {
+  // Expected query (uncompressed for visual verification).
+  const char* kExpectedQueryXml =
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+      "<autofillquery clientversion=\"6.1.1715.1442/en (GGLL)\">"
+      "<form signature=\"14546501144368603154\">"
+      "<field signature=\"239111655\"/>"
+      "<field signature=\"3763331450\"/>"
+      "<field signature=\"3494530716\"/>"
+      "</form></autofillquery>";
+
+  // Create and register factory.
+  net::TestURLFetcherFactory factory;
+
+  FormData form;
+
+  FormFieldData field;
+  field.form_control_type = "text";
+
+  field.label = ASCIIToUTF16("username");
+  field.name = ASCIIToUTF16("username");
+  form.fields.push_back(field);
+
+  field.label = ASCIIToUTF16("First Name");
+  field.name = ASCIIToUTF16("firstname");
+  form.fields.push_back(field);
+
+  field.label = ASCIIToUTF16("Last Name");
+  field.name = ASCIIToUTF16("lastname");
+  form.fields.push_back(field);
+
+  FormStructure* form_structure = new FormStructure(form);
+  ScopedVector<FormStructure> form_structures;
+  form_structures.push_back(form_structure);
+
+  base::HistogramTester histogram;
+  // Request with id 0.
+  EXPECT_TRUE(download_manager_.StartQueryRequest(form_structures.get()));
+  histogram.ExpectUniqueSample("Autofill.ServerQueryResponse",
+                               AutofillMetrics::QUERY_SENT, 1);
+
+  // Request payload is gzipped.
+  net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
+  ASSERT_TRUE(fetcher);
+  EXPECT_EQ(Compress(kExpectedQueryXml), fetcher->upload_data());
+
+  // Proper content-encoding header is defined.
+  net::HttpRequestHeaders headers;
+  fetcher->GetExtraRequestHeaders(&headers);
+  std::string header;
+  EXPECT_TRUE(headers.GetHeader("content-encoding", &header));
+  EXPECT_EQ("gzip", header);
+
+  // Expect that the compression is logged.
+  histogram.ExpectUniqueSample("Autofill.PayloadCompressionRatio.Query", 73, 1);
+}
+
+TEST_F(AutofillDownloadTest, UploadRequestIsGzipped) {
+  // Expected upload (uncompressed for visual verification).
+  const char* kExpectedUploadXml =
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+      "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\""
+      " formsignature=\"14546501144368603154\" autofillused=\"true\""
+      " datapresent=\"\"/>";
+
+  // Create and register factory.
+  net::TestURLFetcherFactory factory;
+
+  FormData form;
+
+  FormFieldData field;
+  field.form_control_type = "text";
+
+  field.label = ASCIIToUTF16("username");
+  field.name = ASCIIToUTF16("username");
+  form.fields.push_back(field);
+
+  field.label = ASCIIToUTF16("First Name");
+  field.name = ASCIIToUTF16("firstname");
+  form.fields.push_back(field);
+
+  field.label = ASCIIToUTF16("Last Name");
+  field.name = ASCIIToUTF16("lastname");
+  form.fields.push_back(field);
+
+  FormStructure* form_structure = new FormStructure(form);
+  ScopedVector<FormStructure> form_structures;
+  form_structures.push_back(form_structure);
+
+  // Set upload to 100% so requests happen.
+  download_manager_.SetPositiveUploadRate(1.0);
+  download_manager_.SetNegativeUploadRate(1.0);
+
+  base::HistogramTester histogram;
+  // Request with id 0.
+  EXPECT_TRUE(download_manager_.StartUploadRequest(
+      *(form_structures[0]), true, ServerFieldTypeSet(), std::string()));
+
+  // Request payload is gzipped.
+  net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
+  ASSERT_TRUE(fetcher);
+  EXPECT_EQ(Compress(kExpectedUploadXml), fetcher->upload_data());
+
+  // Proper content-encoding header is defined.
+  net::HttpRequestHeaders headers;
+  fetcher->GetExtraRequestHeaders(&headers);
+  std::string header;
+  EXPECT_TRUE(headers.GetHeader("content-encoding", &header));
+  EXPECT_EQ("gzip", header);
+
+  // Expect that the compression is logged.
+  histogram.ExpectUniqueSample("Autofill.PayloadCompressionRatio.Upload", 92,
+                               1);
+}
+
 }  // namespace autofill
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc
index 8639612..e5a62fe8 100644
--- a/components/autofill/core/browser/autofill_metrics.cc
+++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -648,6 +648,22 @@
                             AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE);
 }
 
+// static
+void AutofillMetrics::LogPayloadCompressionRatio(
+    int compression_ratio,
+    AutofillDownloadManager::RequestType type) {
+  switch (type) {
+    case AutofillDownloadManager::REQUEST_QUERY:
+      UMA_HISTOGRAM_PERCENTAGE("Autofill.PayloadCompressionRatio.Query",
+                               compression_ratio);
+      break;
+    case AutofillDownloadManager::REQUEST_UPLOAD:
+      UMA_HISTOGRAM_PERCENTAGE("Autofill.PayloadCompressionRatio.Upload",
+                               compression_ratio);
+      break;
+  }
+}
+
 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card)
     : is_for_credit_card_(is_for_credit_card),
       is_server_data_available_(false),
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h
index b806a727..f0b5f8d 100644
--- a/components/autofill/core/browser/autofill_metrics.h
+++ b/components/autofill/core/browser/autofill_metrics.h
@@ -10,6 +10,7 @@
 
 #include "base/basictypes.h"
 #include "components/autofill/core/browser/autofill_client.h"
+#include "components/autofill/core/browser/autofill_download_manager.h"
 #include "components/autofill/core/browser/autofill_profile.h"
 #include "components/autofill/core/browser/credit_card.h"
 #include "components/autofill/core/browser/field_types.h"
@@ -591,6 +592,12 @@
   // state of the form.
   static void LogAutofillFormSubmittedState(AutofillFormSubmittedState state);
 
+  // Log the compression ratio obtained by compressing with gzip. Logs for the
+  // query or upload request, depending on |type|.
+  static void LogPayloadCompressionRatio(
+      int compression_ratio,
+      AutofillDownloadManager::RequestType type);
+
   // Utility to autofill form events in the relevant histograms depending on
   // the presence of server and/or local data.
   class FormEventLogger {
diff --git a/components/bitmap_uploader/DEPS b/components/bitmap_uploader/DEPS
index 8a0ec23..44c9628 100644
--- a/components/bitmap_uploader/DEPS
+++ b/components/bitmap_uploader/DEPS
@@ -8,4 +8,5 @@
   "+mojo/public",
   "+mojo/services/network/public/interfaces",
   "+ui/gfx/geometry",
+  "+third_party/mojo/src/mojo/public",
 ]
diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc
index f6525da..c2f35d1 100644
--- a/components/bitmap_uploader/bitmap_uploader.cc
+++ b/components/bitmap_uploader/bitmap_uploader.cc
@@ -13,8 +13,8 @@
 #include "mojo/converters/geometry/geometry_type_converters.h"
 #include "mojo/converters/surfaces/surfaces_type_converters.h"
 #include "mojo/converters/surfaces/surfaces_utils.h"
-#include "mojo/public/c/gles2/gles2.h"
 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 namespace bitmap_uploader {
 namespace {
diff --git a/components/bitmap_uploader/bitmap_uploader.h b/components/bitmap_uploader/bitmap_uploader.h
index ccb4d7a7..c843996 100644
--- a/components/bitmap_uploader/bitmap_uploader.h
+++ b/components/bitmap_uploader/bitmap_uploader.h
@@ -12,7 +12,7 @@
 #include "components/mus/public/interfaces/gpu.mojom.h"
 #include "gpu/GLES2/gl2chromium.h"
 #include "gpu/GLES2/gl2extchromium.h"
-#include "mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 namespace mojo {
 class Shell;
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 8187a69..98a13805 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -1283,6 +1283,7 @@
             'data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc',
             'data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc',
             'data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager_unittest.cc',
+            'data_usage/android/traffic_stats_amortizer_unittest.cc',
             'invalidation/impl/invalidation_logger_unittest.cc',
             'invalidation/impl/invalidation_service_android_unittest.cc',
           ],
@@ -1303,6 +1304,7 @@
           'dependencies': [
             'components.gyp:cronet_static',
             'components.gyp:data_reduction_proxy_content',
+            'components.gyp:data_usage_android',
             'components.gyp:safe_json_java',
             '../content/content.gyp:content_java',
             '../testing/android/native_test.gyp:native_test_native_code',
diff --git a/components/data_reduction_proxy/OWNERS b/components/data_reduction_proxy/OWNERS
index 67ef1e8..c053aba 100644
--- a/components/data_reduction_proxy/OWNERS
+++ b/components/data_reduction_proxy/OWNERS
@@ -1,7 +1,9 @@
 bengr@chromium.org
 bolian@chromium.org
-sclittle@chromium.org
+kundaji@chromium.org
 megjablon@chromium.org
+sclittle@chromium.org
+tbansal@chromium.org
 
 # Changes to IPC messages require a security review to avoid introducing
 # new sandbox escapes.
diff --git a/components/data_usage.gypi b/components/data_usage.gypi
index ba77b57..6fcef19 100644
--- a/components/data_usage.gypi
+++ b/components/data_usage.gypi
@@ -16,8 +16,29 @@
         'data_usage/core/data_use.h',
         'data_usage/core/data_use_aggregator.cc',
         'data_usage/core/data_use_aggregator.h',
+        'data_usage/core/data_use_amortizer.h',
         'data_usage/core/data_use_annotator.h',
       ]
     },
-  ]
+  ],
+  'conditions': [
+    ['OS=="android"', {
+      'targets': [
+        {
+          'target_name': 'data_usage_android',
+          'type': 'static_library',
+          'dependencies': [
+            ':data_usage_core',
+            '../base/base.gyp:base',
+            '../net/net.gyp:net',
+            '../url/url.gyp:url_lib',
+          ],
+          'sources': [
+            'data_usage/android/traffic_stats_amortizer.cc',
+            'data_usage/android/traffic_stats_amortizer.h',
+          ]
+        },
+      ]
+    }],  # OS=="android"
+  ],
 }
diff --git a/components/data_usage/android/BUILD.gn b/components/data_usage/android/BUILD.gn
new file mode 100644
index 0000000..f3d70da
--- /dev/null
+++ b/components/data_usage/android/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+source_set("android") {
+  sources = [
+    "traffic_stats_amortizer.cc",
+    "traffic_stats_amortizer.h",
+  ]
+  deps = [
+    "//base",
+    "//components/data_usage/core",
+    "//net",
+    "//url",
+  ]
+}
+
+source_set("unit_tests") {
+  testonly = true
+  sources = [
+    "traffic_stats_amortizer_unittest.cc",
+  ]
+
+  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
+
+  deps = [
+    ":android",
+    "//base",
+    "//base/test:test_support",
+    "//components/data_usage/core",
+    "//net:test_support",
+    "//testing/gtest",
+  ]
+}
diff --git a/components/data_usage/android/DEPS b/components/data_usage/android/DEPS
new file mode 100644
index 0000000..75ebc8b4
--- /dev/null
+++ b/components/data_usage/android/DEPS
@@ -0,0 +1,5 @@
+include_rules = [
+  "+components/data_usage/core",
+  "+net",
+  "+url",
+]
diff --git a/components/data_usage/android/traffic_stats_amortizer.cc b/components/data_usage/android/traffic_stats_amortizer.cc
new file mode 100644
index 0000000..e9ed1fd3f
--- /dev/null
+++ b/components/data_usage/android/traffic_stats_amortizer.cc
@@ -0,0 +1,292 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_usage/android/traffic_stats_amortizer.h"
+
+#include <algorithm>  // For std::min.
+#include <cmath>      // For std::modf.
+
+#include "base/location.h"
+#include "base/time/default_tick_clock.h"
+#include "base/timer/timer.h"
+#include "components/data_usage/core/data_use.h"
+#include "net/android/traffic_stats.h"
+
+namespace data_usage {
+namespace android {
+
+namespace {
+
+// Convenience typedef.
+typedef std::vector<std::pair<linked_ptr<DataUse>,
+                              DataUseAmortizer::AmortizationCompleteCallback>>
+    DataUseBuffer;
+
+// The delay between receiving DataUse and querying TrafficStats byte counts for
+// amortization.
+// TODO(sclittle): Control this with a field trial parameter.
+const int64_t kDefaultTrafficStatsQueryDelayMs = 50;
+
+// The longest amount of time that an amortization run can be delayed for.
+// TODO(sclittle): Control this with a field trial parameter.
+const int64_t kDefaultMaxAmortizationDelayMs = 500;
+
+// The maximum allowed size of the DataUse buffer. If the buffer ever exceeds
+// this size, then DataUse will be amortized immediately and the buffer will be
+// flushed.
+// TODO(sclittle): Control this with a field trial parameter.
+const size_t kDefaultMaxDataUseBufferSize = 128;
+
+// Scales |bytes| by |ratio|, using |remainder| to hold the running rounding
+// error. |bytes| must be non-negative, and multiplying |bytes| by |ratio| must
+// yield a number that's representable within the bounds of a non-negative
+// int64_t.
+int64_t ScaleByteCount(int64_t bytes, double ratio, double* remainder) {
+  DCHECK_GE(bytes, 0);
+  DCHECK_GE(ratio, 0.0);
+  DCHECK_LE(ratio, static_cast<double>(INT64_MAX));
+  DCHECK_GE(*remainder, 0.0);
+  DCHECK_LT(*remainder, 1.0);
+
+  double intpart;
+  *remainder =
+      std::modf(static_cast<double>(bytes) * ratio + (*remainder), &intpart);
+
+  DCHECK_GE(intpart, 0.0);
+  DCHECK_LE(intpart, static_cast<double>(INT64_MAX));
+  DCHECK_GE(*remainder, 0.0);
+  DCHECK_LT(*remainder, 1.0);
+
+  // Due to floating point error, casting the double |intpart| to an int64_t
+  // could cause it to overflow, even though it's already been checked to be
+  // less than the double representation of INT64_MAX. If this happens, cap the
+  // scaled value at INT64_MAX.
+  uint64_t scaled_bytes = std::min(static_cast<uint64_t>(intpart),
+                                   static_cast<uint64_t>(INT64_MAX));
+  return static_cast<int64_t>(scaled_bytes);
+}
+
+// Amortizes the difference between |desired_post_amortization_total| and
+// |pre_amortization_total| into each of the DataUse objects in
+// |data_use_sequence| by scaling the byte counts determined by the
+// |get_byte_count_fn| function (e.g. tx_bytes, rx_bytes) for each DataUse
+// appropriately.
+void AmortizeByteCountSequence(DataUseBuffer* data_use_sequence,
+                               int64_t* (*get_byte_count_fn)(DataUse*),
+                               int64_t pre_amortization_total,
+                               int64_t desired_post_amortization_total) {
+  DCHECK_GE(pre_amortization_total, 0);
+  DCHECK_GE(desired_post_amortization_total, 0);
+
+  if (pre_amortization_total == 0) {
+    // TODO(sclittle): If |desired_post_amortization_total| is non-zero, this
+    // could be ignoring overhead that should be amortized in somehow. Handle
+    // this case gracefully.
+    return;
+  }
+
+  const double ratio = static_cast<double>(desired_post_amortization_total) /
+                       static_cast<double>(pre_amortization_total);
+
+  double remainder = 0.0;
+  for (auto& data_use_buffer_pair : *data_use_sequence) {
+    int64_t* byte_count = get_byte_count_fn(data_use_buffer_pair.first.get());
+    *byte_count = ScaleByteCount(*byte_count, ratio, &remainder);
+    // TODO(sclittle): Record UMA about values before vs. after amortization.
+  }
+}
+
+int64_t* GetTxBytes(DataUse* data_use) {
+  return &data_use->tx_bytes;
+}
+int64_t* GetRxBytes(DataUse* data_use) {
+  return &data_use->rx_bytes;
+}
+
+// Amortizes the difference between |desired_post_amortization_total_tx_bytes|
+// and |pre_amortization_total_tx_bytes| into each of the DataUse objects in
+// |data_use_sequence| by scaling the DataUse's |tx_bytes| appropriately. Does
+// the same with the |rx_bytes| using those respective parameters.
+void AmortizeDataUseSequence(DataUseBuffer* data_use_sequence,
+                             int64_t pre_amortization_total_tx_bytes,
+                             int64_t desired_post_amortization_total_tx_bytes,
+                             int64_t pre_amortization_total_rx_bytes,
+                             int64_t desired_post_amortization_total_rx_bytes) {
+  DCHECK(data_use_sequence);
+  DCHECK(!data_use_sequence->empty());
+
+  AmortizeByteCountSequence(data_use_sequence, &GetTxBytes,
+                            pre_amortization_total_tx_bytes,
+                            desired_post_amortization_total_tx_bytes);
+
+  AmortizeByteCountSequence(data_use_sequence, &GetRxBytes,
+                            pre_amortization_total_rx_bytes,
+                            desired_post_amortization_total_rx_bytes);
+}
+
+}  // namespace
+
+TrafficStatsAmortizer::TrafficStatsAmortizer()
+    : TrafficStatsAmortizer(
+          scoped_ptr<base::TickClock>(new base::DefaultTickClock()),
+          scoped_ptr<base::Timer>(new base::Timer(false, false)),
+          base::TimeDelta::FromMilliseconds(kDefaultTrafficStatsQueryDelayMs),
+          base::TimeDelta::FromMilliseconds(kDefaultMaxAmortizationDelayMs),
+          kDefaultMaxDataUseBufferSize) {}
+
+TrafficStatsAmortizer::~TrafficStatsAmortizer() {}
+
+void TrafficStatsAmortizer::AmortizeDataUse(
+    scoped_ptr<DataUse> data_use,
+    const AmortizationCompleteCallback& callback) {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  DCHECK(!callback.is_null());
+  int64_t tx_bytes = data_use->tx_bytes, rx_bytes = data_use->rx_bytes;
+
+  // TODO(sclittle): Combine consecutive buffered DataUse objects that are
+  // identical except for byte counts and have the same callback.
+  buffered_data_use_.push_back(
+      std::make_pair(linked_ptr<DataUse>(data_use.release()), callback));
+
+  AddPreAmortizationBytes(tx_bytes, rx_bytes);
+}
+
+void TrafficStatsAmortizer::OnExtraBytes(int64_t extra_tx_bytes,
+                                         int64_t extra_rx_bytes) {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  AddPreAmortizationBytes(extra_tx_bytes, extra_rx_bytes);
+}
+
+base::WeakPtr<TrafficStatsAmortizer> TrafficStatsAmortizer::GetWeakPtr() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  return weak_ptr_factory_.GetWeakPtr();
+}
+
+TrafficStatsAmortizer::TrafficStatsAmortizer(
+    scoped_ptr<base::TickClock> tick_clock,
+    scoped_ptr<base::Timer> traffic_stats_query_timer,
+    const base::TimeDelta& traffic_stats_query_delay,
+    const base::TimeDelta& max_amortization_delay,
+    size_t max_data_use_buffer_size)
+    : tick_clock_(tick_clock.Pass()),
+      traffic_stats_query_timer_(traffic_stats_query_timer.Pass()),
+      traffic_stats_query_delay_(traffic_stats_query_delay),
+      max_amortization_delay_(max_amortization_delay),
+      max_data_use_buffer_size_(max_data_use_buffer_size),
+      is_amortization_in_progress_(false),
+      are_last_amortization_traffic_stats_available_(false),
+      last_amortization_traffic_stats_tx_bytes_(-1),
+      last_amortization_traffic_stats_rx_bytes_(-1),
+      pre_amortization_tx_bytes_(0),
+      pre_amortization_rx_bytes_(0),
+      weak_ptr_factory_(this) {}
+
+bool TrafficStatsAmortizer::QueryTrafficStats(int64_t* tx_bytes,
+                                              int64_t* rx_bytes) const {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  return net::android::traffic_stats::GetCurrentUidTxBytes(tx_bytes) &&
+         net::android::traffic_stats::GetCurrentUidRxBytes(rx_bytes);
+}
+
+void TrafficStatsAmortizer::AddPreAmortizationBytes(int64_t tx_bytes,
+                                                    int64_t rx_bytes) {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  DCHECK_GE(tx_bytes, 0);
+  DCHECK_GE(rx_bytes, 0);
+  base::TimeTicks now_ticks = tick_clock_->NowTicks();
+
+  if (!is_amortization_in_progress_) {
+    is_amortization_in_progress_ = true;
+    current_amortization_run_start_time_ = now_ticks;
+  }
+
+  pre_amortization_tx_bytes_ += tx_bytes;
+  pre_amortization_rx_bytes_ += rx_bytes;
+
+  if (buffered_data_use_.size() > max_data_use_buffer_size_) {
+    // Enforce a maximum limit on the size of |buffered_data_use_| to avoid
+    // hogging memory. Note that this will likely cause the post-amortization
+    // byte counts calculated here to be less accurate than if the amortizer
+    // waited to perform amortization.
+    // TODO(sclittle): Record UMA about how often this occurs.
+    traffic_stats_query_timer_->Stop();
+    AmortizeNow();
+    return;
+  }
+
+  // Cap any amortization delay to |max_amortization_delay_|. Note that if
+  // |max_amortization_delay_| comes earlier, then this will likely cause the
+  // post-amortization byte counts calculated here to be less accurate than if
+  // the amortizer waited to perform amortization.
+  // TODO(sclittle): Record UMA about how often |max_amortization_delay_| comes
+  // earlier.
+  base::TimeDelta query_delay = std::min(
+      traffic_stats_query_delay_, current_amortization_run_start_time_ +
+                                      max_amortization_delay_ - now_ticks);
+
+  // Set the timer to query TrafficStats and amortize after a delay, so that
+  // it's more likely that TrafficStats will be queried when the network is
+  // idle. If the timer was already set, then this overrides the previous delay.
+  traffic_stats_query_timer_->Start(
+      FROM_HERE, query_delay,
+      base::Bind(&TrafficStatsAmortizer::AmortizeNow, GetWeakPtr()));
+}
+
+void TrafficStatsAmortizer::AmortizeNow() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+
+  int64_t current_traffic_stats_tx_bytes = -1;
+  int64_t current_traffic_stats_rx_bytes = -1;
+  bool are_current_traffic_stats_available = QueryTrafficStats(
+      &current_traffic_stats_tx_bytes, &current_traffic_stats_rx_bytes);
+
+  if (are_current_traffic_stats_available &&
+      are_last_amortization_traffic_stats_available_ &&
+      !buffered_data_use_.empty()) {
+    // These TrafficStats byte counts are guaranteed to increase monotonically
+    // since device boot.
+    DCHECK_GE(current_traffic_stats_tx_bytes,
+              last_amortization_traffic_stats_tx_bytes_);
+    DCHECK_GE(current_traffic_stats_rx_bytes,
+              last_amortization_traffic_stats_rx_bytes_);
+
+    int64_t desired_post_amortization_total_tx_bytes =
+        current_traffic_stats_tx_bytes -
+        last_amortization_traffic_stats_tx_bytes_;
+    int64_t desired_post_amortization_total_rx_bytes =
+        current_traffic_stats_rx_bytes -
+        last_amortization_traffic_stats_rx_bytes_;
+
+    AmortizeDataUseSequence(&buffered_data_use_, pre_amortization_tx_bytes_,
+                            desired_post_amortization_total_tx_bytes,
+                            pre_amortization_rx_bytes_,
+                            desired_post_amortization_total_rx_bytes);
+  }
+
+  // TODO(sclittle): Record some UMA about the delay before amortizing and how
+  // big the buffer was before amortizing.
+
+  // Reset state now that the amortization run has finished.
+  is_amortization_in_progress_ = false;
+  current_amortization_run_start_time_ = base::TimeTicks();
+
+  are_last_amortization_traffic_stats_available_ =
+      are_current_traffic_stats_available;
+  last_amortization_traffic_stats_tx_bytes_ = current_traffic_stats_tx_bytes;
+  last_amortization_traffic_stats_rx_bytes_ = current_traffic_stats_rx_bytes;
+
+  pre_amortization_tx_bytes_ = 0;
+  pre_amortization_rx_bytes_ = 0;
+
+  // Pass post-amortization DataUse objects to their respective callbacks.
+  DataUseBuffer data_use_sequence;
+  data_use_sequence.swap(buffered_data_use_);
+  for (auto& data_use_buffer_pair : data_use_sequence) {
+    scoped_ptr<DataUse> data_use(data_use_buffer_pair.first.release());
+    data_use_buffer_pair.second.Run(data_use.Pass());
+  }
+}
+
+}  // namespace android
+}  // namespace data_usage
diff --git a/components/data_usage/android/traffic_stats_amortizer.h b/components/data_usage/android/traffic_stats_amortizer.h
new file mode 100644
index 0000000..c42dc46e
--- /dev/null
+++ b/components/data_usage/android/traffic_stats_amortizer.h
@@ -0,0 +1,163 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DATA_USAGE_ANDROID_TRAFFIC_STATS_AMORTIZER_H_
+#define COMPONENTS_DATA_USAGE_ANDROID_TRAFFIC_STATS_AMORTIZER_H_
+
+#include <stdint.h>
+
+#include <utility>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "base/time/time.h"
+#include "components/data_usage/core/data_use_amortizer.h"
+
+namespace base {
+class TickClock;
+class Timer;
+}
+
+namespace data_usage {
+
+struct DataUse;
+
+namespace android {
+
+// Class that uses Android TrafficStats to amortize any unincluded overhead
+// (e.g. network layer, TLS, DNS) into the data usage reported by the network
+// stack. Should only be used on the IO thread. Since TrafficStats measurements
+// are global for the entire application, a TrafficStatsAmortizer should be
+// notified of every byte possible, or else it might mistakenly classify the
+// corresponding additional TrafficStats bytes for those as overhead. The
+// TrafficStats API has been available in Android since API level 8 (Android
+// 2.2).
+class TrafficStatsAmortizer : public DataUseAmortizer {
+ public:
+  TrafficStatsAmortizer();
+  ~TrafficStatsAmortizer() override;
+
+  // Amortizes any unincluded network bytes overhead for |data_use| into
+  // |data_use|, and passes the updated |data_use| to |callback| once
+  // amortization is complete.
+  void AmortizeDataUse(scoped_ptr<DataUse> data_use,
+                       const AmortizationCompleteCallback& callback) override;
+
+  // Notifies the amortizer that some extra bytes have been transferred that
+  // aren't associated with any DataUse objects (e.g. off-the-record traffic),
+  // so that the TrafficStatsAmortizer can avoid mistakenly counting these bytes
+  // as overhead.
+  void OnExtraBytes(int64_t extra_tx_bytes, int64_t extra_rx_bytes) override;
+
+  base::WeakPtr<TrafficStatsAmortizer> GetWeakPtr();
+
+ protected:
+  // Constructor for testing purposes, allowing for tests to take full control
+  // over the timing of the TrafficStatsAmortizer and the byte counts returned
+  // from TrafficStats. |traffic_stats_query_timer| must not be a repeating
+  // timer.
+  TrafficStatsAmortizer(scoped_ptr<base::TickClock> tick_clock,
+                        scoped_ptr<base::Timer> traffic_stats_query_timer,
+                        const base::TimeDelta& traffic_stats_query_delay,
+                        const base::TimeDelta& max_amortization_delay,
+                        size_t max_data_use_buffer_size);
+
+  // Queries the total transmitted and received bytes for the application from
+  // TrafficStats. Stores the byte counts in |tx_bytes| and |rx_bytes|
+  // respectively and returns true if both values are available from
+  // TrafficStats, otherwise returns false. |tx_bytes| and |rx_bytes| must not
+  // be NULL.
+  // Virtual for testing.
+  virtual bool QueryTrafficStats(int64_t* tx_bytes, int64_t* rx_bytes) const;
+
+ private:
+  // Adds |tx_bytes| and |rx_bytes| as data usage that should not be counted as
+  // overhead (i.e. bytes from DataUse objects and extra bytes reported to this
+  // TrafficStatsAmortizer), and schedules amortization to happen later.
+  void AddPreAmortizationBytes(int64_t tx_bytes, int64_t rx_bytes);
+
+  // Amortizes any additional overhead from TrafficStats byte counts into the
+  // |buffered_data_use_|, then passes the post-amortization DataUse objects to
+  // their respective callbacks, flushing |buffered_data_use_|. Overhead is
+  // calculated as the difference between the TrafficStats byte counts and the
+  // pre-amortization byte counts.
+  void AmortizeNow();
+
+  base::ThreadChecker thread_checker_;
+
+  // TickClock for determining the current time tick.
+  scoped_ptr<base::TickClock> tick_clock_;
+
+  // One-shot timer used to wait a short time after receiving DataUse before
+  // querying TrafficStats, to give TrafficStats time to update and give the
+  // network stack time to finish reporting multiple DataUse objects that happen
+  // in rapid succession. This must not be a repeating timer.
+  // |traffic_stats_query_timer_| is owned as a scoped_ptr so that fake timers
+  // can be passed in for tests.
+  scoped_ptr<base::Timer> traffic_stats_query_timer_;
+
+  // The delay between data usage being reported to the amortizer before
+  // querying TrafficStats. Used with |traffic_stats_query_timer_|.
+  const base::TimeDelta traffic_stats_query_delay_;
+
+  // The maximum amount of time that the TrafficStatsAmortizer is allowed to
+  // spend waiting to perform amortization. Used with
+  // |traffic_stats_query_timer_|.
+  const base::TimeDelta max_amortization_delay_;
+
+  // The maximum allowed size of the |buffered_data_use_| buffer, to prevent the
+  // buffer from hogging memory.
+  const size_t max_data_use_buffer_size_;
+
+  // Indicates whether or not the TrafficStatsAmortizer currently has
+  // pre-amortization bytes waiting for amortization to be performed.
+  bool is_amortization_in_progress_;
+
+  // The time when the first pre-amortization bytes for the current amortization
+  // run were given to this TrafficStatsAmortizer.
+  base::TimeTicks current_amortization_run_start_time_;
+
+  // Buffer of pre-amortization data use that has accumulated since the last
+  // time amortization was performed, paired with the callbacks for each DataUse
+  // object. Only the |buffered_data_use_| may hold linked_ptrs to the DataUse
+  // objects, so that these linked_ptrs can be released later.
+  std::vector<std::pair<linked_ptr<DataUse>, AmortizationCompleteCallback>>
+      buffered_data_use_;
+
+  // Indicates if TrafficStats byte counts were available during the last time
+  // amortization was performed.
+  bool are_last_amortization_traffic_stats_available_;
+
+  // The total transmitted bytes according to TrafficStats during the last time
+  // amortization was performed, if they were available.
+  int64_t last_amortization_traffic_stats_tx_bytes_;
+
+  // The total received bytes according to TrafficStats during the last time
+  // amortization was performed, if they were available.
+  int64_t last_amortization_traffic_stats_rx_bytes_;
+
+  // Total pre-amortization transmitted bytes since the last time amortization
+  // was performed, including bytes from |buffered_data_use_| and any extra
+  // bytes that were added.
+  int64_t pre_amortization_tx_bytes_;
+
+  // Total pre-amortization received bytes since the last time amortization was
+  // performed, including bytes from |buffered_data_use_| and any extra bytes
+  // that were added.
+  int64_t pre_amortization_rx_bytes_;
+
+  base::WeakPtrFactory<TrafficStatsAmortizer> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(TrafficStatsAmortizer);
+};
+
+}  // namespace android
+
+}  // namespace data_usage
+
+#endif  // COMPONENTS_DATA_USAGE_ANDROID_TRAFFIC_STATS_AMORTIZER_H_
diff --git a/components/data_usage/android/traffic_stats_amortizer_unittest.cc b/components/data_usage/android/traffic_stats_amortizer_unittest.cc
new file mode 100644
index 0000000..b6b7f56
--- /dev/null
+++ b/components/data_usage/android/traffic_stats_amortizer_unittest.cc
@@ -0,0 +1,416 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_usage/android/traffic_stats_amortizer.h"
+
+#include <stdint.h>
+
+#include <string>
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "base/test/simple_test_tick_clock.h"
+#include "base/time/tick_clock.h"
+#include "base/time/time.h"
+#include "base/timer/mock_timer.h"
+#include "base/timer/timer.h"
+#include "components/data_usage/core/data_use.h"
+#include "components/data_usage/core/data_use_amortizer.h"
+#include "net/base/network_change_notifier.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace data_usage {
+namespace android {
+
+namespace {
+
+// The delay between receiving DataUse and querying TrafficStats byte counts for
+// amortization.
+const base::TimeDelta kTrafficStatsQueryDelay =
+    base::TimeDelta::FromMilliseconds(50);
+
+// The longest amount of time that an amortization run can be delayed for.
+const base::TimeDelta kMaxAmortizationDelay =
+    base::TimeDelta::FromMilliseconds(200);
+
+// The maximum allowed size of the DataUse buffer.
+const size_t kMaxDataUseBufferSize = 8;
+
+// Synthesizes a fake scoped_ptr<DataUse> with the given |tx_bytes| and
+// |rx_bytes|, using arbitrary values for all other fields.
+scoped_ptr<DataUse> CreateDataUse(int64_t tx_bytes, int64_t rx_bytes) {
+  return scoped_ptr<DataUse>(new DataUse(
+      GURL("http://example.com"), base::TimeTicks() /* request_start */,
+      GURL("http://examplefirstparty.com"), 10 /* tab_id */,
+      net::NetworkChangeNotifier::CONNECTION_2G, "example_mcc_mnc", tx_bytes,
+      rx_bytes));
+}
+
+// Class that represents a base::MockTimer with an attached base::TickClock, so
+// that it can update its |desired_run_time()| according to the current time
+// when the timer is reset.
+class MockTimerWithTickClock : public base::MockTimer {
+ public:
+  MockTimerWithTickClock(bool retain_user_task,
+                         bool is_repeating,
+                         base::TickClock* tick_clock)
+      : base::MockTimer(retain_user_task, is_repeating),
+        tick_clock_(tick_clock) {}
+
+  ~MockTimerWithTickClock() override {}
+
+  void Reset() override {
+    base::MockTimer::Reset();
+    set_desired_run_time(tick_clock_->NowTicks() + GetCurrentDelay());
+  }
+
+ private:
+  base::TickClock* tick_clock_;
+
+  DISALLOW_COPY_AND_ASSIGN(MockTimerWithTickClock);
+};
+
+// A TrafficStatsAmortizer for testing that allows for tests to simulate the
+// byte counts returned from TrafficStats.
+class TestTrafficStatsAmortizer : public TrafficStatsAmortizer {
+ public:
+  TestTrafficStatsAmortizer(scoped_ptr<base::TickClock> tick_clock,
+                            scoped_ptr<base::Timer> traffic_stats_query_timer)
+      : TrafficStatsAmortizer(tick_clock.Pass(),
+                              traffic_stats_query_timer.Pass(),
+                              kTrafficStatsQueryDelay,
+                              kMaxAmortizationDelay,
+                              kMaxDataUseBufferSize),
+        next_traffic_stats_available_(false),
+        next_traffic_stats_tx_bytes_(-1),
+        next_traffic_stats_rx_bytes_(-1) {}
+
+  ~TestTrafficStatsAmortizer() override {}
+
+  void SetNextTrafficStats(bool available, int64_t tx_bytes, int64_t rx_bytes) {
+    next_traffic_stats_available_ = available;
+    next_traffic_stats_tx_bytes_ = tx_bytes;
+    next_traffic_stats_rx_bytes_ = rx_bytes;
+  }
+
+  void AddTrafficStats(int64_t tx_bytes, int64_t rx_bytes) {
+    next_traffic_stats_tx_bytes_ += tx_bytes;
+    next_traffic_stats_rx_bytes_ += rx_bytes;
+  }
+
+ protected:
+  bool QueryTrafficStats(int64_t* tx_bytes, int64_t* rx_bytes) const override {
+    *tx_bytes = next_traffic_stats_tx_bytes_;
+    *rx_bytes = next_traffic_stats_rx_bytes_;
+    return next_traffic_stats_available_;
+  }
+
+ private:
+  bool next_traffic_stats_available_;
+  int64_t next_traffic_stats_tx_bytes_;
+  int64_t next_traffic_stats_rx_bytes_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestTrafficStatsAmortizer);
+};
+
+class TrafficStatsAmortizerTest : public testing::Test {
+ public:
+  TrafficStatsAmortizerTest()
+      : test_tick_clock_(new base::SimpleTestTickClock()),
+        mock_timer_(new MockTimerWithTickClock(false, false, test_tick_clock_)),
+        amortizer_(scoped_ptr<base::TickClock>(test_tick_clock_),
+                   scoped_ptr<base::Timer>(mock_timer_)),
+        data_use_callback_call_count_(0) {}
+
+  ~TrafficStatsAmortizerTest() override {
+    EXPECT_FALSE(mock_timer_->IsRunning());
+  }
+
+  // Simulates the passage of time by |delta|, firing timers when appropriate.
+  void AdvanceTime(const base::TimeDelta& delta) {
+    const base::TimeTicks end_time = test_tick_clock_->NowTicks() + delta;
+    base::RunLoop().RunUntilIdle();
+
+    while (test_tick_clock_->NowTicks() < end_time) {
+      PumpMockTimer();
+
+      // If |mock_timer_| is scheduled to fire in the future before |end_time|,
+      // advance to that time.
+      if (mock_timer_->IsRunning() &&
+          mock_timer_->desired_run_time() < end_time) {
+        test_tick_clock_->Advance(mock_timer_->desired_run_time() -
+                                  test_tick_clock_->NowTicks());
+      } else {
+        // Otherwise, advance to |end_time|.
+        test_tick_clock_->Advance(end_time - test_tick_clock_->NowTicks());
+      }
+    }
+    PumpMockTimer();
+  }
+
+  // Skip the first amortization run where TrafficStats byte count deltas are
+  // unavailable, for convenience.
+  void SkipFirstAmortizationRun() {
+    // The initial values of TrafficStats shouldn't matter.
+    amortizer()->SetNextTrafficStats(true, 0, 0);
+
+    // Do the first amortization run with TrafficStats unavailable.
+    amortizer()->OnExtraBytes(100, 1000);
+    AdvanceTime(kTrafficStatsQueryDelay);
+    EXPECT_EQ(0, data_use_callback_call_count());
+  }
+
+  // Expects that |expected| and |actual| are equivalent.
+  void ExpectDataUse(scoped_ptr<DataUse> expected, scoped_ptr<DataUse> actual) {
+    ++data_use_callback_call_count_;
+
+    // Have separate checks for the |tx_bytes| and |rx_bytes|, since those are
+    // calculated with floating point arithmetic.
+    EXPECT_DOUBLE_EQ(static_cast<double>(expected->tx_bytes),
+                     static_cast<double>(actual->tx_bytes));
+    EXPECT_DOUBLE_EQ(static_cast<double>(expected->rx_bytes),
+                     static_cast<double>(actual->rx_bytes));
+
+    // Copy the byte counts over from |expected| just in case they're only
+    // slightly different due to floating point error, so that this doesn't
+    // cause the equality comparison below to fail.
+    actual->tx_bytes = expected->tx_bytes;
+    actual->rx_bytes = expected->rx_bytes;
+    EXPECT_EQ(*expected, *actual);
+  }
+
+  // Creates an ExpectDataUse callback, as a convenience.
+  DataUseAmortizer::AmortizationCompleteCallback ExpectDataUseCallback(
+      scoped_ptr<DataUse> expected) {
+    return base::Bind(&TrafficStatsAmortizerTest::ExpectDataUse,
+                      base::Unretained(this), base::Passed(&expected));
+  }
+
+  base::TimeTicks NowTicks() const { return test_tick_clock_->NowTicks(); }
+
+  TestTrafficStatsAmortizer* amortizer() { return &amortizer_; }
+
+  int data_use_callback_call_count() const {
+    return data_use_callback_call_count_;
+  }
+
+ private:
+  // Pumps |mock_timer_|, firing it while it's scheduled to run now or in the
+  // past. After calling this, |mock_timer_| is either not running or is
+  // scheduled to run in the future.
+  void PumpMockTimer() {
+    // Fire the |mock_timer_| if the time has come up. Use a while loop in case
+    // the fired task started the timer again to fire immediately.
+    while (mock_timer_->IsRunning() &&
+           mock_timer_->desired_run_time() <= test_tick_clock_->NowTicks()) {
+      mock_timer_->Fire();
+      base::RunLoop().RunUntilIdle();
+    }
+  }
+
+  base::MessageLoop message_loop_;
+
+  // Weak, owned by |amortizer_|.
+  base::SimpleTestTickClock* test_tick_clock_;
+
+  // Weak, owned by |amortizer_|.
+  MockTimerWithTickClock* mock_timer_;
+
+  TestTrafficStatsAmortizer amortizer_;
+
+  // The number of times ExpectDataUse has been called.
+  int data_use_callback_call_count_;
+
+  DISALLOW_COPY_AND_ASSIGN(TrafficStatsAmortizerTest);
+};
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithTrafficStatsAlwaysUnavailable) {
+  amortizer()->SetNextTrafficStats(false, -1, -1);
+  // Do it three times for good measure.
+  for (int i = 0; i < 3; ++i) {
+    // Extra bytes should be ignored since TrafficStats are unavailable.
+    amortizer()->OnExtraBytes(1337, 9001);
+    // The original DataUse should be unchanged.
+    amortizer()->AmortizeDataUse(
+        CreateDataUse(100, 1000),
+        ExpectDataUseCallback(CreateDataUse(100, 1000)));
+
+    AdvanceTime(kTrafficStatsQueryDelay);
+    EXPECT_EQ(i + 1, data_use_callback_call_count());
+  }
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeDataUse) {
+  // The initial values of TrafficStats shouldn't matter.
+  amortizer()->SetNextTrafficStats(true, 1337, 9001);
+
+  // The first amortization run should not change any byte counts because
+  // there's no TrafficStats delta to work with.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(50, 500)));
+  amortizer()->AmortizeDataUse(CreateDataUse(100, 1000),
+                               ExpectDataUseCallback(CreateDataUse(100, 1000)));
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(2, data_use_callback_call_count());
+
+  // This amortization run, tx_bytes and rx_bytes should be doubled.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(100, 1000)));
+  AdvanceTime(kTrafficStatsQueryDelay / 2);
+
+  // Another DataUse is reported before the amortizer queries TrafficStats.
+  amortizer()->AmortizeDataUse(CreateDataUse(100, 1000),
+                               ExpectDataUseCallback(CreateDataUse(200, 2000)));
+  AdvanceTime(kTrafficStatsQueryDelay / 2);
+
+  // Then, the TrafficStats values update with the new bytes. The second run
+  // callbacks should not have been called yet.
+  amortizer()->AddTrafficStats(300, 3000);
+  EXPECT_EQ(2, data_use_callback_call_count());
+
+  // The callbacks should fire once kTrafficStatsQueryDelay has passed since the
+  // DataUse was passed to the amortizer.
+  AdvanceTime(kTrafficStatsQueryDelay / 2);
+  EXPECT_EQ(4, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithExtraBytes) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should double.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(100, 1000)));
+  amortizer()->OnExtraBytes(500, 5000);
+  amortizer()->AddTrafficStats(1100, 11000);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithNegativeOverhead) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should halve.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(25, 250)));
+  amortizer()->AddTrafficStats(25, 250);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithMaxIntByteCounts) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should be unchanged.
+  amortizer()->AmortizeDataUse(
+      CreateDataUse(INT64_MAX, INT64_MAX),
+      ExpectDataUseCallback(CreateDataUse(INT64_MAX, INT64_MAX)));
+  amortizer()->SetNextTrafficStats(true, INT64_MAX, INT64_MAX);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithMaxIntScaleFactor) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should be scaled up to INT64_MAX.
+  amortizer()->AmortizeDataUse(
+      CreateDataUse(1, 1),
+      ExpectDataUseCallback(CreateDataUse(INT64_MAX, INT64_MAX)));
+  amortizer()->SetNextTrafficStats(true, INT64_MAX, INT64_MAX);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithZeroScaleFactor) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should be scaled down to 0.
+  amortizer()->AmortizeDataUse(CreateDataUse(INT64_MAX, INT64_MAX),
+                               ExpectDataUseCallback(CreateDataUse(0, 0)));
+  amortizer()->SetNextTrafficStats(true, 0, 0);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithZeroPreAmortizationBytes) {
+  SkipFirstAmortizationRun();
+
+  // Both byte counts should stay 0, even though TrafficStats saw bytes.
+  amortizer()->AmortizeDataUse(CreateDataUse(0, 0),
+                               ExpectDataUseCallback(CreateDataUse(0, 0)));
+  amortizer()->AddTrafficStats(100, 1000);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+
+  // This time, only TX bytes are 0, so RX bytes should double, but TX bytes
+  // should stay 0.
+  amortizer()->AmortizeDataUse(CreateDataUse(0, 500),
+                               ExpectDataUseCallback(CreateDataUse(0, 1000)));
+  amortizer()->AddTrafficStats(100, 1000);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(2, data_use_callback_call_count());
+
+  // This time, only RX bytes are 0, so TX bytes should double, but RX bytes
+  // should stay 0.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 0),
+                               ExpectDataUseCallback(CreateDataUse(100, 0)));
+  amortizer()->AddTrafficStats(100, 1000);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(3, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeAtMaxDelay) {
+  SkipFirstAmortizationRun();
+
+  // Byte counts should double.
+  amortizer()->AddTrafficStats(1000, 10000);
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(100, 1000)));
+
+  // kSmallDelay is a delay that's shorter than the delay before TrafficStats
+  // would be queried, where kMaxAmortizationDelay is a multiple of kSmallDelay.
+  const base::TimeDelta kSmallDelay = kMaxAmortizationDelay / 10;
+  EXPECT_LT(kSmallDelay, kMaxAmortizationDelay);
+
+  // Simulate multiple cases of extra bytes being reported, each before
+  // TrafficStats would be queried, until kMaxAmortizationDelay has elapsed.
+  AdvanceTime(kSmallDelay);
+  for (int64_t i = 0; i < kMaxAmortizationDelay / kSmallDelay - 1; ++i) {
+    EXPECT_EQ(0, data_use_callback_call_count());
+    amortizer()->OnExtraBytes(50, 500);
+    AdvanceTime(kSmallDelay);
+  }
+
+  // The final time, the amortizer should have given up on waiting to query
+  // TrafficStats and just have amortized as soon as it hit the deadline of
+  // kMaxAmortizationDelay.
+  EXPECT_EQ(1, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeAtMaxBufferSize) {
+  SkipFirstAmortizationRun();
+
+  // Report (max buffer size + 1) consecutive DataUse objects, which will be
+  // amortized immediately once the buffer exceeds maximum size.
+  amortizer()->AddTrafficStats(100 * (kMaxDataUseBufferSize + 1),
+                               1000 * (kMaxDataUseBufferSize + 1));
+  for (size_t i = 0; i < kMaxDataUseBufferSize + 1; ++i) {
+    EXPECT_EQ(0, data_use_callback_call_count());
+    amortizer()->AmortizeDataUse(
+        CreateDataUse(50, 500),
+        ExpectDataUseCallback(CreateDataUse(100, 1000)));
+  }
+
+  EXPECT_EQ(static_cast<int>(kMaxDataUseBufferSize + 1),
+            data_use_callback_call_count());
+}
+
+}  // namespace
+
+}  // namespace android
+}  // namespace data_usage
diff --git a/components/data_usage/core/BUILD.gn b/components/data_usage/core/BUILD.gn
index 06e19b9..4d4a1aac 100644
--- a/components/data_usage/core/BUILD.gn
+++ b/components/data_usage/core/BUILD.gn
@@ -8,6 +8,7 @@
     "data_use.h",
     "data_use_aggregator.cc",
     "data_use_aggregator.h",
+    "data_use_amortizer.h",
     "data_use_annotator.h",
   ]
   deps = [
diff --git a/components/data_usage/core/data_use_aggregator.cc b/components/data_usage/core/data_use_aggregator.cc
index 091a9008..47c7649 100644
--- a/components/data_usage/core/data_use_aggregator.cc
+++ b/components/data_usage/core/data_use_aggregator.cc
@@ -6,11 +6,9 @@
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/single_thread_task_runner.h"
 #include "base/stl_util.h"
 #include "components/data_usage/core/data_use.h"
+#include "components/data_usage/core/data_use_amortizer.h"
 #include "components/data_usage/core/data_use_annotator.h"
 #include "net/base/load_timing_info.h"
 #include "net/base/network_change_notifier.h"
@@ -22,12 +20,11 @@
 
 namespace data_usage {
 
-DataUseAggregator::DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator)
+DataUseAggregator::DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator,
+                                     scoped_ptr<DataUseAmortizer> amortizer)
     : annotator_(annotator.Pass()),
+      amortizer_(amortizer.Pass()),
       connection_type_(net::NetworkChangeNotifier::GetConnectionType()),
-      off_the_record_tx_bytes_since_last_flush_(0),
-      off_the_record_rx_bytes_since_last_flush_(0),
-      is_flush_pending_(false),
       weak_ptr_factory_(this) {
 #if defined(OS_ANDROID)
   mcc_mnc_ = net::android::GetTelephonySimOperator();
@@ -63,20 +60,24 @@
                   connection_type_, mcc_mnc_, tx_bytes, rx_bytes));
 
   if (!annotator_) {
-    AppendDataUse(data_use.Pass());
+    PassDataUseToAmortizer(data_use.Pass());
     return;
   }
 
+  // TODO(sclittle): Instead of binding a new callback every time, re-use the
+  // same callback every time.
   annotator_->Annotate(
       request, data_use.Pass(),
-      base::Bind(&DataUseAggregator::AppendDataUse, GetWeakPtr()));
+      base::Bind(&DataUseAggregator::PassDataUseToAmortizer, GetWeakPtr()));
 }
 
 void DataUseAggregator::ReportOffTheRecordDataUse(int64_t tx_bytes,
                                                   int64_t rx_bytes) {
   DCHECK(thread_checker_.CalledOnValidThread());
-  off_the_record_tx_bytes_since_last_flush_ += tx_bytes;
-  off_the_record_rx_bytes_since_last_flush_ += rx_bytes;
+  if (!amortizer_)
+    return;
+
+  amortizer_->OnExtraBytes(tx_bytes, rx_bytes);
 }
 
 base::WeakPtr<DataUseAggregator> DataUseAggregator::GetWeakPtr() {
@@ -99,50 +100,33 @@
   mcc_mnc_ = mcc_mnc;
 }
 
-void DataUseAggregator::AppendDataUse(scoped_ptr<DataUse> data_use) {
+void DataUseAggregator::PassDataUseToAmortizer(scoped_ptr<DataUse> data_use) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(data_use);
 
-  // As an optimization, attempt to combine the newly reported data use with the
-  // most recent buffered data use, if the annotations on the data use are the
-  // same.
-  if (!buffered_data_use_.empty() &&
-      buffered_data_use_.back()->CanCombineWith(*data_use)) {
-    buffered_data_use_.back()->tx_bytes += data_use->tx_bytes;
-    buffered_data_use_.back()->rx_bytes += data_use->rx_bytes;
-  } else {
-    buffered_data_use_.push_back(data_use.Pass());
+  if (!amortizer_) {
+    OnAmortizationComplete(data_use.Pass());
+    return;
   }
 
-  if (!is_flush_pending_) {
-    // Post a flush operation to happen in the future, so that the
-    // DataUseAggregator has a chance to batch together some data use before
-    // notifying observers.
-    base::MessageLoop::current()->task_runner()->PostTask(
-        FROM_HERE,
-        base::Bind(&DataUseAggregator::FlushBufferedDataUse, GetWeakPtr()));
-    is_flush_pending_ = true;
-  }
+  // TODO(sclittle): Instead of binding a new callback every time, re-use the
+  // same callback every time.
+  amortizer_->AmortizeDataUse(
+      data_use.Pass(),
+      base::Bind(&DataUseAggregator::OnAmortizationComplete, GetWeakPtr()));
 }
 
-void DataUseAggregator::FlushBufferedDataUse() {
+void DataUseAggregator::OnAmortizationComplete(
+    scoped_ptr<DataUse> amortized_data_use) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  // TODO(sclittle): Amortize data use on supported platforms before notifying
-  // observers.
-
   // Pass Observers a sequence of const DataUse pointers instead of using the
   // buffer directly in order to prevent Observers from modifying the DataUse
   // objects.
-  std::vector<const DataUse*> const_sequence(buffered_data_use_.begin(),
-                                             buffered_data_use_.end());
+  // TODO(sclittle): Change the observer interface to take in a const DataUse&.
+  std::vector<const DataUse*> const_sequence(1, amortized_data_use.get());
   DCHECK(!ContainsValue(const_sequence, nullptr));
   FOR_EACH_OBSERVER(Observer, observer_list_, OnDataUse(const_sequence));
-
-  buffered_data_use_.clear();
-  off_the_record_tx_bytes_since_last_flush_ = 0;
-  off_the_record_rx_bytes_since_last_flush_ = 0;
-  is_flush_pending_ = false;
 }
 
 }  // namespace data_usage
diff --git a/components/data_usage/core/data_use_aggregator.h b/components/data_usage/core/data_use_aggregator.h
index 36d8ef09..50bb36e 100644
--- a/components/data_usage/core/data_use_aggregator.h
+++ b/components/data_usage/core/data_use_aggregator.h
@@ -12,7 +12,6 @@
 
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
 #include "base/threading/thread_checker.h"
@@ -24,6 +23,7 @@
 
 namespace data_usage {
 
+class DataUseAmortizer;
 class DataUseAnnotator;
 struct DataUse;
 
@@ -41,9 +41,12 @@
         const std::vector<const DataUse*>& data_use_sequence) = 0;
   };
 
-  // Constructs a new DataUseAggregator with the given |annotator|. A NULL
-  // annotator will be treated as a no-op annotator.
-  explicit DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator);
+  // Constructs a new DataUseAggregator with the given |annotator| and
+  // |amortizer|. A NULL |annotator| will be treated as a no-op annotator, and a
+  // NULL |amortizer| will be treated as a no-op amortizer.
+  DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator,
+                    scoped_ptr<DataUseAmortizer> amortizer);
+
   ~DataUseAggregator() override;
 
   void AddObserver(Observer* observer);
@@ -73,20 +76,18 @@
   void SetMccMncForTests(const std::string& mcc_mnc);
 
  private:
-  // Appends |data_use| to the buffer of unreported data use and prepares to
-  // notify observers.
-  void AppendDataUse(scoped_ptr<DataUse> data_use);
+  // Passes |data_use| to |amortizer_| if it exists, or calls
+  // OnAmortizationComplete directly if |amortizer_| doesn't exist.
+  void PassDataUseToAmortizer(scoped_ptr<DataUse> data_use);
 
-  // Flush any buffered data use and notify observers.
-  void FlushBufferedDataUse();
+  // Notifies observers with the data use from |amortized_data_use|.
+  void OnAmortizationComplete(scoped_ptr<DataUse> amortized_data_use);
 
   base::ThreadChecker thread_checker_;
   scoped_ptr<DataUseAnnotator> annotator_;
+  scoped_ptr<DataUseAmortizer> amortizer_;
   base::ObserverList<Observer> observer_list_;
 
-  // Buffer of unreported data use.
-  ScopedVector<DataUse> buffered_data_use_;
-
   // Current connection type as notified by NetworkChangeNotifier.
   net::NetworkChangeNotifier::ConnectionType connection_type_;
 
@@ -95,15 +96,6 @@
   // even if the current active network is not a cellular network.
   std::string mcc_mnc_;
 
-  // The total amount of off-the-record data usage that has happened since the
-  // last time the buffer was flushed.
-  int64_t off_the_record_tx_bytes_since_last_flush_;
-  int64_t off_the_record_rx_bytes_since_last_flush_;
-
-  // Indicates if a FlushBufferedDataUse() callback has been posted to run later
-  // on the IO thread.
-  bool is_flush_pending_;
-
   base::WeakPtrFactory<DataUseAggregator> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(DataUseAggregator);
diff --git a/components/data_usage/core/data_use_aggregator_unittest.cc b/components/data_usage/core/data_use_aggregator_unittest.cc
index f0d5f44..325065c 100644
--- a/components/data_usage/core/data_use_aggregator_unittest.cc
+++ b/components/data_usage/core/data_use_aggregator_unittest.cc
@@ -15,6 +15,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/time/time.h"
 #include "components/data_usage/core/data_use.h"
+#include "components/data_usage/core/data_use_amortizer.h"
 #include "components/data_usage/core/data_use_annotator.h"
 #include "net/base/load_timing_info.h"
 #include "net/base/network_change_notifier.h"
@@ -38,8 +39,9 @@
 // Test class that can set the network operator's MCCMNC.
 class TestDataUseAggregator : public DataUseAggregator {
  public:
-  TestDataUseAggregator(scoped_ptr<DataUseAnnotator> annotator)
-      : DataUseAggregator(annotator.Pass()) {}
+  TestDataUseAggregator(scoped_ptr<DataUseAnnotator> annotator,
+                        scoped_ptr<DataUseAmortizer> amortizer)
+      : DataUseAggregator(annotator.Pass(), amortizer.Pass()) {}
 
   ~TestDataUseAggregator() override {}
 
@@ -102,6 +104,25 @@
   DISALLOW_COPY_AND_ASSIGN(FakeDataUseAnnotator);
 };
 
+// Test DataUseAmortizer that doubles the bytes of all DataUse objects it sees.
+class DoublingAmortizer : public DataUseAmortizer {
+ public:
+  DoublingAmortizer() {}
+  ~DoublingAmortizer() override {}
+
+  void AmortizeDataUse(scoped_ptr<DataUse> data_use,
+                       const AmortizationCompleteCallback& callback) override {
+    data_use->tx_bytes *= 2;
+    data_use->rx_bytes *= 2;
+    callback.Run(data_use.Pass());
+  }
+
+  void OnExtraBytes(int64_t extra_tx_bytes, int64_t extra_rx_bytes) override {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(DoublingAmortizer);
+};
+
 // A network delegate that reports all received and sent network bytes to a
 // DataUseAggregator.
 class ReportingNetworkDelegate : public net::NetworkDelegateImpl {
@@ -124,6 +145,9 @@
 
   typedef std::map<const net::URLRequest*, DataUseContext> DataUseContextMap;
 
+  // Constructs a ReportingNetworkDelegate. |fake_data_use_annotator| can be
+  // NULL, indicating that no annotator is in use and no requests should be
+  // annotated with tab IDs.
   ReportingNetworkDelegate(
       TestDataUseAggregator* data_use_aggregator,
       FakeDataUseAnnotator* fake_data_use_annotator,
@@ -147,7 +171,8 @@
             ? DataUseContext()
             : data_use_context_it->second;
 
-    fake_data_use_annotator_->set_tab_id(data_use_context.tab_id);
+    if (fake_data_use_annotator_)
+      fake_data_use_annotator_->set_tab_id(data_use_context.tab_id);
 
     if (test_network_change_notifier_->GetCurrentConnectionType() !=
         data_use_context.connection_type) {
@@ -211,23 +236,37 @@
 
 class DataUseAggregatorTest : public testing::Test {
  public:
-  DataUseAggregatorTest()
-      : fake_data_use_annotator_(new FakeDataUseAnnotator()),
-        data_use_aggregator_(
-            scoped_ptr<DataUseAnnotator>(fake_data_use_annotator_)),
-        test_network_change_notifier_(&data_use_aggregator_),
-        reporting_network_delegate_(&data_use_aggregator_,
-                                    fake_data_use_annotator_,
-                                    &test_network_change_notifier_),
-        context_(true),
-        test_observer_(&data_use_aggregator_) {
-    context_.set_client_socket_factory(&mock_socket_factory_);
-    context_.set_network_delegate(&reporting_network_delegate_);
-    context_.Init();
-  }
-
+  DataUseAggregatorTest() {}
   ~DataUseAggregatorTest() override {}
 
+  void Initialize(scoped_ptr<FakeDataUseAnnotator> annotator,
+                  scoped_ptr<DataUseAmortizer> amortizer) {
+    // Destroy objects that have dependencies on other objects here in the
+    // reverse order that they are created.
+    context_.reset();
+    reporting_network_delegate_.reset();
+    mock_socket_factory_.reset();
+    test_network_change_notifier_.reset();
+    test_observer_.reset();
+
+    // Initialize testing objects.
+    FakeDataUseAnnotator* fake_data_use_annotator = annotator.get();
+    data_use_aggregator_.reset(
+        new TestDataUseAggregator(annotator.Pass(), amortizer.Pass()));
+    test_observer_.reset(new TestObserver(data_use_aggregator_.get()));
+    test_network_change_notifier_.reset(
+        new TestNetworkChangeNotifier(data_use_aggregator_.get()));
+    mock_socket_factory_.reset(new net::MockClientSocketFactory());
+    reporting_network_delegate_.reset(new ReportingNetworkDelegate(
+        data_use_aggregator_.get(), fake_data_use_annotator,
+        test_network_change_notifier_.get()));
+
+    context_.reset(new net::TestURLRequestContext(true));
+    context_->set_client_socket_factory(mock_socket_factory_.get());
+    context_->set_network_delegate(reporting_network_delegate_.get());
+    context_->Init();
+  }
+
   scoped_ptr<net::URLRequest> ExecuteRequest(
       const GURL& url,
       const GURL& first_party_for_cookies,
@@ -239,18 +278,18 @@
         net::MockRead(net::SYNCHRONOUS, net::OK),
     };
     net::StaticSocketDataProvider socket(reads, arraysize(reads), nullptr, 0);
-    mock_socket_factory_.AddSocketDataProvider(&socket);
+    mock_socket_factory_->AddSocketDataProvider(&socket);
 
     net::TestDelegate delegate;
     scoped_ptr<net::URLRequest> request =
-        context_.CreateRequest(url, net::IDLE, &delegate);
+        context_->CreateRequest(url, net::IDLE, &delegate);
     request->set_first_party_for_cookies(first_party_for_cookies);
 
     ReportingNetworkDelegate::DataUseContextMap data_use_context_map;
     data_use_context_map[request.get()] =
         ReportingNetworkDelegate::DataUseContext(tab_id, connection_type,
                                                  mcc_mnc);
-    reporting_network_delegate_.set_data_use_context_map(data_use_context_map);
+    reporting_network_delegate_->set_data_use_context_map(data_use_context_map);
 
     request->Start();
     loop_.RunUntilIdle();
@@ -259,179 +298,132 @@
   }
 
   ReportingNetworkDelegate* reporting_network_delegate() {
-    return &reporting_network_delegate_;
+    return reporting_network_delegate_.get();
   }
 
-  DataUseAggregator* data_use_aggregator() { return &data_use_aggregator_; }
+  DataUseAggregator* data_use_aggregator() {
+    return data_use_aggregator_.get();
+  }
 
   net::MockClientSocketFactory* mock_socket_factory() {
-    return &mock_socket_factory_;
+    return mock_socket_factory_.get();
   }
 
-  net::TestURLRequestContext* context() { return &context_; }
+  net::TestURLRequestContext* context() { return context_.get(); }
 
-  TestObserver* test_observer() { return &test_observer_; }
+  TestObserver* test_observer() { return test_observer_.get(); }
 
  private:
   base::MessageLoopForIO loop_;
-  // Weak, owned by |data_use_aggregator_|.
-  FakeDataUseAnnotator* fake_data_use_annotator_;
-  TestDataUseAggregator data_use_aggregator_;
-  TestNetworkChangeNotifier test_network_change_notifier_;
-  net::MockClientSocketFactory mock_socket_factory_;
-  ReportingNetworkDelegate reporting_network_delegate_;
-  net::TestURLRequestContext context_;
-  TestObserver test_observer_;
+  scoped_ptr<TestDataUseAggregator> data_use_aggregator_;
+  scoped_ptr<TestObserver> test_observer_;
+  scoped_ptr<TestNetworkChangeNotifier> test_network_change_notifier_;
+  scoped_ptr<net::MockClientSocketFactory> mock_socket_factory_;
+  scoped_ptr<ReportingNetworkDelegate> reporting_network_delegate_;
+  scoped_ptr<net::TestURLRequestContext> context_;
 
   DISALLOW_COPY_AND_ASSIGN(DataUseAggregatorTest);
 };
 
 TEST_F(DataUseAggregatorTest, ReportDataUse) {
-  const int32_t kFooTabId = 10;
-  const net::NetworkChangeNotifier::ConnectionType kFooConnectionType =
-      net::NetworkChangeNotifier::CONNECTION_2G;
-  const std::string kFooMccMnc = "foo_mcc_mnc";
-  scoped_ptr<net::URLRequest> foo_request =
-      ExecuteRequest(GURL("http://foo.com"), GURL("http://foofirstparty.com"),
-                     kFooTabId, kFooConnectionType, kFooMccMnc);
-
-  const int32_t kBarTabId = 20;
-  const net::NetworkChangeNotifier::ConnectionType kBarConnectionType =
-      net::NetworkChangeNotifier::CONNECTION_WIFI;
-  const std::string kBarMccMnc = "bar_mcc_mnc";
-  scoped_ptr<net::URLRequest> bar_request =
-      ExecuteRequest(GURL("http://bar.com"), GURL("http://barfirstparty.com"),
-                     kBarTabId, kBarConnectionType, kBarMccMnc);
-
-  auto data_use_it = test_observer()->observed_data_use().begin();
-
-  // First, the |foo_request| data use should have happened.
-  int64_t observed_foo_tx_bytes = 0, observed_foo_rx_bytes = 0;
-  while (data_use_it != test_observer()->observed_data_use().end() &&
-         data_use_it->url == GURL("http://foo.com")) {
-    EXPECT_EQ(GetRequestStart(*foo_request), data_use_it->request_start);
-    EXPECT_EQ(GURL("http://foofirstparty.com"),
-              data_use_it->first_party_for_cookies);
-    EXPECT_EQ(kFooTabId, data_use_it->tab_id);
-    EXPECT_EQ(kFooConnectionType, data_use_it->connection_type);
-    EXPECT_EQ(kFooMccMnc, data_use_it->mcc_mnc);
-
-    observed_foo_tx_bytes += data_use_it->tx_bytes;
-    observed_foo_rx_bytes += data_use_it->rx_bytes;
-    ++data_use_it;
-  }
-  EXPECT_EQ(foo_request->GetTotalSentBytes(), observed_foo_tx_bytes);
-  EXPECT_EQ(foo_request->GetTotalReceivedBytes(), observed_foo_rx_bytes);
-
-  // Then, the |bar_request| data use should have happened.
-  int64_t observed_bar_tx_bytes = 0, observed_bar_rx_bytes = 0;
-  while (data_use_it != test_observer()->observed_data_use().end()) {
-    EXPECT_EQ(GURL("http://bar.com"), data_use_it->url);
-    EXPECT_EQ(GetRequestStart(*bar_request), data_use_it->request_start);
-    EXPECT_EQ(GURL("http://barfirstparty.com"),
-              data_use_it->first_party_for_cookies);
-    EXPECT_EQ(kBarTabId, data_use_it->tab_id);
-    EXPECT_EQ(kBarConnectionType, data_use_it->connection_type);
-    EXPECT_EQ(kBarMccMnc, data_use_it->mcc_mnc);
-
-    observed_bar_tx_bytes += data_use_it->tx_bytes;
-    observed_bar_rx_bytes += data_use_it->rx_bytes;
-    ++data_use_it;
-  }
-  EXPECT_EQ(bar_request->GetTotalSentBytes(), observed_bar_tx_bytes);
-  EXPECT_EQ(bar_request->GetTotalReceivedBytes(), observed_bar_rx_bytes);
-}
-
-TEST_F(DataUseAggregatorTest, ReportCombinedDataUse) {
-  // Set up the |foo_request|.
-  net::MockRead foo_reads[] = {
-      net::MockRead(net::SYNCHRONOUS, "HTTP/1.1 200 OK\r\n\r\n"),
-      net::MockRead(net::SYNCHRONOUS, "hello world"),
-      net::MockRead(net::SYNCHRONOUS, net::OK),
+  const struct {
+    bool use_annotator;
+    bool use_amortizer;
+    bool expect_tab_ids;
+    int64_t expected_amortization_multiple;
+  } kTestCases[] = {
+      {false, false, false, 1},
+      {false, true, false, 2},
+      {true, false, true, 1},
+      {true, true, true, 2},
   };
-  net::StaticSocketDataProvider foo_socket(foo_reads, arraysize(foo_reads),
-                                           nullptr, 0);
-  mock_socket_factory()->AddSocketDataProvider(&foo_socket);
 
-  net::TestDelegate foo_delegate;
-  scoped_ptr<net::URLRequest> foo_request = context()->CreateRequest(
-      GURL("http://foo.com"), net::IDLE, &foo_delegate);
-  foo_request->set_first_party_for_cookies(GURL("http://foofirstparty.com"));
+  for (const auto& test_case : kTestCases) {
+    scoped_ptr<FakeDataUseAnnotator> annotator(
+        test_case.use_annotator ? new FakeDataUseAnnotator() : nullptr);
+    scoped_ptr<DataUseAmortizer> amortizer(
+        test_case.use_amortizer ? new DoublingAmortizer() : nullptr);
 
-  // Set up the |bar_request|.
-  net::MockRead bar_reads[] = {
-      net::MockRead(net::SYNCHRONOUS, "HTTP/1.1 200 OK\r\n\r\n"),
-      net::MockRead(net::SYNCHRONOUS, "hello world"),
-      net::MockRead(net::SYNCHRONOUS, net::OK),
-  };
-  net::StaticSocketDataProvider bar_socket(bar_reads, arraysize(bar_reads),
-                                           nullptr, 0);
-  mock_socket_factory()->AddSocketDataProvider(&bar_socket);
+    Initialize(annotator.Pass(), amortizer.Pass());
 
-  net::TestDelegate bar_delegate;
-  scoped_ptr<net::URLRequest> bar_request = context()->CreateRequest(
-      GURL("http://bar.com"), net::IDLE, &bar_delegate);
-  bar_request->set_first_party_for_cookies(GURL("http://barfirstparty.com"));
+    const int32_t kFooTabId = 10;
+    const net::NetworkChangeNotifier::ConnectionType kFooConnectionType =
+        net::NetworkChangeNotifier::CONNECTION_2G;
+    const std::string kFooMccMnc = "foo_mcc_mnc";
+    scoped_ptr<net::URLRequest> foo_request =
+        ExecuteRequest(GURL("http://foo.com"), GURL("http://foofirstparty.com"),
+                       kFooTabId, kFooConnectionType, kFooMccMnc);
 
-  // Set up the network delegate to assign tab IDs and connection types for each
-  // request.
-  const int32_t kFooTabId = 10;
-  const net::NetworkChangeNotifier::ConnectionType kFooConnectionType =
-      net::NetworkChangeNotifier::CONNECTION_2G;
-  const std::string kFooMccMnc = "foo_mcc_mnc";
-  const int32_t kBarTabId = 20;
-  const net::NetworkChangeNotifier::ConnectionType kBarConnectionType =
-      net::NetworkChangeNotifier::CONNECTION_WIFI;
-  const std::string kBarMccMnc = "bar_mcc_mnc";
+    const int32_t kBarTabId = 20;
+    const net::NetworkChangeNotifier::ConnectionType kBarConnectionType =
+        net::NetworkChangeNotifier::CONNECTION_WIFI;
+    const std::string kBarMccMnc = "bar_mcc_mnc";
+    scoped_ptr<net::URLRequest> bar_request =
+        ExecuteRequest(GURL("http://bar.com"), GURL("http://barfirstparty.com"),
+                       kBarTabId, kBarConnectionType, kBarMccMnc);
 
-  ReportingNetworkDelegate::DataUseContextMap data_use_context_map;
-  data_use_context_map[foo_request.get()] =
-      ReportingNetworkDelegate::DataUseContext(kFooTabId, kFooConnectionType,
-                                               kFooMccMnc);
-  data_use_context_map[bar_request.get()] =
-      ReportingNetworkDelegate::DataUseContext(kBarTabId, kBarConnectionType,
-                                               kBarMccMnc);
-  reporting_network_delegate()->set_data_use_context_map(data_use_context_map);
+    auto data_use_it = test_observer()->observed_data_use().begin();
 
-  // Run the requests.
-  foo_request->Start();
-  bar_request->Start();
-  base::MessageLoop::current()->RunUntilIdle();
+    // First, the |foo_request| data use should have happened.
+    int64_t observed_foo_tx_bytes = 0, observed_foo_rx_bytes = 0;
+    while (data_use_it != test_observer()->observed_data_use().end() &&
+           data_use_it->url == GURL("http://foo.com")) {
+      EXPECT_EQ(GetRequestStart(*foo_request), data_use_it->request_start);
+      EXPECT_EQ(GURL("http://foofirstparty.com"),
+                data_use_it->first_party_for_cookies);
 
-  // The observer should have been notified once with a DataUse element for each
-  // request.
-  EXPECT_EQ(1, test_observer()->on_data_use_called_count());
-  EXPECT_EQ(static_cast<size_t>(2),
-            test_observer()->observed_data_use().size());
+      if (test_case.expect_tab_ids)
+        EXPECT_EQ(kFooTabId, data_use_it->tab_id);
+      else
+        EXPECT_EQ(-1, data_use_it->tab_id);
 
-  // All of the |foo_request| DataUse should have been combined into a single
-  // DataUse element.
-  const DataUse& foo_data_use = test_observer()->observed_data_use().front();
-  EXPECT_EQ(GURL("http://foo.com"), foo_data_use.url);
-  EXPECT_EQ(GetRequestStart(*foo_request), foo_data_use.request_start);
-  EXPECT_EQ(GURL("http://foofirstparty.com"),
-            foo_data_use.first_party_for_cookies);
-  EXPECT_EQ(kFooTabId, foo_data_use.tab_id);
-  EXPECT_EQ(kFooConnectionType, foo_data_use.connection_type);
-  EXPECT_EQ(kFooMccMnc, foo_data_use.mcc_mnc);
-  EXPECT_EQ(foo_request->GetTotalSentBytes(), foo_data_use.tx_bytes);
-  EXPECT_EQ(foo_request->GetTotalReceivedBytes(), foo_data_use.rx_bytes);
+      EXPECT_EQ(kFooConnectionType, data_use_it->connection_type);
+      EXPECT_EQ(kFooMccMnc, data_use_it->mcc_mnc);
 
-  // All of the |bar_request| DataUse should have been combined into a single
-  // DataUse element.
-  const DataUse& bar_data_use = test_observer()->observed_data_use().back();
-  EXPECT_EQ(GURL("http://bar.com"), bar_data_use.url);
-  EXPECT_EQ(GetRequestStart(*bar_request), bar_data_use.request_start);
-  EXPECT_EQ(GURL("http://barfirstparty.com"),
-            bar_data_use.first_party_for_cookies);
-  EXPECT_EQ(kBarTabId, bar_data_use.tab_id);
-  EXPECT_EQ(kBarConnectionType, bar_data_use.connection_type);
-  EXPECT_EQ(kBarMccMnc, bar_data_use.mcc_mnc);
-  EXPECT_EQ(bar_request->GetTotalSentBytes(), bar_data_use.tx_bytes);
-  EXPECT_EQ(bar_request->GetTotalReceivedBytes(), bar_data_use.rx_bytes);
+      observed_foo_tx_bytes += data_use_it->tx_bytes;
+      observed_foo_rx_bytes += data_use_it->rx_bytes;
+      ++data_use_it;
+    }
+    EXPECT_EQ(foo_request->GetTotalSentBytes() *
+                  test_case.expected_amortization_multiple,
+              observed_foo_tx_bytes);
+    EXPECT_EQ(foo_request->GetTotalReceivedBytes() *
+                  test_case.expected_amortization_multiple,
+              observed_foo_rx_bytes);
+
+    // Then, the |bar_request| data use should have happened.
+    int64_t observed_bar_tx_bytes = 0, observed_bar_rx_bytes = 0;
+    while (data_use_it != test_observer()->observed_data_use().end()) {
+      EXPECT_EQ(GURL("http://bar.com"), data_use_it->url);
+      EXPECT_EQ(GetRequestStart(*bar_request), data_use_it->request_start);
+      EXPECT_EQ(GURL("http://barfirstparty.com"),
+                data_use_it->first_party_for_cookies);
+
+      if (test_case.expect_tab_ids)
+        EXPECT_EQ(kBarTabId, data_use_it->tab_id);
+      else
+        EXPECT_EQ(-1, data_use_it->tab_id);
+
+      EXPECT_EQ(kBarConnectionType, data_use_it->connection_type);
+      EXPECT_EQ(kBarMccMnc, data_use_it->mcc_mnc);
+
+      observed_bar_tx_bytes += data_use_it->tx_bytes;
+      observed_bar_rx_bytes += data_use_it->rx_bytes;
+      ++data_use_it;
+    }
+    EXPECT_EQ(bar_request->GetTotalSentBytes() *
+                  test_case.expected_amortization_multiple,
+              observed_bar_tx_bytes);
+    EXPECT_EQ(bar_request->GetTotalReceivedBytes() *
+                  test_case.expected_amortization_multiple,
+              observed_bar_rx_bytes);
+  }
 }
 
 TEST_F(DataUseAggregatorTest, ReportOffTheRecordDataUse) {
+  Initialize(scoped_ptr<FakeDataUseAnnotator>(new FakeDataUseAnnotator()),
+             scoped_ptr<DataUseAmortizer>(new DoublingAmortizer()));
+
   // Off the record data use should not be reported to observers.
   data_use_aggregator()->ReportOffTheRecordDataUse(1000, 1000);
   base::MessageLoop::current()->RunUntilIdle();
diff --git a/components/data_usage/core/data_use_amortizer.h b/components/data_usage/core/data_use_amortizer.h
new file mode 100644
index 0000000..8cdd08f2
--- /dev/null
+++ b/components/data_usage/core/data_use_amortizer.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DATA_USAGE_CORE_DATA_USE_AMORTIZER_H_
+#define COMPONENTS_DATA_USAGE_CORE_DATA_USE_AMORTIZER_H_
+
+#include <stdint.h>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace data_usage {
+
+struct DataUse;
+
+// Class that takes in DataUse and amortizes any extra data usage overhead
+// across DataUse objects.
+class DataUseAmortizer {
+ public:
+  typedef base::Callback<void(scoped_ptr<DataUse>)>
+      AmortizationCompleteCallback;
+
+  virtual ~DataUseAmortizer() {}
+
+  // Amortizes overhead into |data_use|, then passes the it to |callback| once
+  // amortization is complete. Amortizers that perform buffering may combine
+  // together |data_use| objects with the same |callback| if the |data_use|
+  // objects are identical in all ways but their byte counts.
+  virtual void AmortizeDataUse(
+      scoped_ptr<DataUse> data_use,
+      const AmortizationCompleteCallback& callback) = 0;
+
+  // Notifies the DataUseAmortizer that some extra bytes have been transferred
+  // that aren't associated with any DataUse objects (e.g. off-the-record
+  // traffic).
+  virtual void OnExtraBytes(int64_t extra_tx_bytes, int64_t extra_rx_bytes) = 0;
+};
+
+}  // namespace data_usage
+
+#endif  // COMPONENTS_DATA_USAGE_CORE_DATA_USE_AMORTIZER_H_
diff --git a/components/dom_distiller/core/page_features.cc b/components/dom_distiller/core/page_features.cc
index f931bbe..8425dc78 100644
--- a/components/dom_distiller/core/page_features.cc
+++ b/components/dom_distiller/core/page_features.cc
@@ -8,6 +8,7 @@
 
 #include "base/json/json_reader.h"
 #include "third_party/re2/re2/re2.h"
+#include "url/gurl.h"
 
 namespace dom_distiller {
 /* This code needs to derive features in the same way and order in which they
@@ -179,4 +180,64 @@
                                   innerHTML);
 }
 
+std::vector<double> CalculateDerivedFeatures(
+    bool openGraph,
+    const GURL& url,
+    unsigned elementCount,
+    unsigned anchorCount,
+    unsigned formCount,
+    double mozScore,
+    double mozScoreAllSqrt,
+    double mozScoreAllLinear) {
+  const std::string& path = url.path();
+  std::vector<double> features;
+  // 'opengraph', opengraph,
+  features.push_back(openGraph);
+  // 'forum', 'forum' in path,
+  features.push_back(Contains("forum", path));
+  // 'index', 'index' in path,
+  features.push_back(Contains("index", path));
+  // 'search', 'search' in path,
+  features.push_back(Contains("search", path));
+  // 'view', 'view' in path,
+  features.push_back(Contains("view", path));
+  // 'archive', 'archive' in path,
+  features.push_back(Contains("archive", path));
+  // 'asp', '.asp' in path,
+  features.push_back(Contains(".asp", path));
+  // 'phpbb', 'phpbb' in path,
+  features.push_back(Contains("phpbb", path));
+  // 'php', path.endswith('.php'),
+  features.push_back(EndsWith(".php", path));
+  // 'pathLength', len(path),
+  features.push_back(path.size());
+  // 'domain', len(path) < 2,
+  features.push_back(path.size() < 2);
+  // 'pathComponents', CountMatches(path, r'\/.'),
+  features.push_back(CountMatches(path, "\\/."));
+  // 'slugDetector', CountMatches(path, r'[^\w/]'),
+  features.push_back(CountMatches(path, "[^\\w/]"));
+  // 'pathNumbers', CountMatches(path, r'\d+'),
+  features.push_back(CountMatches(path, "\\d+"));
+  // 'lastSegmentLength', len(GetLastSegment(path)),
+  features.push_back(GetLastSegment(path).size());
+  // 'formCount', numForms,
+  features.push_back(formCount);
+  // 'anchorCount', numAnchors,
+  features.push_back(anchorCount);
+  // 'elementCount', numElements,
+  features.push_back(elementCount);
+  // 'anchorRatio', float(numAnchors) / max(1, numElements),
+  features.push_back(
+      double(anchorCount) / std::max<double>(1, elementCount));
+  // 'mozScore'
+  features.push_back(mozScore);
+  // 'mozScoreAllSqrt'
+  features.push_back(mozScoreAllSqrt);
+  // 'mozScoreAllLinear'
+  features.push_back(mozScoreAllLinear);
+
+  return features;
+}
+
 }  // namespace dom_distiller
diff --git a/components/dom_distiller/core/page_features.h b/components/dom_distiller/core/page_features.h
index 236796b..a54d1cdf 100644
--- a/components/dom_distiller/core/page_features.h
+++ b/components/dom_distiller/core/page_features.h
@@ -10,19 +10,20 @@
 #include "base/values.h"
 #include "url/gurl.h"
 
+class GURL;
+
 namespace dom_distiller {
 
 // The length of the derived features vector.
 extern int kDerivedFeaturesCount;
 
 // The distillable page detector is a model trained on a list of numeric
-// features derived from core more complex features of a webpage (like the
-// body's .textContent). This derives the numeric features for a set of core
-// features.
+// features derived from features of a webpage (like body's number of elements
+// ). This derives the numeric features form a set of core features.
 //
 // Note: It is crucial that these features are derived in the same way and are
 // in the same order as in the training pipeline. See //heuristics/distillable
-// in the external DomDistillerJs repo.
+// in the external DomDistiller repo.
 std::vector<double> CalculateDerivedFeatures(bool isOGArticle,
                                              const GURL& url,
                                              double numElements,
@@ -37,6 +38,16 @@
 std::vector<double> CalculateDerivedFeaturesFromJSON(
     const base::Value* stringified_json);
 
+std::vector<double> CalculateDerivedFeatures(
+    bool openGraph,
+    const GURL& url,
+    unsigned elementCount,
+    unsigned anchorCount,
+    unsigned formCount,
+    double mozScore,
+    double mozScoreAllSqrt,
+    double mozScoreAllLinear);
+
 }  // namespace dom_distiller
 
 #endif  // COMPONENTS_DOM_DISTILLER_CORE_PAGE_FEATURES_H_
diff --git a/components/dom_distiller/core/page_features_unittest.cc b/components/dom_distiller/core/page_features_unittest.cc
index 8e259e4..a22e4c1 100644
--- a/components/dom_distiller/core/page_features_unittest.cc
+++ b/components/dom_distiller/core/page_features_unittest.cc
@@ -13,6 +13,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/path_service.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
 
 namespace dom_distiller {
 
@@ -95,4 +96,77 @@
     }
   }
 }
+
+std::vector<double> DeriveFromPath(const GURL& url) {
+  return CalculateDerivedFeatures(
+    false, // bool openGraph
+    url,   // const GURL& url
+    0,     // unsigned elementCount
+    0,     // unsigned anchorCount
+    0,     // unsigned formCount
+    0,     // double mozScore
+    0,     // double mozScoreAllSqrt
+    0      // double mozScoreAllLinear
+  );
+}
+
+TEST(DomDistillerPageFeaturesTest, TestPath) {
+  GURL url("http://example.com/search/view/index/the-title-of-archive.php");
+
+  std::vector<double> derived(DeriveFromPath(url));
+  EXPECT_EQ(0, lround(derived[1]));
+  EXPECT_EQ(1, lround(derived[2]));
+  EXPECT_EQ(1, lround(derived[3]));
+  EXPECT_EQ(1, lround(derived[4]));
+  EXPECT_EQ(1, lround(derived[5]));
+  EXPECT_EQ(0, lround(derived[6]));
+  EXPECT_EQ(0, lround(derived[7]));
+  EXPECT_EQ(1, lround(derived[8]));
+  EXPECT_EQ(43, lround(derived[9]));
+  EXPECT_EQ(0, lround(derived[10]));
+  EXPECT_EQ(4, lround(derived[11]));
+  EXPECT_EQ(4, lround(derived[12]));
+  EXPECT_EQ(0, lround(derived[13]));
+  EXPECT_EQ(24, lround(derived[14]));
+}
+
+TEST(DomDistillerPageFeaturesTest, TestPath2) {
+  GURL url("http://example.com/phpbb/forum123/456.asp");
+
+  std::vector<double> derived(DeriveFromPath(url));
+  EXPECT_EQ(1, lround(derived[1]));
+  EXPECT_EQ(0, lround(derived[2]));
+  EXPECT_EQ(0, lround(derived[3]));
+  EXPECT_EQ(0, lround(derived[4]));
+  EXPECT_EQ(0, lround(derived[5]));
+  EXPECT_EQ(1, lround(derived[6]));
+  EXPECT_EQ(1, lround(derived[7]));
+  EXPECT_EQ(0, lround(derived[8]));
+  EXPECT_EQ(23, lround(derived[9]));
+  EXPECT_EQ(0, lround(derived[10]));
+  EXPECT_EQ(3, lround(derived[11]));
+  EXPECT_EQ(1, lround(derived[12]));
+  EXPECT_EQ(2, lround(derived[13]));
+  EXPECT_EQ(7, lround(derived[14]));
+}
+
+TEST(DomDistillerPageFeaturesTest, TestPath3) {
+  GURL url("https://example.com/");
+
+  std::vector<double> derived(DeriveFromPath(url));
+  EXPECT_EQ(0, lround(derived[1]));
+  EXPECT_EQ(0, lround(derived[2]));
+  EXPECT_EQ(0, lround(derived[3]));
+  EXPECT_EQ(0, lround(derived[4]));
+  EXPECT_EQ(0, lround(derived[5]));
+  EXPECT_EQ(0, lround(derived[6]));
+  EXPECT_EQ(0, lround(derived[7]));
+  EXPECT_EQ(0, lround(derived[8]));
+  EXPECT_EQ(1, lround(derived[9]));
+  EXPECT_EQ(1, lround(derived[10]));
+  EXPECT_EQ(0, lround(derived[11]));
+  EXPECT_EQ(0, lround(derived[12]));
+  EXPECT_EQ(0, lround(derived[13]));
+  EXPECT_EQ(0, lround(derived[14]));
+}
 }
diff --git a/components/error_page/common/net_error_info.h b/components/error_page/common/net_error_info.h
index 77d6a28..1f637e5 100644
--- a/components/error_page/common/net_error_info.h
+++ b/components/error_page/common/net_error_info.h
@@ -41,6 +41,11 @@
 
   NETWORK_ERROR_DIAGNOSE_BUTTON_CLICKED = 17,      // Diagnose button clicked.
 
+  // For the "Show all saved pages".
+  NETWORK_ERROR_PAGE_SHOW_SAVED_PAGES_BUTTON_SHOWN = 18,
+  NETWORK_ERROR_PAGE_SHOW_SAVED_PAGES_BUTTON_CLICKED = 19,
+  NETWORK_ERROR_PAGE_SHOW_SAVED_PAGES_BUTTON_ERROR = 20,
+
   NETWORK_ERROR_PAGE_EVENT_MAX,
 };
 
diff --git a/components/error_page/renderer/net_error_helper_core.cc b/components/error_page/renderer/net_error_helper_core.cc
index ccb1a46..db3f4dcd7 100644
--- a/components/error_page/renderer/net_error_helper_core.cc
+++ b/components/error_page/renderer/net_error_helper_core.cc
@@ -380,6 +380,7 @@
         reload_button_in_page(false),
         show_saved_copy_button_in_page(false),
         show_cached_copy_button_in_page(false),
+        show_saved_pages_button_in_page(false),
         is_finished_loading(false),
         auto_reload_triggered(false) {}
 
@@ -414,6 +415,7 @@
   bool reload_button_in_page;
   bool show_saved_copy_button_in_page;
   bool show_cached_copy_button_in_page;
+  bool show_saved_pages_button_in_page;
 
   // True if a page has completed loading, at which point it can receive
   // updates.
@@ -468,7 +470,8 @@
       online_(true),
       visible_(is_visible),
       auto_reload_count_(0),
-      navigation_from_button_(NO_BUTTON) {
+      navigation_from_button_(NO_BUTTON),
+      has_offline_pages_(false) {
 }
 
 NetErrorHelperCore::~NetErrorHelperCore() {
@@ -593,6 +596,9 @@
   if (committed_error_page_info_->show_saved_copy_button_in_page) {
     RecordEvent(NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_SHOWN);
   }
+  if (committed_error_page_info_->show_saved_pages_button_in_page) {
+    RecordEvent(NETWORK_ERROR_PAGE_SHOW_SAVED_PAGES_BUTTON_SHOWN);
+  }
   if (committed_error_page_info_->reload_button_in_page &&
       committed_error_page_info_->show_saved_copy_button_in_page) {
     RecordEvent(NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN);
@@ -647,13 +653,15 @@
     bool reload_button_in_page;
     bool show_saved_copy_button_in_page;
     bool show_cached_copy_button_in_page;
+    bool show_saved_pages_button_in_page;
 
     delegate_->GenerateLocalizedErrorPage(
         error, is_failed_post,
         false /* No diagnostics dialogs allowed for subframes. */,
+        false /* No "show saved pages" provided in subframes */,
         scoped_ptr<ErrorPageParams>(), &reload_button_in_page,
         &show_saved_copy_button_in_page, &show_cached_copy_button_in_page,
-        error_html);
+        &show_saved_pages_button_in_page, error_html);
   }
 }
 
@@ -689,6 +697,10 @@
   navigation_correction_params_.search_url = search_url;
 }
 
+void NetErrorHelperCore::OnSetHasOfflinePages(bool has_offline_pages) {
+  has_offline_pages_ = has_offline_pages;
+}
+
 void NetErrorHelperCore::GetErrorHtmlForMainFrame(
     ErrorPageInfo* pending_error_page_info,
     std::string* error_html) {
@@ -716,10 +728,12 @@
   delegate_->GenerateLocalizedErrorPage(
       error, pending_error_page_info->was_failed_post,
       can_show_network_diagnostics_dialog_,
+      has_offline_pages_,
       scoped_ptr<ErrorPageParams>(),
       &pending_error_page_info->reload_button_in_page,
       &pending_error_page_info->show_saved_copy_button_in_page,
       &pending_error_page_info->show_cached_copy_button_in_page,
+      &pending_error_page_info->show_saved_pages_button_in_page,
       error_html);
 }
 
@@ -743,7 +757,8 @@
   delegate_->UpdateErrorPage(
       GetUpdatedError(committed_error_page_info_->error),
       committed_error_page_info_->was_failed_post,
-      can_show_network_diagnostics_dialog_);
+      can_show_network_diagnostics_dialog_,
+      has_offline_pages_);
 }
 
 void NetErrorHelperCore::OnNavigationCorrectionsFetched(
@@ -781,10 +796,12 @@
         pending_error_page_info_->error,
         pending_error_page_info_->was_failed_post,
         can_show_network_diagnostics_dialog_,
+        has_offline_pages_,
         params.Pass(),
         &pending_error_page_info_->reload_button_in_page,
         &pending_error_page_info_->show_saved_copy_button_in_page,
         &pending_error_page_info_->show_cached_copy_button_in_page,
+        &pending_error_page_info_->show_saved_pages_button_in_page,
         &error_html);
   } else {
     // Since |navigation_correction_params| in |pending_error_page_info_| is
@@ -949,6 +966,10 @@
       delegate_->DiagnoseError(
           committed_error_page_info_->error.unreachableURL);
       return;
+    case SHOW_SAVED_PAGES_BUTTON:
+      RecordEvent(NETWORK_ERROR_PAGE_SHOW_SAVED_PAGES_BUTTON_CLICKED);
+      delegate_->ShowOfflinePages();
+      return;
     case NO_BUTTON:
       NOTREACHED();
       return;
diff --git a/components/error_page/renderer/net_error_helper_core.h b/components/error_page/renderer/net_error_helper_core.h
index ef60d68f..d5c8930 100644
--- a/components/error_page/renderer/net_error_helper_core.h
+++ b/components/error_page/renderer/net_error_helper_core.h
@@ -50,6 +50,7 @@
     EASTER_EGG,
     SHOW_CACHED_COPY_BUTTON,  // "Google cached copy" button label experiment.
     DIAGNOSE_ERROR,
+    SHOW_SAVED_PAGES_BUTTON,
   };
 
   // The Delegate handles all interaction with the RenderView, WebFrame, and
@@ -61,10 +62,12 @@
         const blink::WebURLError& error,
         bool is_failed_post,
         bool can_show_network_diagnostics_dialog,
+        bool has_offline_pages,
         scoped_ptr<ErrorPageParams> params,
         bool* reload_button_shown,
         bool* show_saved_copy_button_shown,
         bool* show_cached_copy_button_shown,
+        bool* show_saved_pages_button_shown,
         std::string* html) const = 0;
 
     // Loads the given HTML in the frame for use as an error page.
@@ -80,7 +83,8 @@
     // been generated by a call to GenerateLocalizedErrorPage.
     virtual void UpdateErrorPage(const blink::WebURLError& error,
                                  bool is_failed_post,
-                                 bool can_show_network_diagnostics_dialog) = 0;
+                                 bool can_show_network_diagnostics_dialog,
+                                 bool has_offline_pages) = 0;
 
     // Fetches an error page and calls into OnErrorPageFetched when done.  Any
     // previous fetch must either be canceled or finished before calling.  Can't
@@ -108,6 +112,9 @@
     // Run the platform diagnostics too for the specified URL.
     virtual void DiagnoseError(const GURL& page_url) = 0;
 
+    // Shows the UI for offline pages.
+    virtual void ShowOfflinePages() = 0;
+
    protected:
     virtual ~Delegate() {}
   };
@@ -170,6 +177,10 @@
                                      const std::string& country_code,
                                      const std::string& api_key,
                                      const GURL& search_url);
+
+  // Notifies by the browser whether an offline page exists.
+  void OnSetHasOfflinePages(bool has_offline_pages);
+
   // Notifies |this| that the network's online status changed.
   // Handler for NetworkStateChanged notification from the browser process. If
   // the network state changes to online, this method is responsible for
@@ -280,6 +291,10 @@
   // the error page.  It is used to detect when such navigations result
   // in errors.
   Button navigation_from_button_;
+
+  // Whether an offline page exists. This is used to decide if "Show saved
+  // pages" will be provided in certain error page.
+  bool has_offline_pages_;
 };
 
 }  // namespace error_page
diff --git a/components/error_page/renderer/net_error_helper_core_unittest.cc b/components/error_page/renderer/net_error_helper_core_unittest.cc
index 35bf6d47..fbd6b27 100644
--- a/components/error_page/renderer/net_error_helper_core_unittest.cc
+++ b/components/error_page/renderer/net_error_helper_core_unittest.cc
@@ -158,8 +158,9 @@
         error_html_update_count_(0),
         reload_count_(0),
         reload_bypassing_cache_count_(0),
-        show_saved_count_(0),
+        show_saved_copy_count_(0),
         diagnose_error_count_(0),
+        show_saved_pages_count_(0),
         enable_page_helper_functions_count_(0),
         default_url_(GURL(kFailedUrl)),
         error_url_(GURL(content::kUnreachableWebDataURL)),
@@ -201,12 +202,12 @@
     return reload_bypassing_cache_count_;
   }
 
-  int show_saved_count() const {
-    return show_saved_count_;
+  int show_saved_copy_count() const {
+    return show_saved_copy_count_;
   }
 
-  const GURL& show_saved_url() const {
-    return show_saved_url_;
+  const GURL& show_saved_copy_url() const {
+    return show_saved_copy_url_;
   }
 
   int diagnose_error_count() const {
@@ -217,6 +218,10 @@
     return diagnose_error_url_;
   }
 
+  int show_saved_pages_count() const {
+    return show_saved_pages_count_;
+  }
+
   const GURL& default_url() const {
     return default_url_;
   }
@@ -239,6 +244,10 @@
     return last_can_show_network_diagnostics_dialog_;
   }
 
+  bool last_has_offline_pages() const {
+    return last_has_offline_pages_;
+  }
+
   const ErrorPageParams* last_error_page_params() const {
     return last_error_page_params_.get();
   }
@@ -344,17 +353,21 @@
   void GenerateLocalizedErrorPage(const WebURLError& error,
                                   bool is_failed_post,
                                   bool can_show_network_diagnostics_dialog,
+                                  bool has_offline_pages,
                                   scoped_ptr<ErrorPageParams> params,
                                   bool* reload_button_shown,
                                   bool* show_saved_copy_button_shown,
                                   bool* show_cached_copy_button_shown,
+                                  bool* show_saved_pages_button_shown,
                                   std::string* html) const override {
     last_can_show_network_diagnostics_dialog_ =
         can_show_network_diagnostics_dialog;
+    last_has_offline_pages_ = has_offline_pages;
     last_error_page_params_.reset(params.release());
     *reload_button_shown = false;
     *show_saved_copy_button_shown = false;
     *show_cached_copy_button_shown = false;
+    *show_saved_pages_button_shown = false;
     *html = ErrorToString(error, is_failed_post);
   }
 
@@ -368,10 +381,12 @@
   }
 
   void UpdateErrorPage(const WebURLError& error, bool is_failed_post,
-                       bool can_show_network_diagnostics_dialog) override {
+                       bool can_show_network_diagnostics_dialog,
+                       bool has_offline_pages) override {
     update_count_++;
     last_can_show_network_diagnostics_dialog_ =
         can_show_network_diagnostics_dialog;
+    last_has_offline_pages_ = has_offline_pages;
     last_error_page_params_.reset(nullptr);
     last_error_html_ = ErrorToString(error, is_failed_post);
   }
@@ -413,8 +428,8 @@
   }
 
   void LoadPageFromCache(const GURL& page_url) override {
-    show_saved_count_++;
-    show_saved_url_ = page_url;
+    show_saved_copy_count_++;
+    show_saved_copy_url_ = page_url;
   }
 
   void DiagnoseError(const GURL& page_url) override {
@@ -422,6 +437,10 @@
     diagnose_error_url_ = page_url;
   }
 
+  void ShowOfflinePages() override {
+    show_saved_pages_count_++;
+  }
+
   void SendTrackingRequest(const GURL& tracking_url,
                            const std::string& tracking_request_body) override {
     last_tracking_url_ = tracking_url;
@@ -464,15 +483,16 @@
   // Values passed in to the last call of GenerateLocalizedErrorPage or
   // UpdateErrorPage.  Mutable because GenerateLocalizedErrorPage is const.
   mutable bool last_can_show_network_diagnostics_dialog_;
+  mutable bool last_has_offline_pages_;
   mutable scoped_ptr<ErrorPageParams> last_error_page_params_;
 
   int reload_count_;
   int reload_bypassing_cache_count_;
-  int show_saved_count_;
-  GURL show_saved_url_;
+  int show_saved_copy_count_;
+  GURL show_saved_copy_url_;
   int diagnose_error_count_;
   GURL diagnose_error_url_;
-
+  int show_saved_pages_count_;
 
   int enable_page_helper_functions_count_;
 
@@ -2532,10 +2552,10 @@
 
 TEST_F(NetErrorHelperCoreTest, ExplicitShowSavedSucceeds) {
   DoErrorLoad(net::ERR_CONNECTION_RESET);
-  EXPECT_EQ(0, show_saved_count());
+  EXPECT_EQ(0, show_saved_copy_count());
   core()->ExecuteButtonPress(NetErrorHelperCore::SHOW_SAVED_COPY_BUTTON);
-  EXPECT_EQ(1, show_saved_count());
-  EXPECT_EQ(GURL(kFailedUrl), show_saved_url());
+  EXPECT_EQ(1, show_saved_copy_count());
+  EXPECT_EQ(GURL(kFailedUrl), show_saved_copy_url());
 }
 
 TEST_F(NetErrorHelperCoreTest, CanNotShowNetworkDiagnostics) {
@@ -2554,5 +2574,14 @@
   EXPECT_EQ(GURL(kFailedUrl), diagnose_error_url());
 }
 
+TEST_F(NetErrorHelperCoreTest, ShowSavedPages) {
+  core()->OnSetHasOfflinePages(true);
+  DoErrorLoad(net::ERR_INTERNET_DISCONNECTED);
+  EXPECT_TRUE(last_has_offline_pages());
+  EXPECT_EQ(0, show_saved_pages_count());
+  core()->ExecuteButtonPress(NetErrorHelperCore::SHOW_SAVED_PAGES_BUTTON);
+  EXPECT_EQ(1, show_saved_pages_count());
+}
+
 }  // namespace
 }  // namespace error_page
diff --git a/components/feedback/tracing_manager.cc b/components/feedback/tracing_manager.cc
index 462000a5..f1f7590 100644
--- a/components/feedback/tracing_manager.cc
+++ b/components/feedback/tracing_manager.cc
@@ -43,7 +43,7 @@
 
   current_trace_id_ = g_next_trace_id;
   ++g_next_trace_id;
-  content::TracingController::GetInstance()->DisableRecording(
+  content::TracingController::GetInstance()->StopTracing(
       content::TracingController::CreateStringSink(
           base::Bind(&TracingManager::OnTraceDataCollected,
                      weak_ptr_factory_.GetWeakPtr())));
@@ -90,9 +90,9 @@
 }
 
 void TracingManager::StartTracing() {
-  content::TracingController::GetInstance()->EnableRecording(
+  content::TracingController::GetInstance()->StartTracing(
       base::trace_event::TraceConfig(),
-      content::TracingController::EnableRecordingDoneCallback());
+      content::TracingController::StartTracingDoneCallback());
 }
 
 void TracingManager::OnTraceDataCollected(
diff --git a/components/filesystem/DEPS b/components/filesystem/DEPS
index b3412d0..42df3f2 100644
--- a/components/filesystem/DEPS
+++ b/components/filesystem/DEPS
@@ -3,4 +3,5 @@
   "+mojo/platform_handle",
   "+mojo/public",
   "+mojo/util",
+  "+third_party/mojo/src/mojo/public",
 ]
diff --git a/components/filesystem/directory_impl.h b/components/filesystem/directory_impl.h
index b016b839..0d1e008f 100644
--- a/components/filesystem/directory_impl.h
+++ b/components/filesystem/directory_impl.h
@@ -10,8 +10,8 @@
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "components/filesystem/public/interfaces/directory.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace base {
 class ScopedTempDir;
diff --git a/components/filesystem/file_impl.h b/components/filesystem/file_impl.h
index 0ca3501e..78bc521 100644
--- a/components/filesystem/file_impl.h
+++ b/components/filesystem/file_impl.h
@@ -9,8 +9,8 @@
 #include "base/files/scoped_file.h"
 #include "base/macros.h"
 #include "components/filesystem/public/interfaces/directory.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace base {
 class FilePath;
diff --git a/components/filesystem/file_impl_unittest.cc b/components/filesystem/file_impl_unittest.cc
index 86ec3ed..744befaa 100644
--- a/components/filesystem/file_impl_unittest.cc
+++ b/components/filesystem/file_impl_unittest.cc
@@ -7,9 +7,9 @@
 #include "base/files/file.h"
 #include "components/filesystem/files_test_base.h"
 #include "mojo/platform_handle/platform_handle_functions.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
 #include "mojo/util/capture_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
 
 using mojo::Capture;
 
diff --git a/components/filesystem/file_system_impl.h b/components/filesystem/file_system_impl.h
index 2cda44d..1ebbfed2 100644
--- a/components/filesystem/file_system_impl.h
+++ b/components/filesystem/file_system_impl.h
@@ -7,8 +7,8 @@
 
 #include "base/macros.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace base {
 class FilePath;
diff --git a/components/filesystem/files_test_base.h b/components/filesystem/files_test_base.h
index 43ffccfa..6cf11f0 100644
--- a/components/filesystem/files_test_base.h
+++ b/components/filesystem/files_test_base.h
@@ -8,7 +8,7 @@
 #include "base/macros.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
 #include "mojo/application/public/cpp/application_test_base.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
 namespace filesystem {
 
diff --git a/components/filesystem/main.cc b/components/filesystem/main.cc
index 6e25653..764f3f3 100644
--- a/components/filesystem/main.cc
+++ b/components/filesystem/main.cc
@@ -5,7 +5,7 @@
 #include "base/macros.h"
 #include "components/filesystem/file_system_app.h"
 #include "mojo/application/public/cpp/application_runner.h"
-#include "mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 MojoResult MojoMain(MojoHandle application_request) {
   mojo::ApplicationRunner runner(new filesystem::FileSystemApp());
diff --git a/components/filesystem/util.cc b/components/filesystem/util.cc
index 257d008..199a1c1 100644
--- a/components/filesystem/util.cc
+++ b/components/filesystem/util.cc
@@ -13,7 +13,7 @@
 
 #include "base/logging.h"
 #include "base/strings/string_util.h"
-#include "mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 #if defined(OS_WIN)
 #include "base/strings/utf_string_conversions.h"
diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc
index 17cfb34e..1914585 100644
--- a/components/html_viewer/html_frame.cc
+++ b/components/html_viewer/html_frame.cc
@@ -426,8 +426,8 @@
   DVLOG(2) << "XXX HTMLFrame::didHandleOnloadEvents id=" << id_;
   static bool recorded = false;
   if (!recorded && startup_performance_data_collector_) {
-    startup_performance_data_collector_->SetFirstWebContentsMainFrameLoadTime(
-        base::Time::Now().ToInternalValue());
+    startup_performance_data_collector_->SetFirstWebContentsMainFrameLoadTicks(
+        base::TimeTicks::Now().ToInternalValue());
     recorded = true;
   }
 }
diff --git a/components/html_viewer/html_widget.cc b/components/html_viewer/html_widget.cc
index 28f9f1b..5a60d3e 100644
--- a/components/html_viewer/html_widget.cc
+++ b/components/html_viewer/html_widget.cc
@@ -126,11 +126,11 @@
     blink::WebMeaningfulLayout layout_type) {
   static bool called = false;
   if (!called && layout_type == blink::WebMeaningfulLayout::VisuallyNonEmpty) {
-    const int64 time = base::Time::Now().ToInternalValue();
+    const int64 ticks = base::TimeTicks::Now().ToInternalValue();
     tracing::StartupPerformanceDataCollectorPtr collector =
         StatsCollectionController::ConnectToDataCollector(app_);
     if (collector)
-      collector->SetFirstVisuallyNonEmptyLayoutTime(time);
+      collector->SetFirstVisuallyNonEmptyLayoutTicks(ticks);
     called = true;
   }
 }
diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc
index 8abc09a7..965c317 100644
--- a/components/html_viewer/stats_collection_controller.cc
+++ b/components/html_viewer/stats_collection_controller.cc
@@ -22,7 +22,6 @@
 namespace {
 
 // Initialize the histogram data using the given startup performance times.
-// TODO(msw): Use TimeTicks to avoid system clock changes: crbug.com/521164
 void GetStartupPerformanceTimesCallbackImpl(
     tracing::StartupPerformanceTimesPtr times) {
   base::StatisticsRecorder::Initialize();
@@ -36,22 +35,23 @@
 
   // TODO(msw): Determine if this is the first run.
   startup_metric_utils::RecordBrowserMainMessageLoopStart(
-      base::Time::FromInternalValue(times->browser_message_loop_start_time),
+      base::TimeTicks::FromInternalValue(
+          times->browser_message_loop_start_ticks),
       false);
 
   startup_metric_utils::RecordBrowserWindowDisplay(
-      base::Time::FromInternalValue(times->browser_window_display_time));
+      base::TimeTicks::FromInternalValue(times->browser_window_display_ticks));
 
   startup_metric_utils::RecordBrowserOpenTabsDelta(
       base::TimeDelta::FromInternalValue(times->browser_open_tabs_time_delta));
 
   startup_metric_utils::RecordFirstWebContentsMainFrameLoad(
-      base::Time::FromInternalValue(
-          times->first_web_contents_main_frame_load_time));
+      base::TimeTicks::FromInternalValue(
+          times->first_web_contents_main_frame_load_ticks));
 
   startup_metric_utils::RecordFirstWebContentsNonEmptyPaint(
-      base::Time::FromInternalValue(
-          times->first_visually_non_empty_layout_time));
+      base::TimeTicks::FromInternalValue(
+          times->first_visually_non_empty_layout_ticks));
 }
 
 }  // namespace
diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h
index 5dd33586d..f1358fb6 100644
--- a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h
+++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h
@@ -8,9 +8,9 @@
 #include "base/macros.h"
 #include "components/mus/public/interfaces/command_buffer.mojom.h"
 #include "gpu/blink/webgraphicscontext3d_impl.h"
-#include "mojo/public/c/gles2/gles2.h"
 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
 #include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 #include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 #include "url/gurl.h"
 
diff --git a/components/mus/common/transient_window_utils.h b/components/mus/common/transient_window_utils.h
index 1a8d0ca..e18f8b3 100644
--- a/components/mus/common/transient_window_utils.h
+++ b/components/mus/common/transient_window_utils.h
@@ -92,8 +92,16 @@
 }
 
 // Stacks transient descendants of |window| that are its siblings just above it.
+// |GetStackingTarget| is a function that returns a marker associated with a
+// Window that indicates the current Window being stacked.
+// |Reorder| is a function that takes in two windows and orders the first
+// relative to the second based on the provided OrderDirection.
 template <class T>
-void RestackTransientDescendants(T* window, T** (*GetStackingTarget)(T*)) {
+void RestackTransientDescendants(T* window,
+                                 T** (*GetStackingTarget)(T*),
+                                 void (*Reorder)(T*,
+                                                 T*,
+                                                 mojom::OrderDirection)) {
   T* parent = window->parent();
   if (!parent)
     return;
@@ -106,7 +114,7 @@
     if ((*it) != window && HasTransientAncestor(*it, window)) {
       T* old_stacking_target = *GetStackingTarget(*it);
       *GetStackingTarget(*it) = window;
-      (*it)->Reorder(window, mojom::ORDER_DIRECTION_ABOVE);
+      Reorder(*it, window, mojom::ORDER_DIRECTION_ABOVE);
       *GetStackingTarget(*it) = old_stacking_target;
     }
   }
diff --git a/components/mus/ws/server_window.cc b/components/mus/ws/server_window.cc
index 458cb9a..c88da20 100644
--- a/components/mus/ws/server_window.cc
+++ b/components/mus/ws/server_window.cc
@@ -95,7 +95,8 @@
 
   // Stack the child properly if it is a transient child of a sibling.
   if (child->transient_parent_ && child->transient_parent_->parent() == this)
-    RestackTransientDescendants(child->transient_parent_, &GetStackingTarget);
+    RestackTransientDescendants(child->transient_parent_, &GetStackingTarget,
+                                &ReorderImpl);
 
   FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
                     OnWindowHierarchyChanged(child, this, old_parent));
@@ -113,7 +114,8 @@
 
   // Stack the child properly if it is a transient child of a sibling.
   if (child->transient_parent_ && child->transient_parent_->parent() == this)
-    RestackTransientDescendants(child->transient_parent_, &GetStackingTarget);
+    RestackTransientDescendants(child->transient_parent_, &GetStackingTarget,
+                                &ReorderImpl);
 
   FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
                     OnWindowHierarchyChanged(child, nullptr, this));
@@ -121,30 +123,7 @@
 
 void ServerWindow::Reorder(ServerWindow* relative,
                            mojom::OrderDirection direction) {
-  ServerWindow* window = this;
-  DCHECK(relative);
-  DCHECK_NE(window, relative);
-  DCHECK_EQ(window->parent(), relative->parent());
-
-  if (!AdjustStackingForTransientWindows(&window, &relative, &direction,
-                                         stacking_target_))
-    return;
-
-  window->parent_->children_.erase(std::find(window->parent_->children_.begin(),
-                                             window->parent_->children_.end(),
-                                             window));
-  Windows::iterator i = std::find(window->parent_->children_.begin(),
-                                  window->parent_->children_.end(), relative);
-  if (direction == mojom::ORDER_DIRECTION_ABOVE) {
-    DCHECK(i != window->parent_->children_.end());
-    window->parent_->children_.insert(++i, window);
-  } else if (direction == mojom::ORDER_DIRECTION_BELOW) {
-    DCHECK(i != window->parent_->children_.end());
-    window->parent_->children_.insert(i, window);
-  }
-  FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
-                    OnWindowReordered(this, relative, direction));
-  window->OnStackingChanged();
+  ReorderImpl(this, relative, direction);
 }
 
 void ServerWindow::StackChildAtBottom(ServerWindow* child) {
@@ -225,7 +204,7 @@
   // Restack |child| properly above its transient parent, if they share the same
   // parent.
   if (child->parent() == parent())
-    RestackTransientDescendants(this, &GetStackingTarget);
+    RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
 
   FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
                     OnTransientWindowAdded(this, child));
@@ -243,7 +222,7 @@
   // should be restacked properly so it is not among transient children of its
   // former parent, anymore.
   if (parent() == child->parent())
-    RestackTransientDescendants(this, &GetStackingTarget);
+    RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
 
   FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
                     OnTransientWindowRemoved(this, child));
@@ -367,7 +346,36 @@
       return;
     }
   }
-  RestackTransientDescendants(this, &GetStackingTarget);
+  RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
+}
+
+// static
+void ServerWindow::ReorderImpl(ServerWindow* window,
+                               ServerWindow* relative,
+                               mojom::OrderDirection direction) {
+  DCHECK(relative);
+  DCHECK_NE(window, relative);
+  DCHECK_EQ(window->parent(), relative->parent());
+
+  if (!AdjustStackingForTransientWindows(&window, &relative, &direction,
+                                         window->stacking_target_))
+    return;
+
+  window->parent_->children_.erase(std::find(window->parent_->children_.begin(),
+                                             window->parent_->children_.end(),
+                                             window));
+  Windows::iterator i = std::find(window->parent_->children_.begin(),
+                                  window->parent_->children_.end(), relative);
+  if (direction == mojom::ORDER_DIRECTION_ABOVE) {
+    DCHECK(i != window->parent_->children_.end());
+    window->parent_->children_.insert(++i, window);
+  } else if (direction == mojom::ORDER_DIRECTION_BELOW) {
+    DCHECK(i != window->parent_->children_.end());
+    window->parent_->children_.insert(i, window);
+  }
+  FOR_EACH_OBSERVER(ServerWindowObserver, window->observers_,
+                    OnWindowReordered(window, relative, direction));
+  window->OnStackingChanged();
 }
 
 // static
diff --git a/components/mus/ws/server_window.h b/components/mus/ws/server_window.h
index 62748a4..cc5d6d9 100644
--- a/components/mus/ws/server_window.h
+++ b/components/mus/ws/server_window.h
@@ -57,7 +57,7 @@
 
   void Add(ServerWindow* child);
   void Remove(ServerWindow* child);
-  void Reorder(ServerWindow* releative, mojom::OrderDirection diretion);
+  void Reorder(ServerWindow* relative, mojom::OrderDirection diretion);
   void StackChildAtBottom(ServerWindow* child);
   void StackChildAtTop(ServerWindow* child);
 
@@ -142,6 +142,10 @@
   // Called when this window's stacking order among its siblings is changed.
   void OnStackingChanged();
 
+  static void ReorderImpl(ServerWindow* window,
+                          ServerWindow* relative,
+                          mojom::OrderDirection diretion);
+
   // Returns a pointer to the stacking target that can be used by
   // RestackTransientDescendants.
   static ServerWindow** GetStackingTarget(ServerWindow* window);
diff --git a/components/offline_pages/offline_page_archiver.h b/components/offline_pages/offline_page_archiver.h
index 9cec07f4b..eec0f7c 100644
--- a/components/offline_pages/offline_page_archiver.h
+++ b/components/offline_pages/offline_page_archiver.h
@@ -62,9 +62,10 @@
 
   virtual ~OfflinePageArchiver() {}
 
-  // Starts creating the archive. Once archive is created |callback| will be
-  // called with the result and additional information.
-  virtual void CreateArchive(const CreateArchiveCallback& callback) = 0;
+  // Starts creating the archive in the |archives_dir|. Once archive is created
+  // |callback| will be called with the result and additional information.
+  virtual void CreateArchive(const base::FilePath& archives_dir,
+                             const CreateArchiveCallback& callback) = 0;
 };
 
 }  // namespace offline_pages
diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc
index be38e23..1453004 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -97,6 +97,10 @@
   }
 }
 
+void EnsureArchivesDirCreated(const base::FilePath& archives_dir) {
+  CHECK(base::CreateDirectory(archives_dir));
+}
+
 }  // namespace
 
 // static
@@ -106,14 +110,18 @@
 
 OfflinePageModel::OfflinePageModel(
     scoped_ptr<OfflinePageMetadataStore> store,
+    const base::FilePath& archives_dir,
     const scoped_refptr<base::SequencedTaskRunner>& task_runner)
     : store_(store.Pass()),
+      archives_dir_(archives_dir),
       is_loaded_(false),
       task_runner_(task_runner),
       scoped_observer_(this),
       weak_ptr_factory_(this) {
-  store_->Load(base::Bind(&OfflinePageModel::OnLoadDone,
-                          weak_ptr_factory_.GetWeakPtr()));
+  task_runner_->PostTaskAndReply(
+      FROM_HERE, base::Bind(EnsureArchivesDirCreated, archives_dir_),
+      base::Bind(&OfflinePageModel::OnEnsureArchivesDirCreatedDone,
+                 weak_ptr_factory_.GetWeakPtr()));
 }
 
 OfflinePageModel::~OfflinePageModel() {
@@ -149,7 +157,8 @@
   }
 
   DCHECK(archiver.get());
-  archiver->CreateArchive(base::Bind(&OfflinePageModel::OnCreateArchiveDone,
+  archiver->CreateArchive(archives_dir_,
+                          base::Bind(&OfflinePageModel::OnCreateArchiveDone,
                                      weak_ptr_factory_.GetWeakPtr(), url,
                                      bookmark_id, base::Time::Now(), callback));
   pending_archivers_.push_back(archiver.Pass());
@@ -463,6 +472,11 @@
   MarkPageForDeletion(node->id(), base::Bind(&EmptyDeleteCallback));
 }
 
+void OfflinePageModel::OnEnsureArchivesDirCreatedDone() {
+  store_->Load(base::Bind(&OfflinePageModel::OnLoadDone,
+                          weak_ptr_factory_.GetWeakPtr()));
+}
+
 void OfflinePageModel::OnLoadDone(
     OfflinePageMetadataStore::LoadStatus load_status,
     const std::vector<OfflinePageItem>& offline_pages) {
diff --git a/components/offline_pages/offline_page_model.h b/components/offline_pages/offline_page_model.h
index 577600cf..628de2a 100644
--- a/components/offline_pages/offline_page_model.h
+++ b/components/offline_pages/offline_page_model.h
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "base/callback.h"
+#include "base/files/file_path.h"
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
@@ -124,9 +125,9 @@
   static bool CanSavePage(const GURL& url);
 
   // All blocking calls/disk access will happen on the provided |task_runner|.
-  OfflinePageModel(
-      scoped_ptr<OfflinePageMetadataStore> store,
-      const scoped_refptr<base::SequencedTaskRunner>& task_runner);
+  OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> store,
+                   const base::FilePath& archives_dir,
+                   const scoped_refptr<base::SequencedTaskRunner>& task_runner);
   ~OfflinePageModel() override;
 
   // Starts the OfflinePageModel and registers it as a BookmarkModelObserver.
@@ -214,6 +215,9 @@
                            const bookmarks::BookmarkNode* node,
                            const std::set<GURL>& removed_urls) override;
 
+  // Callback for ensuring archive directory is created.
+  void OnEnsureArchivesDirCreatedDone();
+
   // Callback for loading pages from the offline page metadata store.
   void OnLoadDone(OfflinePageMetadataStore::LoadStatus load_status,
                   const std::vector<OfflinePageItem>& offline_pages);
@@ -281,6 +285,9 @@
   // Persistent store for offline page metadata.
   scoped_ptr<OfflinePageMetadataStore> store_;
 
+  // Location where all of the archive files will be stored.
+  base::FilePath archives_dir_;
+
   // The observers.
   base::ObserverList<Observer> observers_;
 
diff --git a/components/offline_pages/offline_page_model_unittest.cc b/components/offline_pages/offline_page_model_unittest.cc
index e9a5ac9..2da4fd0 100644
--- a/components/offline_pages/offline_page_model_unittest.cc
+++ b/components/offline_pages/offline_page_model_unittest.cc
@@ -158,13 +158,13 @@
   OfflinePageTestArchiver(
       OfflinePageModelTest* test,
       const GURL& url,
-      const base::FilePath& archiver_dir,
       ArchiverResult result,
       const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
   ~OfflinePageTestArchiver() override;
 
   // OfflinePageArchiver implementation:
-  void CreateArchive(const CreateArchiveCallback& callback) override;
+  void CreateArchive(const base::FilePath& archives_dir,
+                     const CreateArchiveCallback& callback) override;
 
   void CompleteCreateArchive();
 
@@ -175,7 +175,7 @@
  private:
   OfflinePageModelTest* test_;  // Outlive OfflinePageTestArchiver.
   GURL url_;
-  base::FilePath archiver_dir_;
+  base::FilePath archives_dir_;
   ArchiverResult result_;
   bool create_archive_called_;
   bool delayed_;
@@ -259,12 +259,10 @@
 OfflinePageTestArchiver::OfflinePageTestArchiver(
     OfflinePageModelTest* test,
     const GURL& url,
-    const base::FilePath& archiver_dir,
     ArchiverResult result,
     const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
     : test_(test),
       url_(url),
-      archiver_dir_(archiver_dir),
       result_(result),
       create_archive_called_(false),
       delayed_(false),
@@ -276,20 +274,22 @@
 }
 
 void OfflinePageTestArchiver::CreateArchive(
+    const base::FilePath& archives_dir,
     const CreateArchiveCallback& callback) {
   create_archive_called_ = true;
   callback_ = callback;
+  archives_dir_ = archives_dir;
   if (!delayed_)
     CompleteCreateArchive();
 }
 
 void OfflinePageTestArchiver::CompleteCreateArchive() {
   DCHECK(!callback_.is_null());
-  base::FilePath archiver_path;
-  ASSERT_TRUE(base::CreateTemporaryFileInDir(archiver_dir_, &archiver_path));
-  test_->set_last_archiver_path(archiver_path);
+  base::FilePath archive_path;
+  ASSERT_TRUE(base::CreateTemporaryFileInDir(archives_dir_, &archive_path));
+  test_->set_last_archiver_path(archive_path);
   task_runner_->PostTask(FROM_HERE, base::Bind(callback_, this, result_, url_,
-                                               archiver_path, kTestFileSize));
+                                               archive_path, kTestFileSize));
 }
 
 OfflinePageModelTest::OfflinePageModelTest()
@@ -344,8 +344,8 @@
 scoped_ptr<OfflinePageTestArchiver> OfflinePageModelTest::BuildArchiver(
     const GURL& url,
     OfflinePageArchiver::ArchiverResult result) {
-  return scoped_ptr<OfflinePageTestArchiver>(new OfflinePageTestArchiver(
-      this, url, temp_dir_.path(), result, task_runner()));
+  return scoped_ptr<OfflinePageTestArchiver>(
+      new OfflinePageTestArchiver(this, url, result, task_runner()));
 }
 
 scoped_ptr<OfflinePageMetadataStore> OfflinePageModelTest::BuildStore() {
@@ -356,7 +356,7 @@
 scoped_ptr<OfflinePageModel> OfflinePageModelTest::BuildModel(
     scoped_ptr<OfflinePageMetadataStore> store) {
   return scoped_ptr<OfflinePageModel>(
-      new OfflinePageModel(store.Pass(), task_runner()));
+      new OfflinePageModel(store.Pass(), temp_dir_.path(), task_runner()));
 }
 
 void OfflinePageModelTest::ResetModel() {
diff --git a/components/pdf_viewer/DEPS b/components/pdf_viewer/DEPS
index d6857afc..e85458b 100644
--- a/components/pdf_viewer/DEPS
+++ b/components/pdf_viewer/DEPS
@@ -9,6 +9,7 @@
   "+mojo/converters/surfaces",
   "+mojo/public",
   "+mojo/services/tracing/public/cpp",
+  "+third_party/mojo/src/mojo/public",
   "+third_party/pdfium/public",
   "+ui/gfx/geometry",
   "+ui/mojo",
diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc
index dcc5f93..bb983b71 100644
--- a/components/pdf_viewer/pdf_viewer.cc
+++ b/components/pdf_viewer/pdf_viewer.cc
@@ -26,9 +26,9 @@
 #include "mojo/application/public/interfaces/content_handler.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
 #include "mojo/common/data_pipe_utils.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 #include "third_party/pdfium/public/fpdf_ext.h"
 #include "third_party/pdfium/public/fpdfview.h"
 #include "ui/gfx/geometry/rect.h"
diff --git a/components/resources/OWNERS b/components/resources/OWNERS
index b11d144..8491925 100644
--- a/components/resources/OWNERS
+++ b/components/resources/OWNERS
@@ -6,8 +6,10 @@
 per-file crash_*=scottmg@chromium.org
 per-file crash_*=thestig@chromium.org
 per-file data_reduction_proxy*=bengr@chromium.org
-per-file data_reduction_proxy*=sclittle@chromium.org
+per-file data_reduction_proxy*=kundaji@chromium.org
 per-file data_reduction_proxy*=megjablon@chromium.org
+per-file data_reduction_proxy*=sclittle@chromium.org
+per-file data_reduction_proxy*=tbansal@chromium.org
 per-file dom_distiller*=mdjones@chromium.org
 per-file dom_distiller*=nyquist@chromium.org
 per-file proximity_auth*=isherman@chromium.org
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.cc b/components/startup_metric_utils/browser/startup_metric_utils.cc
index 122326e..3f414472 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.cc
+++ b/components/startup_metric_utils/browser/startup_metric_utils.cc
@@ -11,6 +11,7 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/sys_info.h"
+#include "base/threading/platform_thread.h"
 #include "base/trace_event/trace_event.h"
 
 #if defined(OS_WIN)
@@ -26,9 +27,15 @@
 // Note that at the time of this writing, access is only on the UI thread.
 volatile bool g_non_browser_ui_displayed = false;
 
-base::LazyInstance<base::Time>::Leaky g_process_creation_time =
+base::LazyInstance<base::TimeTicks>::Leaky g_process_creation_ticks =
     LAZY_INSTANCE_INITIALIZER;
 
+base::LazyInstance<base::TimeTicks>::Leaky g_main_entry_point_ticks =
+    LAZY_INSTANCE_INITIALIZER;
+
+// Only used by RecordMainEntryTimeHistogram(), should go away with it (do not
+// add new uses of this), see crbug.com/317481 for discussion on why it was kept
+// as-is for now.
 base::LazyInstance<base::Time>::Leaky g_main_entry_point_time =
     LAZY_INSTANCE_INITIALIZER;
 
@@ -176,19 +183,17 @@
     }                                                                      \
   }
 
-#define UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(type, basename,       \
-                                                         begin_time, end_time) \
-  {                                                                            \
-    UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename,                     \
-                                           end_time - begin_time)              \
-    TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(                                   \
-        "startup", basename, 0,                                                \
-        StartupTimeToTimeTicks(begin_time).ToInternalValue(), "Temperature",   \
-        g_startup_temperature);                                                \
-    TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1(                                     \
-        "startup", basename, 0,                                                \
-        StartupTimeToTimeTicks(end_time).ToInternalValue(), "Temperature",     \
-        g_startup_temperature);                                                \
+#define UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(                     \
+    type, basename, begin_ticks, end_ticks)                                   \
+  {                                                                           \
+    UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename,                    \
+                                           end_ticks - begin_ticks)           \
+    TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(                                  \
+        "startup", basename, 0, begin_ticks.ToInternalValue(), "Temperature", \
+        g_startup_temperature);                                               \
+    TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1(                                    \
+        "startup", basename, 0, end_ticks.ToInternalValue(), "Temperature",   \
+        g_startup_temperature);                                               \
   }
 
 // On Windows, records the number of hard-faults that have occurred in the
@@ -246,17 +251,42 @@
 }
 
 // Converts a base::Time value to a base::TimeTicks value. The conversion isn't
-// exact, but is within the time delta taken to synchronously resolve
-// base::Time::Now() and base::TimeTicks::Now() which in practice is pretty
-// much instant compared to multi-seconds startup timings.
-// TODO(gab): Find a precise way to do this (http://crbug.com/544131).
+// exact, but by capturing Time::Now() as early as possible, the likelihood of a
+// clock change between it and process start is as low as possible. There is
+// also the time taken to synchronously resolve base::Time::Now() and
+// base::TimeTicks::Now() at play, but in practice it is pretty much instant
+// compared to multi-seconds startup timings.
 base::TimeTicks StartupTimeToTimeTicks(const base::Time& time) {
   // First get a base which represents the same point in time in both units.
-  // The wall clock time it takes to gather both of these is the precision of
-  // this method.
+  // Bump the priority of this thread while doing this as the wall clock time it
+  // takes to resolve these two calls affects the precision of this method and
+  // bumping the priority reduces the likelihood of a context switch interfering
+  // with this computation.
+
+// platform_thread_mac.mm unfortunately doesn't properly support base's
+// thread priority APIs (crbug.com/554651).
+#if !defined(OS_MACOSX)
+  static bool statics_initialized = false;
+
+  base::ThreadPriority previous_priority = base::ThreadPriority::NORMAL;
+  if (!statics_initialized) {
+    previous_priority = base::PlatformThread::GetCurrentThreadPriority();
+    base::PlatformThread::SetCurrentThreadPriority(
+        base::ThreadPriority::DISPLAY);
+  }
+#endif
+
   static const base::Time time_base = base::Time::Now();
   static const base::TimeTicks trace_ticks_base = base::TimeTicks::Now();
 
+#if !defined(OS_MACOSX)
+  if (!statics_initialized) {
+    base::PlatformThread::SetCurrentThreadPriority(previous_priority);
+  }
+
+  statics_initialized = true;
+#endif
+
   // Then use the TimeDelta common ground between the two units to make the
   // conversion.
   const base::TimeDelta delta_since_base = time_base - time;
@@ -269,17 +299,17 @@
   const int kLowWordMask = 0xFFFFFFFF;
   const int kLower31BitsMask = 0x7FFFFFFF;
   DCHECK(!g_main_entry_point_time.Get().is_null());
-  base::TimeDelta browser_main_entry_time_absolute =
+  const base::TimeDelta browser_main_entry_time_absolute =
       g_main_entry_point_time.Get() - base::Time::UnixEpoch();
 
-  uint64 browser_main_entry_time_raw_ms =
+  const uint64 browser_main_entry_time_raw_ms =
       browser_main_entry_time_absolute.InMilliseconds();
 
-  base::TimeDelta browser_main_entry_time_raw_ms_high_word =
+  const base::TimeDelta browser_main_entry_time_raw_ms_high_word =
       base::TimeDelta::FromMilliseconds(
           (browser_main_entry_time_raw_ms >> 32) & kLowWordMask);
   // Shift by one because histograms only support non-negative values.
-  base::TimeDelta browser_main_entry_time_raw_ms_low_word =
+  const base::TimeDelta browser_main_entry_time_raw_ms_low_word =
       base::TimeDelta::FromMilliseconds(
           (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask);
 
@@ -291,19 +321,20 @@
 }
 
 // Environment variable that stores the timestamp when the executable's main()
-// function was entered.
-const char kChromeMainTimeEnvVar[] = "CHROME_MAIN_TIME";
+// function was entered in TimeTicks. This is required because chrome.exe and
+// chrome.dll don't share the same static storage.
+const char kChromeMainTicksEnvVar[] = "CHROME_MAIN_TICKS";
 
 // Returns the time of main entry recorded from RecordExeMainEntryTime.
-base::Time ExeMainEntryPointTime() {
+base::TimeTicks ExeMainEntryPointTicks() {
   scoped_ptr<base::Environment> env(base::Environment::Create());
-  std::string time_string;
+  std::string ticks_string;
   int64 time_int = 0;
-  if (env->GetVar(kChromeMainTimeEnvVar, &time_string) &&
-      base::StringToInt64(time_string, &time_int)) {
-    return base::Time::FromInternalValue(time_int);
+  if (env->GetVar(kChromeMainTicksEnvVar, &ticks_string) &&
+      base::StringToInt64(ticks_string, &time_int)) {
+    return base::TimeTicks::FromInternalValue(time_int);
   }
-  return base::Time();
+  return base::TimeTicks();
 }
 
 }  // namespace
@@ -317,33 +348,41 @@
 }
 
 void RecordStartupProcessCreationTime(const base::Time& time) {
-  DCHECK(g_process_creation_time.Get().is_null());
-  g_process_creation_time.Get() = time;
-  DCHECK(!g_process_creation_time.Get().is_null());
+  DCHECK(g_process_creation_ticks.Get().is_null());
+  g_process_creation_ticks.Get() = StartupTimeToTimeTicks(time);
+  DCHECK(!g_process_creation_ticks.Get().is_null());
 }
 
 void RecordMainEntryPointTime(const base::Time& time) {
+  DCHECK(g_main_entry_point_ticks.Get().is_null());
+  g_main_entry_point_ticks.Get() = StartupTimeToTimeTicks(time);
+  DCHECK(!g_main_entry_point_ticks.Get().is_null());
+
+  // TODO(jeremy): Remove this with RecordMainEntryTimeHistogram() when
+  // resolving crbug.com/317481.
   DCHECK(g_main_entry_point_time.Get().is_null());
   g_main_entry_point_time.Get() = time;
   DCHECK(!g_main_entry_point_time.Get().is_null());
 }
 
 void RecordExeMainEntryPointTime(const base::Time& time) {
-  std::string exe_load_time = base::Int64ToString(time.ToInternalValue());
+  const std::string exe_load_ticks =
+      base::Int64ToString(StartupTimeToTimeTicks(time).ToInternalValue());
   scoped_ptr<base::Environment> env(base::Environment::Create());
-  env->SetVar(kChromeMainTimeEnvVar, exe_load_time);
+  env->SetVar(kChromeMainTicksEnvVar, exe_load_ticks);
 }
 
-void RecordBrowserMainMessageLoopStart(const base::Time& time,
+void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
                                        bool is_first_run) {
   RecordHardFaultHistogram(is_first_run);
   RecordMainEntryTimeHistogram();
 
-  const base::Time& process_creation_time = g_process_creation_time.Get();
-  if (!is_first_run && !process_creation_time.is_null()) {
+  const base::TimeTicks& process_creation_ticks =
+      g_process_creation_ticks.Get();
+  if (!is_first_run && !process_creation_ticks.is_null()) {
     UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
         UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime",
-        process_creation_time, time);
+        process_creation_ticks, ticks);
   }
 
   // Bail if uptime < 7 minutes, to filter out cases where Chrome may have been
@@ -361,49 +400,49 @@
     UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
         UMA_HISTOGRAM_LONG_TIMES,
         "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun",
-        g_main_entry_point_time.Get(), time);
+        g_main_entry_point_ticks.Get(), ticks);
   } else {
     UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
         UMA_HISTOGRAM_LONG_TIMES,
         "Startup.BrowserMessageLoopStartTimeFromMainEntry",
-        g_main_entry_point_time.Get(), time);
+        g_main_entry_point_ticks.Get(), ticks);
   }
 
   // Record timings between process creation, the main() in the executable being
   // reached and the main() in the shared library being reached.
-  if (!process_creation_time.is_null()) {
-    const base::Time exe_main_time = ExeMainEntryPointTime();
-    if (!exe_main_time.is_null()) {
+  if (!process_creation_ticks.is_null()) {
+    const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks();
+    if (!exe_main_ticks.is_null()) {
       // Process create to chrome.exe:main().
       UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
           UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain",
-          process_creation_time, exe_main_time);
+          process_creation_ticks, exe_main_ticks);
 
       // chrome.exe:main() to chrome.dll:main().
       UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
           UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain",
-          exe_main_time, g_main_entry_point_time.Get());
+          exe_main_ticks, g_main_entry_point_ticks.Get());
 
       // Process create to chrome.dll:main(). Reported as a histogram only as
       // the other two events above are sufficient for tracing purposes.
       UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(
           UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain",
-          g_main_entry_point_time.Get() - process_creation_time);
+          g_main_entry_point_ticks.Get() - process_creation_ticks);
     }
   }
 }
 
-void RecordBrowserWindowDisplay(const base::Time& time) {
+void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES, "Startup.BrowserWindowDisplay",
-      g_process_creation_time.Get(), time);
+      g_process_creation_ticks.Get(), ticks);
 }
 
 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta) {
@@ -416,88 +455,91 @@
                                          "Startup.BrowserOpenTabs", delta);
 }
 
-void RecordFirstWebContentsMainFrameLoad(const base::Time& time) {
+void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad2",
-      g_process_creation_time.Get(), time);
+      g_process_creation_ticks.Get(), ticks);
 }
 
-void RecordDeprecatedFirstWebContentsMainFrameLoad(const base::Time& time) {
+void RecordDeprecatedFirstWebContentsMainFrameLoad(
+    const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad",
-      time - g_process_creation_time.Get());
+      ticks - g_process_creation_ticks.Get());
 }
 
-void RecordFirstWebContentsNonEmptyPaint(const base::Time& time) {
+void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.NonEmptyPaint2",
-      g_process_creation_time.Get(), time);
+      g_process_creation_ticks.Get(), ticks);
 }
 
-void RecordDeprecatedFirstWebContentsNonEmptyPaint(const base::Time& time) {
+void RecordDeprecatedFirstWebContentsNonEmptyPaint(
+    const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.NonEmptyPaint",
-      time - g_process_creation_time.Get());
+      ticks - g_process_creation_ticks.Get());
 }
 
-void RecordFirstWebContentsMainNavigationStart(const base::Time& time) {
+void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100,
       "Startup.FirstWebContents.MainNavigationStart",
-      g_process_creation_time.Get(), time);
+      g_process_creation_ticks.Get(), ticks);
 }
 
-void RecordFirstWebContentsMainNavigationFinished(const base::Time& time) {
+void RecordFirstWebContentsMainNavigationFinished(
+    const base::TimeTicks& ticks) {
   static bool is_first_call = true;
-  if (!is_first_call || time.is_null())
+  if (!is_first_call || ticks.is_null())
     return;
   is_first_call = false;
-  if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null())
+  if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
     return;
 
   UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
       UMA_HISTOGRAM_LONG_TIMES_100,
       "Startup.FirstWebContents.MainNavigationFinished",
-      g_process_creation_time.Get(), time);
+      g_process_creation_ticks.Get(), ticks);
 }
 
-base::Time MainEntryPointTime() {
-  return g_main_entry_point_time.Get();
+base::TimeTicks MainEntryPointTicks() {
+  return g_main_entry_point_ticks.Get();
 }
 
 StartupTemperature GetStartupTemperature() {
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.h b/components/startup_metric_utils/browser/startup_metric_utils.h
index b071321..2b2885f6 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.h
+++ b/components/startup_metric_utils/browser/startup_metric_utils.h
@@ -9,7 +9,11 @@
 
 #include "base/time/time.h"
 
-// Utility functions to support metric collection for browser startup.
+// Utility functions to support metric collection for browser startup. Timings
+// should use TimeTicks whenever possible. OS-provided timings are still
+// received as Time out of cross-platform support necessity but are converted to
+// TimeTicks as soon as possible in an attempt to reduce the potential skew
+// between the two basis. See crbug.com/544131 for reasoning.
 
 namespace startup_metric_utils {
 
@@ -59,43 +63,45 @@
 
 // Call this with the time recorded just before the message loop is started.
 // |is_first_run| - is the current launch part of a first run.
-void RecordBrowserMainMessageLoopStart(const base::Time& time,
+void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
                                        bool is_first_run);
 
 // Call this with the time when the first browser window became visible.
-void RecordBrowserWindowDisplay(const base::Time& time);
+void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
 
 // Call this with the time delta that the browser spent opening its tabs.
 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
 
 // Call this with the time when the first web contents loaded its main frame,
 // only if the first web contents was unimpended in its attempt to do so.
-void RecordFirstWebContentsMainFrameLoad(const base::Time& time);
+void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks);
 
 // Call this with the time when the first web contents loaded its main frame.
 // This records an old stat kept for comparison purposes until M49.
-void RecordDeprecatedFirstWebContentsMainFrameLoad(const base::Time& time);
+void RecordDeprecatedFirstWebContentsMainFrameLoad(
+    const base::TimeTicks& ticks);
 
 // Call this with the time when the first web contents had a non-empty paint,
 // only if the first web contents was unimpended in its attempt to do so.
-void RecordFirstWebContentsNonEmptyPaint(const base::Time& time);
+void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks);
 
 // Call this with the time when the first web contents had a non-empty paint.
 // This records an old stat kept for comparison purposes until M49.
-void RecordDeprecatedFirstWebContentsNonEmptyPaint(const base::Time& time);
+void RecordDeprecatedFirstWebContentsNonEmptyPaint(
+    const base::TimeTicks& ticks);
 
 // Call this with the time when the first web contents began navigating its main
 // frame.
-void RecordFirstWebContentsMainNavigationStart(const base::Time& time);
+void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks);
 
 // Call this with the time when the first web contents successfully committed
 // its navigation for the main frame.
-void RecordFirstWebContentsMainNavigationFinished(const base::Time& time);
+void RecordFirstWebContentsMainNavigationFinished(const base::TimeTicks& ticks);
 
-// Returns the time of main entry recorded from RecordMainEntryPointTime.
-// Returns a null Time if a value has not been recorded yet.
-// This method is expected to be called from the UI thread.
-base::Time MainEntryPointTime();
+// Returns the TimeTicks corresponding to main entry as recorded by
+// RecordMainEntryPointTime. Returns a null TimeTicks if a value has not been
+// recorded yet. This method is expected to be called from the UI thread.
+base::TimeTicks MainEntryPointTicks();
 
 // Returns the startup type. This is only currently supported on the Windows
 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.
diff --git a/components/test/data/data_reduction_proxy/OWNERS b/components/test/data/data_reduction_proxy/OWNERS
index 14b4308..132bd6e 100644
--- a/components/test/data/data_reduction_proxy/OWNERS
+++ b/components/test/data/data_reduction_proxy/OWNERS
@@ -1,5 +1,7 @@
 bengr@chromium.org
-marq@chromium.org
 bolian@chromium.org
+kundaji@chromium.org
+marq@chromium.org
+megjablon@chromium.org
 sclittle@chromium.org
-megjablon@chromium.org
\ No newline at end of file
+tbansal@chromium.org
\ No newline at end of file
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc
index 537f6e8..5d08734 100644
--- a/components/tracing/child_trace_message_filter.cc
+++ b/components/tracing/child_trace_message_filter.cc
@@ -46,8 +46,8 @@
     IPC_MESSAGE_HANDLER(TracingMsg_BeginTracing, OnBeginTracing)
     IPC_MESSAGE_HANDLER(TracingMsg_EndTracing, OnEndTracing)
     IPC_MESSAGE_HANDLER(TracingMsg_CancelTracing, OnCancelTracing)
-    IPC_MESSAGE_HANDLER(TracingMsg_EnableMonitoring, OnEnableMonitoring)
-    IPC_MESSAGE_HANDLER(TracingMsg_DisableMonitoring, OnDisableMonitoring)
+    IPC_MESSAGE_HANDLER(TracingMsg_StartMonitoring, OnStartMonitoring)
+    IPC_MESSAGE_HANDLER(TracingMsg_StopMonitoring, OnStopMonitoring)
     IPC_MESSAGE_HANDLER(TracingMsg_CaptureMonitoringSnapshot,
                         OnCaptureMonitoringSnapshot)
     IPC_MESSAGE_HANDLER(TracingMsg_GetTraceLogStatus, OnGetTraceLogStatus)
@@ -103,14 +103,14 @@
       base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this));
 }
 
-void ChildTraceMessageFilter::OnEnableMonitoring(
+void ChildTraceMessageFilter::OnStartMonitoring(
     const std::string& trace_config_str, base::TimeTicks browser_time) {
   TraceLog::GetInstance()->SetEnabled(
       base::trace_event::TraceConfig(trace_config_str),
       base::trace_event::TraceLog::MONITORING_MODE);
 }
 
-void ChildTraceMessageFilter::OnDisableMonitoring() {
+void ChildTraceMessageFilter::OnStopMonitoring() {
   TraceLog::GetInstance()->SetDisabled();
 }
 
diff --git a/components/tracing/child_trace_message_filter.h b/components/tracing/child_trace_message_filter.h
index dff2648d..9f7755c 100644
--- a/components/tracing/child_trace_message_filter.h
+++ b/components/tracing/child_trace_message_filter.h
@@ -48,9 +48,9 @@
                       uint64 tracing_process_id);
   void OnEndTracing();
   void OnCancelTracing();
-  void OnEnableMonitoring(const std::string& trace_config_str,
+  void OnStartMonitoring(const std::string& trace_config_str,
                           base::TimeTicks browser_time);
-  void OnDisableMonitoring();
+  void OnStopMonitoring();
   void OnCaptureMonitoringSnapshot();
   void OnGetTraceLogStatus();
   void OnSetWatchEvent(const std::string& category_name,
diff --git a/components/tracing/tracing_messages.h b/components/tracing/tracing_messages.h
index 658972fb..26dd9d19 100644
--- a/components/tracing/tracing_messages.h
+++ b/components/tracing/tracing_messages.h
@@ -56,12 +56,12 @@
 IPC_MESSAGE_CONTROL0(TracingMsg_CancelTracing)
 
 // Sent to all child processes to start monitoring.
-IPC_MESSAGE_CONTROL2(TracingMsg_EnableMonitoring,
+IPC_MESSAGE_CONTROL2(TracingMsg_StartMonitoring,
                      std::string /*  trace_config_str */,
                      base::TimeTicks /* browser_time */)
 
 // Sent to all child processes to stop monitoring.
-IPC_MESSAGE_CONTROL0(TracingMsg_DisableMonitoring)
+IPC_MESSAGE_CONTROL0(TracingMsg_StopMonitoring)
 
 // Sent to all child processes to capture the current monitorint snapshot.
 IPC_MESSAGE_CONTROL0(TracingMsg_CaptureMonitoringSnapshot)
diff --git a/components/web_view/test_runner/launcher.cc b/components/web_view/test_runner/launcher.cc
index b9eda93..115835b 100644
--- a/components/web_view/test_runner/launcher.cc
+++ b/components/web_view/test_runner/launcher.cc
@@ -13,14 +13,14 @@
 namespace web_view {
 
 int LaunchTestRunner(int argc, char** argv) {
-  base::FilePath shell_dir;
-  PathService::Get(base::DIR_MODULE, &shell_dir);
   // We want the runner::Context to outlive the MessageLoop so that pipes are
   // all gracefully closed / error-out before we try to shut the Context down.
-  mojo::runner::Context shell_context(shell_dir, nullptr);
+  mojo::runner::Context shell_context;
   {
     base::MessageLoop message_loop;
-    if (!shell_context.Init()) {
+    base::FilePath shell_dir;
+    PathService::Get(base::DIR_MODULE, &shell_dir);
+    if (!shell_context.Init(shell_dir)) {
       return 0;
     }
 
diff --git a/content/browser/android/browser_jni_registrar.cc b/content/browser/android/browser_jni_registrar.cc
index d8bed79..7e91117 100644
--- a/content/browser/android/browser_jni_registrar.cc
+++ b/content/browser/android/browser_jni_registrar.cc
@@ -9,7 +9,6 @@
 #include "content/browser/android/browser_startup_controller.h"
 #include "content/browser/android/child_process_launcher_android.h"
 #include "content/browser/android/content_video_view.h"
-#include "content/browser/media/android/media_drm_credential_manager.h"
 #include "content/browser/media/android/media_resource_getter_impl.h"
 #include "content/browser/media/android/media_session.h"
 #include "content/browser/mojo/service_registrar_android.h"
@@ -52,8 +51,6 @@
     {"ChildProcessLauncher", content::RegisterChildProcessLauncher},
     {"ContentVideoView", content::ContentVideoView::RegisterContentVideoView},
     {"CoreImpl", mojo::android::RegisterCoreImpl},
-    {"MediaDrmCredentialManager",
-     content::MediaDrmCredentialManager::RegisterMediaDrmCredentialManager},
     {"MediaResourceGetterImpl",
      content::MediaResourceGetterImpl::RegisterMediaResourceGetter},
     {"MediaSession", content::MediaSession::RegisterMediaSession},
diff --git a/content/browser/android/tracing_controller_android.cc b/content/browser/android/tracing_controller_android.cc
index 0aeeda7b..b75914db 100644
--- a/content/browser/android/tracing_controller_android.cc
+++ b/content/browser/android/tracing_controller_android.cc
@@ -41,9 +41,9 @@
   // This log is required by adb_profile_chrome.py.
   LOG(WARNING) << "Logging performance trace to file";
 
-  return TracingController::GetInstance()->EnableRecording(
+  return TracingController::GetInstance()->StartTracing(
       base::trace_event::TraceConfig(categories, options),
-      TracingController::EnableRecordingDoneCallback());
+      TracingController::StartTracingDoneCallback());
 }
 
 void TracingControllerAndroid::StopTracing(JNIEnv* env,
@@ -51,7 +51,7 @@
                                            jstring jfilepath) {
   base::FilePath file_path(
       base::android::ConvertJavaStringToUTF8(env, jfilepath));
-  if (!TracingController::GetInstance()->DisableRecording(
+  if (!TracingController::GetInstance()->StopTracing(
           TracingController::CreateFileSink(
               file_path,
               base::Bind(&TracingControllerAndroid::OnTracingStopped,
diff --git a/content/browser/background_sync/background_sync_service_impl_unittest.cc b/content/browser/background_sync/background_sync_service_impl_unittest.cc
index 916c4cb..f93c348 100644
--- a/content/browser/background_sync/background_sync_service_impl_unittest.cc
+++ b/content/browser/background_sync/background_sync_service_impl_unittest.cc
@@ -16,9 +16,9 @@
 #include "content/browser/service_worker/service_worker_context_wrapper.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/test_browser_thread_bundle.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
 #include "net/base/network_change_notifier.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
 
 namespace content {
 
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 94dd29d5..8566b99 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -374,12 +374,7 @@
   void DidProcessTask(const base::PendingTask& pending_task) override {
 #if !defined(OS_IOS)  // No ProcessMetrics on IOS.
     scoped_ptr<base::ProcessMetrics> process_metrics(
-        base::ProcessMetrics::CreateProcessMetrics(
-#if defined(OS_MACOSX)
-            base::GetCurrentProcessHandle(), NULL));
-#else
-            base::GetCurrentProcessHandle()));
-#endif
+        base::ProcessMetrics::CreateCurrentProcessMetrics());
     size_t private_bytes;
     process_metrics->GetMemoryBytes(&private_bytes, NULL);
     LOCAL_HISTOGRAM_MEMORY_KB("Memory.BrowserUsed", private_bytes >> 10);
@@ -1433,7 +1428,7 @@
   DCHECK(is_tracing_startup_for_duration_);
 
   is_tracing_startup_for_duration_ = false;
-  TracingController::GetInstance()->DisableRecording(
+  TracingController::GetInstance()->StopTracing(
       TracingController::CreateFileSink(
           startup_trace_file_,
           base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc
index 63200ca7..ebbad1c 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -262,7 +262,7 @@
             new BrowserShutdownProfileDumper(main_loop_->startup_trace_file()));
       }
     } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled() &&
-               TracingController::GetInstance()->IsRecording()) {
+               TracingController::GetInstance()->IsTracing()) {
       base::FilePath result_file;
 #if defined(OS_ANDROID) && !defined(USE_AURA)
       TracingControllerAndroid::GenerateTracingFilePath(&result_file);
diff --git a/content/browser/compositor/software_output_device_win.cc b/content/browser/compositor/software_output_device_win.cc
index 7f3df87..b4a41ee 100644
--- a/content/browser/compositor/software_output_device_win.cc
+++ b/content/browser/compositor/software_output_device_win.cc
@@ -4,7 +4,9 @@
 
 #include "content/browser/compositor/software_output_device_win.h"
 
+#include "base/debug/alias.h"
 #include "base/memory/shared_memory.h"
+#include "cc/resources/shared_bitmap.h"
 #include "content/public/browser/browser_thread.h"
 #include "skia/ext/platform_canvas.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -15,6 +17,10 @@
 
 namespace content {
 
+// If a window is larger than this in bytes, don't even try to create a
+// backing bitmap for it.
+static const size_t kMaxBitmapSizeBytes = 4 * (16384 * 8192);
+
 OutputDeviceBacking::OutputDeviceBacking() : created_byte_size_(0) {
 }
 
@@ -46,12 +52,21 @@
   Resized();
 }
 
-base::SharedMemory* OutputDeviceBacking::GetSharedMemory() {
+base::SharedMemory* OutputDeviceBacking::GetSharedMemory(
+    const gfx::Size& size) {
   if (backing_)
     return backing_.get();
-  created_byte_size_ = GetMaxByteSize();
+  size_t expected_byte_size = GetMaxByteSize();
+  size_t required_size;
+  if (!cc::SharedBitmap::SizeInBytes(size, &required_size))
+    return nullptr;
+  if (required_size > expected_byte_size)
+    return nullptr;
+
+  created_byte_size_ = expected_byte_size;
 
   backing_.reset(new base::SharedMemory);
+  base::debug::Alias(&expected_byte_size);
   CHECK(backing_->CreateAnonymous(created_byte_size_));
   return backing_.get();
 }
@@ -60,9 +75,13 @@
   // Minimum byte size is 1 because creating a 0-byte-long SharedMemory fails.
   size_t max_size = 1;
   for (const SoftwareOutputDeviceWin* device : devices_) {
-    max_size = std::max(
-        max_size,
-        static_cast<size_t>(device->viewport_pixel_size().GetArea() * 4));
+    size_t current_size;
+    if (!cc::SharedBitmap::SizeInBytes(device->viewport_pixel_size(),
+                                       &current_size))
+      continue;
+    if (current_size > kMaxBitmapSizeBytes)
+      continue;
+    max_size = std::max(max_size, current_size);
   }
   return max_size;
 }
@@ -113,11 +132,21 @@
   DCHECK(!in_paint_);
   if (!contents_) {
     HANDLE shared_section = NULL;
-    if (backing_)
-      shared_section = backing_->GetSharedMemory()->handle().GetHandle();
-    contents_ = skia::AdoptRef(skia::CreatePlatformCanvas(
-        viewport_pixel_size_.width(), viewport_pixel_size_.height(), true,
-        shared_section, skia::CRASH_ON_FAILURE));
+    bool can_create_contents = true;
+    if (backing_) {
+      base::SharedMemory* memory =
+          backing_->GetSharedMemory(viewport_pixel_size_);
+      if (memory) {
+        shared_section = memory->handle().GetHandle();
+      } else {
+        can_create_contents = false;
+      }
+    }
+    if (can_create_contents) {
+      contents_ = skia::AdoptRef(skia::CreatePlatformCanvas(
+          viewport_pixel_size_.width(), viewport_pixel_size_.height(), true,
+          shared_section, skia::CRASH_ON_FAILURE));
+    }
   }
 
   damage_rect_ = damage_rect;
@@ -127,12 +156,14 @@
 
 void SoftwareOutputDeviceWin::EndPaint() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
-  DCHECK(contents_);
   DCHECK(in_paint_);
 
   in_paint_ = false;
   SoftwareOutputDevice::EndPaint();
 
+  if (!contents_)
+    return;
+
   gfx::Rect rect = damage_rect_;
   rect.Intersect(gfx::Rect(viewport_pixel_size_));
   if (rect.IsEmpty())
diff --git a/content/browser/compositor/software_output_device_win.h b/content/browser/compositor/software_output_device_win.h
index 3f444ae..65de1c4 100644
--- a/content/browser/compositor/software_output_device_win.h
+++ b/content/browser/compositor/software_output_device_win.h
@@ -31,7 +31,7 @@
   void Resized();
   void RegisterOutputDevice(SoftwareOutputDeviceWin* device);
   void UnregisterOutputDevice(SoftwareOutputDeviceWin* device);
-  base::SharedMemory* GetSharedMemory();
+  base::SharedMemory* GetSharedMemory(const gfx::Size& size);
 
  private:
   size_t GetMaxByteSize();
diff --git a/content/browser/devtools/protocol/tracing_handler.cc b/content/browser/devtools/protocol/tracing_handler.cc
index 2428041..2fd8e4b 100644
--- a/content/browser/devtools/protocol/tracing_handler.cc
+++ b/content/browser/devtools/protocol/tracing_handler.cc
@@ -101,7 +101,7 @@
 
 void TracingHandler::Detached() {
   if (did_initiate_recording_)
-    DisableRecording(scoped_refptr<TracingController::TraceDataSink>());
+    StopTracing(scoped_refptr<TracingController::TraceDataSink>());
 }
 
 void TracingHandler::OnTraceDataCollected(const std::string& trace_fragment) {
@@ -130,7 +130,7 @@
                                const std::string* options,
                                const double* buffer_usage_reporting_interval,
                                const std::string* transfer_mode) {
-  if (IsRecording())
+  if (IsTracing())
     return Response::InternalError("Tracing is already started");
 
   did_initiate_recording_ = true;
@@ -145,13 +145,13 @@
   // If inspected target is a render process Tracing.start will be handled by
   // tracing agent in the renderer.
   if (target_ == Renderer) {
-    TracingController::GetInstance()->EnableRecording(
+    TracingController::GetInstance()->StartTracing(
         trace_config,
-        TracingController::EnableRecordingDoneCallback());
+        TracingController::StartTracingDoneCallback());
     return Response::FallThrough();
   }
 
-  TracingController::GetInstance()->EnableRecording(
+  TracingController::GetInstance()->StartTracing(
       trace_config,
       base::Bind(&TracingHandler::OnRecordingEnabled,
                  weak_factory_.GetWeakPtr(),
@@ -173,7 +173,7 @@
   } else {
     proxy = new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr());
   }
-  DisableRecording(proxy);
+  StopTracing(proxy);
   // If inspected target is a render process Tracing.end will be handled by
   // tracing agent in the renderer.
   return target_ == Renderer ? Response::FallThrough() : Response::OK();
@@ -212,7 +212,7 @@
 }
 
 Response TracingHandler::RequestMemoryDump(DevToolsCommandId command_id) {
-  if (!IsRecording())
+  if (!IsTracing())
     return Response::InternalError("Tracing is not started");
 
   base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump(
@@ -251,20 +251,20 @@
   buffer_usage_poll_timer_->Reset();
 }
 
-void TracingHandler::DisableRecording(
+void TracingHandler::StopTracing(
     const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink) {
   buffer_usage_poll_timer_.reset();
-  TracingController::GetInstance()->DisableRecording(trace_data_sink);
+  TracingController::GetInstance()->StopTracing(trace_data_sink);
   did_initiate_recording_ = false;
 }
 
-bool TracingHandler::IsRecording() const {
-  return TracingController::GetInstance()->IsRecording();
+bool TracingHandler::IsTracing() const {
+  return TracingController::GetInstance()->IsTracing();
 }
 
 bool TracingHandler::IsStartupTracingActive() {
   return ::tracing::TraceConfigFile::GetInstance()->IsEnabled() &&
-      TracingController::GetInstance()->IsRecording();
+      TracingController::GetInstance()->IsTracing();
 }
 
 }  // namespace tracing
diff --git a/content/browser/devtools/protocol/tracing_handler.h b/content/browser/devtools/protocol/tracing_handler.h
index 8860670..9e00f63 100644
--- a/content/browser/devtools/protocol/tracing_handler.h
+++ b/content/browser/devtools/protocol/tracing_handler.h
@@ -62,9 +62,9 @@
                             bool success);
 
   void SetupTimer(double usage_reporting_interval);
-  void DisableRecording(
+  void StopTracing(
       const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink);
-  bool IsRecording() const;
+  bool IsTracing() const;
   static bool IsStartupTracingActive();
 
   scoped_ptr<base::Timer> buffer_usage_poll_timer_;
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 5b766ce..2253381 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -443,6 +443,21 @@
     }
   }
 
+  // This message map is for handling internal IPC messages which should not
+  // be dispatched to other objects.
+  bool handled = true;
+  IPC_BEGIN_MESSAGE_MAP(RenderFrameHostImpl, msg)
+    // This message is synthetic and doesn't come from RenderFrame, but from
+    // RenderProcessHost.
+    IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
+    IPC_MESSAGE_UNHANDLED(handled = false)
+  IPC_END_MESSAGE_MAP()
+
+  // Internal IPCs should not be leaked outside of this object, so return
+  // early.
+  if (handled)
+    return true;
+
   if (delegate_->OnMessageReceived(this, msg))
     return true;
 
@@ -452,7 +467,7 @@
       proxy->cross_process_frame_connector()->OnMessageReceived(msg))
     return true;
 
-  bool handled = true;
+  handled = true;
   IPC_BEGIN_MESSAGE_MAP(RenderFrameHostImpl, msg)
     IPC_MESSAGE_HANDLER(FrameHostMsg_AddMessageToConsole, OnAddMessageToConsole)
     IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach)
@@ -505,9 +520,6 @@
     IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse,
                         OnAccessibilitySnapshotResponse)
     IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen)
-    // The following message is synthetic and doesn't come from RenderFrame, but
-    // from RenderProcessHost.
-    IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
     IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)
     IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)
     IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress,
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc
index f1b4d0a..c3904dd 100644
--- a/content/browser/presentation/presentation_service_impl_unittest.cc
+++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -18,9 +18,9 @@
 #include "content/test/test_render_frame_host.h"
 #include "content/test/test_render_view_host.h"
 #include "content/test/test_web_contents.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/string.h"
 #include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 using ::testing::_;
 using ::testing::Eq;
diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc
index 0b9431d..973dc0f 100644
--- a/content/browser/tracing/background_tracing_manager_impl.cc
+++ b/content/browser/tracing/background_tracing_manager_impl.cc
@@ -179,7 +179,7 @@
     }
   }
 
-  EnableRecordingIfConfigNeedsIt();
+  StartTracingIfConfigNeedsIt();
 
   RecordBackgroundTracingMetric(SCENARIO_ACTIVATED_SUCCESSFULLY);
   return true;
@@ -203,12 +203,12 @@
   }
 }
 
-void BackgroundTracingManagerImpl::EnableRecordingIfConfigNeedsIt() {
+void BackgroundTracingManagerImpl::StartTracingIfConfigNeedsIt() {
   if (!config_)
     return;
 
   if (config_->tracing_mode() == BackgroundTracingConfigImpl::PREEMPTIVE) {
-    EnableRecording(
+    StartTracing(
         GetCategoryFilterStringForCategoryPreset(config_->category_preset()),
         base::trace_event::RECORD_CONTINUOUSLY);
   }
@@ -311,7 +311,7 @@
 
     if (!is_tracing_) {
       // It was not already tracing, start a new trace.
-      EnableRecording(GetCategoryFilterStringForCategoryPreset(
+      StartTracing(GetCategoryFilterStringForCategoryPreset(
                           triggered_rule->GetCategoryPreset()),
                       base::trace_event::RECORD_UNTIL_FULL);
     } else {
@@ -385,14 +385,14 @@
   tracing_timer_->FireTimerForTesting();
 }
 
-void BackgroundTracingManagerImpl::EnableRecording(
+void BackgroundTracingManagerImpl::StartTracing(
     std::string category_filter_str,
     base::trace_event::TraceRecordMode record_mode) {
   base::trace_event::TraceConfig trace_config(category_filter_str, record_mode);
   if (requires_anonymized_data_)
     trace_config.EnableArgumentFilter();
 
-  is_tracing_ = TracingController::GetInstance()->EnableRecording(
+  is_tracing_ = TracingController::GetInstance()->StartTracing(
       trace_config, tracing_enabled_callback_for_testing_);
   RecordBackgroundTracingMetric(RECORDING_ENABLED);
 }
@@ -435,7 +435,7 @@
   if (!delegate_ ||
       delegate_->IsAllowedToBeginBackgroundScenario(
           *config_.get(), requires_anonymized_data_)) {
-    EnableRecordingIfConfigNeedsIt();
+    StartTracingIfConfigNeedsIt();
   } else {
     AbortScenario();
   }
@@ -478,7 +478,7 @@
     RecordBackgroundTracingMetric(FINALIZATION_DISALLOWED);
   }
 
-  content::TracingController::GetInstance()->DisableRecording(trace_data_sink);
+  content::TracingController::GetInstance()->StopTracing(trace_data_sink);
 
   if (!callback.is_null())
     callback.Run(is_allowed_finalization);
@@ -490,7 +490,7 @@
   config_.reset();
   tracing_timer_.reset();
 
-  content::TracingController::GetInstance()->DisableRecording(nullptr);
+  content::TracingController::GetInstance()->StopTracing(nullptr);
 }
 
 std::string
diff --git a/content/browser/tracing/background_tracing_manager_impl.h b/content/browser/tracing/background_tracing_manager_impl.h
index c46711c..0ce491a 100644
--- a/content/browser/tracing/background_tracing_manager_impl.h
+++ b/content/browser/tracing/background_tracing_manager_impl.h
@@ -52,8 +52,8 @@
   BackgroundTracingManagerImpl();
   ~BackgroundTracingManagerImpl() override;
 
-  void EnableRecording(std::string, base::trace_event::TraceRecordMode);
-  void EnableRecordingIfConfigNeedsIt();
+  void StartTracing(std::string, base::trace_event::TraceRecordMode);
+  void StartTracingIfConfigNeedsIt();
   void OnFinalizeStarted(
       scoped_ptr<const base::DictionaryValue> metadata,
       base::RefCountedString*);
diff --git a/content/browser/tracing/memory_tracing_browsertest.cc b/content/browser/tracing/memory_tracing_browsertest.cc
index 64519ac..3d5769e 100644
--- a/content/browser/tracing/memory_tracing_browsertest.cc
+++ b/content/browser/tracing/memory_tracing_browsertest.cc
@@ -92,14 +92,14 @@
             GetTraceConfig_EmptyTriggers());
 
     base::RunLoop run_loop;
-    bool success = TracingController::GetInstance()->EnableRecording(
+    bool success = TracingController::GetInstance()->StartTracing(
       trace_config, run_loop.QuitClosure());
     EXPECT_TRUE(success);
     run_loop.Run();
   }
 
   void DisableTracing() {
-    bool success = TracingController::GetInstance()->DisableRecording(NULL);
+    bool success = TracingController::GetInstance()->StopTracing(NULL);
     EXPECT_TRUE(success);
     base::RunLoop().RunUntilIdle();
   }
diff --git a/content/browser/tracing/trace_message_filter.cc b/content/browser/tracing/trace_message_filter.cc
index f608ea8..ffc129c 100644
--- a/content/browser/tracing/trace_message_filter.cc
+++ b/content/browser/tracing/trace_message_filter.cc
@@ -90,16 +90,16 @@
   Send(new TracingMsg_CancelTracing);
 }
 
-void TraceMessageFilter::SendEnableMonitoring(
+void TraceMessageFilter::SendStartMonitoring(
       const base::trace_event::TraceConfig& trace_config) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
-  Send(new TracingMsg_EnableMonitoring(trace_config.ToString(),
+  Send(new TracingMsg_StartMonitoring(trace_config.ToString(),
                                        base::TimeTicks::Now()));
 }
 
-void TraceMessageFilter::SendDisableMonitoring() {
+void TraceMessageFilter::SendStopMonitoring() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
-  Send(new TracingMsg_DisableMonitoring);
+  Send(new TracingMsg_StopMonitoring);
 }
 
 void TraceMessageFilter::SendCaptureMonitoringSnapshot() {
@@ -148,7 +148,7 @@
   // child process is compromised.
   if (is_awaiting_end_ack_) {
     is_awaiting_end_ack_ = false;
-    TracingControllerImpl::GetInstance()->OnDisableRecordingAcked(
+    TracingControllerImpl::GetInstance()->OnStopTracingAcked(
         this, known_categories);
   } else {
     NOTREACHED();
diff --git a/content/browser/tracing/trace_message_filter.h b/content/browser/tracing/trace_message_filter.h
index 3bc97c7..63a5129 100644
--- a/content/browser/tracing/trace_message_filter.h
+++ b/content/browser/tracing/trace_message_filter.h
@@ -29,9 +29,9 @@
       const base::trace_event::TraceConfig& trace_config);
   void SendEndTracing();
   void SendCancelTracing();
-  void SendEnableMonitoring(
+  void SendStartMonitoring(
       const base::trace_event::TraceConfig& trace_config);
-  void SendDisableMonitoring();
+  void SendStopMonitoring();
   void SendCaptureMonitoringSnapshot();
   void SendGetTraceLogStatus();
   void SendSetWatchEvent(const std::string& category_name,
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc
index 8cfa55b..3da54e8 100644
--- a/content/browser/tracing/tracing_controller_browsertest.cc
+++ b/content/browser/tracing/tracing_controller_browsertest.cc
@@ -80,12 +80,12 @@
     quit_callback.Run();
   }
 
-  void EnableRecordingDoneCallbackTest(base::Closure quit_callback) {
+  void StartTracingDoneCallbackTest(base::Closure quit_callback) {
     enable_recording_done_callback_count_++;
     quit_callback.Run();
   }
 
-  void DisableRecordingStringDoneCallbackTest(
+  void StopTracingStringDoneCallbackTest(
       base::Closure quit_callback,
       scoped_ptr<const base::DictionaryValue> metadata,
       base::RefCountedString* data) {
@@ -95,7 +95,7 @@
     quit_callback.Run();
   }
 
-  void DisableRecordingFileDoneCallbackTest(base::Closure quit_callback,
+  void StopTracingFileDoneCallbackTest(base::Closure quit_callback,
                                             const base::FilePath& file_path) {
     disable_recording_done_callback_count_++;
     EXPECT_TRUE(PathExists(file_path));
@@ -106,12 +106,12 @@
     last_actual_recording_file_path_ = file_path;
   }
 
-  void EnableMonitoringDoneCallbackTest(base::Closure quit_callback) {
+  void StartMonitoringDoneCallbackTest(base::Closure quit_callback) {
     enable_monitoring_done_callback_count_++;
     quit_callback.Run();
   }
 
-  void DisableMonitoringDoneCallbackTest(base::Closure quit_callback) {
+  void StopMonitoringDoneCallbackTest(base::Closure quit_callback) {
     disable_monitoring_done_callback_count_++;
     quit_callback.Run();
   }
@@ -163,18 +163,18 @@
     return last_metadata_.get();
   }
 
-  void TestEnableAndDisableRecordingString() {
+  void TestStartAndStopTracingString() {
     Navigate(shell());
 
     TracingController* controller = TracingController::GetInstance();
 
     {
       base::RunLoop run_loop;
-      TracingController::EnableRecordingDoneCallback callback =
-          base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest,
+      TracingController::StartTracingDoneCallback callback =
+          base::Bind(&TracingControllerTest::StartTracingDoneCallbackTest,
                      base::Unretained(this),
                      run_loop.QuitClosure());
-      bool result = controller->EnableRecording(
+      bool result = controller->StartTracing(
           TraceConfig(), callback);
       ASSERT_TRUE(result);
       run_loop.Run();
@@ -185,10 +185,10 @@
       base::RunLoop run_loop;
       base::Callback<void(scoped_ptr<const base::DictionaryValue>,
                           base::RefCountedString*)> callback = base::Bind(
-          &TracingControllerTest::DisableRecordingStringDoneCallbackTest,
+          &TracingControllerTest::StopTracingStringDoneCallbackTest,
           base::Unretained(this),
           run_loop.QuitClosure());
-      bool result = controller->DisableRecording(
+      bool result = controller->StopTracing(
           TracingController::CreateStringSink(callback));
       ASSERT_TRUE(result);
       run_loop.Run();
@@ -196,17 +196,17 @@
     }
   }
 
-  void TestEnableAndDisableRecordingCompressed() {
+  void TestStartAndStopTracingCompressed() {
     Navigate(shell());
 
     TracingController* controller = TracingController::GetInstance();
 
     {
       base::RunLoop run_loop;
-      TracingController::EnableRecordingDoneCallback callback =
-          base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest,
+      TracingController::StartTracingDoneCallback callback =
+          base::Bind(&TracingControllerTest::StartTracingDoneCallbackTest,
                      base::Unretained(this), run_loop.QuitClosure());
-      bool result = controller->EnableRecording(TraceConfig(), callback);
+      bool result = controller->StartTracing(TraceConfig(), callback);
       ASSERT_TRUE(result);
       run_loop.Run();
       EXPECT_EQ(enable_recording_done_callback_count(), 1);
@@ -216,9 +216,9 @@
       base::RunLoop run_loop;
       base::Callback<void(scoped_ptr<const base::DictionaryValue>,
                           base::RefCountedString*)> callback = base::Bind(
-          &TracingControllerTest::DisableRecordingStringDoneCallbackTest,
+          &TracingControllerTest::StopTracingStringDoneCallbackTest,
           base::Unretained(this), run_loop.QuitClosure());
-      bool result = controller->DisableRecording(
+      bool result = controller->StopTracing(
           TracingController::CreateCompressedStringSink(
               new TracingControllerTestEndpoint(callback)));
       ASSERT_TRUE(result);
@@ -227,7 +227,7 @@
     }
   }
 
-  void TestEnableAndDisableRecordingCompressedFile(
+  void TestStartAndStopTracingCompressedFile(
       const base::FilePath& result_file_path) {
     Navigate(shell());
 
@@ -235,10 +235,10 @@
 
     {
       base::RunLoop run_loop;
-      TracingController::EnableRecordingDoneCallback callback =
-          base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest,
+      TracingController::StartTracingDoneCallback callback =
+          base::Bind(&TracingControllerTest::StartTracingDoneCallbackTest,
                      base::Unretained(this), run_loop.QuitClosure());
-      bool result = controller->EnableRecording(TraceConfig(), callback);
+      bool result = controller->StartTracing(TraceConfig(), callback);
       ASSERT_TRUE(result);
       run_loop.Run();
       EXPECT_EQ(enable_recording_done_callback_count(), 1);
@@ -247,9 +247,9 @@
     {
       base::RunLoop run_loop;
       base::Closure callback = base::Bind(
-          &TracingControllerTest::DisableRecordingFileDoneCallbackTest,
+          &TracingControllerTest::StopTracingFileDoneCallbackTest,
           base::Unretained(this), run_loop.QuitClosure(), result_file_path);
-      bool result = controller->DisableRecording(
+      bool result = controller->StopTracing(
           TracingController::CreateCompressedStringSink(
               TracingController::CreateFileEndpoint(result_file_path,
                                                     callback)));
@@ -259,7 +259,7 @@
     }
   }
 
-  void TestEnableAndDisableRecordingFile(
+  void TestStartAndStopTracingFile(
       const base::FilePath& result_file_path) {
     Navigate(shell());
 
@@ -267,11 +267,11 @@
 
     {
       base::RunLoop run_loop;
-      TracingController::EnableRecordingDoneCallback callback =
-          base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest,
+      TracingController::StartTracingDoneCallback callback =
+          base::Bind(&TracingControllerTest::StartTracingDoneCallbackTest,
                      base::Unretained(this),
                      run_loop.QuitClosure());
-      bool result = controller->EnableRecording(TraceConfig(), callback);
+      bool result = controller->StartTracing(TraceConfig(), callback);
       ASSERT_TRUE(result);
       run_loop.Run();
       EXPECT_EQ(enable_recording_done_callback_count(), 1);
@@ -280,11 +280,11 @@
     {
       base::RunLoop run_loop;
       base::Closure callback = base::Bind(
-          &TracingControllerTest::DisableRecordingFileDoneCallbackTest,
+          &TracingControllerTest::StopTracingFileDoneCallbackTest,
           base::Unretained(this),
           run_loop.QuitClosure(),
           result_file_path);
-      bool result = controller->DisableRecording(
+      bool result = controller->StopTracing(
           TracingController::CreateFileSink(result_file_path, callback));
       ASSERT_TRUE(result);
       run_loop.Run();
@@ -292,7 +292,7 @@
     }
   }
 
-  void TestEnableCaptureAndDisableMonitoring(
+  void TestEnableCaptureAndStopMonitoring(
       const base::FilePath& result_file_path) {
     Navigate(shell());
 
@@ -312,14 +312,14 @@
 
     {
       base::RunLoop run_loop;
-      TracingController::EnableMonitoringDoneCallback callback =
-          base::Bind(&TracingControllerTest::EnableMonitoringDoneCallbackTest,
+      TracingController::StartMonitoringDoneCallback callback =
+          base::Bind(&TracingControllerTest::StartMonitoringDoneCallbackTest,
                      base::Unretained(this),
                      run_loop.QuitClosure());
 
       TraceConfig trace_config("*", "");
       trace_config.EnableSampling();
-      bool result = controller->EnableMonitoring(trace_config, callback);
+      bool result = controller->StartMonitoring(trace_config, callback);
       ASSERT_TRUE(result);
       run_loop.Run();
       EXPECT_EQ(enable_monitoring_done_callback_count(), 1);
@@ -351,11 +351,11 @@
 
     {
       base::RunLoop run_loop;
-      TracingController::DisableMonitoringDoneCallback callback =
-          base::Bind(&TracingControllerTest::DisableMonitoringDoneCallbackTest,
+      TracingController::StopMonitoringDoneCallback callback =
+          base::Bind(&TracingControllerTest::StopMonitoringDoneCallbackTest,
                      base::Unretained(this),
                      run_loop.QuitClosure());
-      bool result = controller->DisableMonitoring(callback);
+      bool result = controller->StopMonitoring(callback);
       ASSERT_TRUE(result);
       run_loop.Run();
       EXPECT_EQ(disable_monitoring_done_callback_count(), 1);
@@ -400,12 +400,12 @@
   EXPECT_EQ(get_categories_done_callback_count(), 1);
 }
 
-IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndDisableRecording) {
-  TestEnableAndDisableRecordingString();
+IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndStopTracing) {
+  TestStartAndStopTracingString();
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest, DisableRecordingStoresMetadata) {
-  TestEnableAndDisableRecordingString();
+  TestStartAndStopTracingString();
   // Check that a number of important keys exist in the metadata dictionary. The
   // values are not checked to ensure the test is robust.
   EXPECT_TRUE(last_metadata() != NULL);
@@ -424,76 +424,76 @@
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableAndDisableRecordingWithFilePath) {
+                       EnableAndStopTracingWithFilePath) {
   base::FilePath file_path;
   base::CreateTemporaryFile(&file_path);
-  TestEnableAndDisableRecordingFile(file_path);
+  TestStartAndStopTracingFile(file_path);
   EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value());
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableAndDisableRecordingWithCompression) {
-  TestEnableAndDisableRecordingCompressed();
+                       EnableAndStopTracingWithCompression) {
+  TestStartAndStopTracingCompressed();
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableAndDisableRecordingToFileWithCompression) {
+                       EnableAndStopTracingToFileWithCompression) {
   base::FilePath file_path;
   base::CreateTemporaryFile(&file_path);
-  TestEnableAndDisableRecordingCompressedFile(file_path);
+  TestStartAndStopTracingCompressedFile(file_path);
   EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value());
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableAndDisableRecordingWithEmptyFileAndNullCallback) {
+                       EnableAndStopTracingWithEmptyFileAndNullCallback) {
   Navigate(shell());
 
   TracingController* controller = TracingController::GetInstance();
-  EXPECT_TRUE(controller->EnableRecording(
+  EXPECT_TRUE(controller->StartTracing(
       TraceConfig(),
-      TracingController::EnableRecordingDoneCallback()));
-  EXPECT_TRUE(controller->DisableRecording(NULL));
+      TracingController::StartTracingDoneCallback()));
+  EXPECT_TRUE(controller->StopTracing(NULL));
   base::RunLoop().RunUntilIdle();
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableCaptureAndDisableMonitoring) {
+                       EnableCaptureAndStopMonitoring) {
   base::FilePath file_path;
   base::CreateTemporaryFile(&file_path);
-  TestEnableCaptureAndDisableMonitoring(file_path);
+  TestEnableCaptureAndStopMonitoring(file_path);
 }
 
 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
-                       EnableCaptureAndDisableMonitoringWithFilePath) {
+                       EnableCaptureAndStopMonitoringWithFilePath) {
   base::FilePath file_path;
   base::CreateTemporaryFile(&file_path);
-  TestEnableCaptureAndDisableMonitoring(file_path);
+  TestEnableCaptureAndStopMonitoring(file_path);
   EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value());
 }
 
 // See http://crbug.com/392446
 #if defined(OS_ANDROID)
-#define MAYBE_EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback \
-    DISABLED_EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback
+#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \
+    DISABLED_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback
 #else
-#define MAYBE_EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback \
-    EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback
+#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \
+    EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback
 #endif
 IN_PROC_BROWSER_TEST_F(
     TracingControllerTest,
-    MAYBE_EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback) {
+    MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback) {
   Navigate(shell());
 
   TracingController* controller = TracingController::GetInstance();
   TraceConfig trace_config("*", "");
   trace_config.EnableSampling();
-  EXPECT_TRUE(controller->EnableMonitoring(
+  EXPECT_TRUE(controller->StartMonitoring(
       trace_config,
-      TracingController::EnableMonitoringDoneCallback()));
+      TracingController::StartMonitoringDoneCallback()));
   controller->CaptureMonitoringSnapshot(NULL);
   base::RunLoop().RunUntilIdle();
-  EXPECT_TRUE(controller->DisableMonitoring(
-      TracingController::DisableMonitoringDoneCallback()));
+  EXPECT_TRUE(controller->StopMonitoring(
+      TracingController::StopMonitoringDoneCallback()));
   base::RunLoop().RunUntilIdle();
 }
 
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index d0db9ce2..6ee0709 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -138,7 +138,7 @@
 }
 
 TracingControllerImpl::TracingControllerImpl()
-    : pending_disable_recording_ack_count_(0),
+    : pending_stop_tracing_ack_count_(0),
       pending_capture_monitoring_snapshot_ack_count_(0),
       pending_trace_log_status_ack_count_(0),
       maximum_trace_buffer_usage_(0),
@@ -150,7 +150,7 @@
 #if defined(OS_CHROMEOS) || defined(OS_WIN)
       is_system_tracing_(false),
 #endif
-      is_recording_(TraceLog::GetInstance()->IsEnabled()),
+      is_tracing_(TraceLog::GetInstance()->IsEnabled()),
       is_monitoring_(false),
       is_power_tracing_(false) {
   base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
@@ -177,12 +177,12 @@
   // message. So to get known categories, just begin and end tracing immediately
   // afterwards. This will ping all the child processes for categories.
   pending_get_categories_done_callback_ = callback;
-  if (!EnableRecording(TraceConfig("*", ""), EnableRecordingDoneCallback())) {
+  if (!StartTracing(TraceConfig("*", ""), StartTracingDoneCallback())) {
     pending_get_categories_done_callback_.Reset();
     return false;
   }
 
-  bool ok = DisableRecording(NULL);
+  bool ok = StopTracing(NULL);
   DCHECK(ok);
   return true;
 }
@@ -206,14 +206,14 @@
   BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
 }
 
-bool TracingControllerImpl::EnableRecording(
+bool TracingControllerImpl::StartTracing(
     const TraceConfig& trace_config,
-    const EnableRecordingDoneCallback& callback) {
+    const StartTracingDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
-  if (!can_enable_recording())
+  if (!can_start_tracing())
     return false;
-  is_recording_ = true;
+  is_tracing_ = true;
 
 #if defined(OS_ANDROID)
   if (pending_get_categories_done_callback_.is_null())
@@ -235,8 +235,8 @@
 #endif
   }
 
-  base::Closure on_enable_recording_done_callback =
-      base::Bind(&TracingControllerImpl::OnEnableRecordingDone,
+  base::Closure on_start_tracing_done_callback =
+      base::Bind(&TracingControllerImpl::OnStartTracingDone,
                  base::Unretained(this),
                  trace_config, callback);
   if (!BrowserThread::PostTask(
@@ -244,21 +244,21 @@
           base::Bind(&TracingControllerImpl::SetEnabledOnFileThread,
                      base::Unretained(this), trace_config,
                      base::trace_event::TraceLog::RECORDING_MODE,
-                     on_enable_recording_done_callback))) {
+                     on_start_tracing_done_callback))) {
     // BrowserThread::PostTask fails if the threads haven't been created yet,
     // so it should be safe to just use TraceLog::SetEnabled directly.
     base::trace_event::TraceLog::GetInstance()->SetEnabled(
         trace_config, base::trace_event::TraceLog::RECORDING_MODE);
     BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
-                            on_enable_recording_done_callback);
+                            on_start_tracing_done_callback);
   }
 
   return true;
 }
 
-void TracingControllerImpl::OnEnableRecordingDone(
+void TracingControllerImpl::OnStartTracingDone(
     const TraceConfig& trace_config,
-    const EnableRecordingDoneCallback& callback) {
+    const StartTracingDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   TRACE_EVENT_API_ADD_METADATA_EVENT("IsTimeTicksHighResolution", "value",
@@ -276,29 +276,29 @@
     callback.Run();
 }
 
-bool TracingControllerImpl::DisableRecording(
+bool TracingControllerImpl::StopTracing(
     const scoped_refptr<TraceDataSink>& trace_data_sink) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   if (trace_data_sink)
     trace_data_sink->AddMetadata(*GenerateTracingMetadataDict().get());
 
-  if (!can_disable_recording())
+  if (!can_stop_tracing())
     return false;
 
   trace_data_sink_ = trace_data_sink;
   // Disable local trace early to avoid traces during end-tracing process from
   // interfering with the process.
-  base::Closure on_disable_recording_done_callback = base::Bind(
-      &TracingControllerImpl::OnDisableRecordingDone, base::Unretained(this));
+  base::Closure on_stop_tracing_done_callback = base::Bind(
+      &TracingControllerImpl::OnStopTracingDone, base::Unretained(this));
   BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
       base::Bind(&TracingControllerImpl::SetDisabledOnFileThread,
                  base::Unretained(this),
-                 on_disable_recording_done_callback));
+                 on_stop_tracing_done_callback));
   return true;
 }
 
-void TracingControllerImpl::OnDisableRecordingDone() {
+void TracingControllerImpl::OnStopTracingDone() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
 #if defined(OS_ANDROID)
@@ -306,16 +306,16 @@
     TraceLog::GetInstance()->AddClockSyncMetadataEvent();
 #endif
 
-  // Count myself (local trace) in pending_disable_recording_ack_count_,
+  // Count myself (local trace) in pending_stop_tracing_ack_count_,
   // acked below.
-  pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1;
-  pending_disable_recording_filters_ = trace_message_filters_;
+  pending_stop_tracing_ack_count_ = trace_message_filters_.size() + 1;
+  pending_stop_tracing_filters_ = trace_message_filters_;
 
 #if defined(OS_CHROMEOS) || defined(OS_WIN)
   if (is_system_tracing_) {
     // Disable system tracing.
     is_system_tracing_ = false;
-    ++pending_disable_recording_ack_count_;
+    ++pending_stop_tracing_ack_count_;
 
 #if defined(OS_CHROMEOS)
     scoped_refptr<base::TaskRunner> task_runner =
@@ -336,7 +336,7 @@
 
   if (is_power_tracing_) {
     is_power_tracing_ = false;
-    ++pending_disable_recording_ack_count_;
+    ++pending_stop_tracing_ack_count_;
     PowerTracingAgent::GetInstance()->StopTracing(
         base::Bind(&TracingControllerImpl::OnEndPowerTracingAcked,
                    base::Unretained(this)));
@@ -345,7 +345,7 @@
   // Handle special case of zero child processes by immediately flushing the
   // trace log. Once the flush has completed the caller will be notified that
   // tracing has ended.
-  if (pending_disable_recording_ack_count_ == 1) {
+  if (pending_stop_tracing_ack_count_ == 1) {
     // Flush/cancel asynchronously now, because we don't have any children to
     // wait for.
     if (trace_data_sink_) {
@@ -370,12 +370,12 @@
   }
 }
 
-bool TracingControllerImpl::EnableMonitoring(
+bool TracingControllerImpl::StartMonitoring(
     const TraceConfig& trace_config,
-    const EnableMonitoringDoneCallback& callback) {
+    const StartMonitoringDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
-  if (!can_enable_monitoring())
+  if (!can_start_monitoring())
     return false;
   OnMonitoringStateChanged(true);
 
@@ -383,8 +383,8 @@
   TraceLog::GetInstance()->AddClockSyncMetadataEvent();
 #endif
 
-  base::Closure on_enable_monitoring_done_callback =
-      base::Bind(&TracingControllerImpl::OnEnableMonitoringDone,
+  base::Closure on_start_monitoring_done_callback =
+      base::Bind(&TracingControllerImpl::OnStartMonitoringDone,
                  base::Unretained(this),
                  trace_config, callback);
   if (!BrowserThread::PostTask(
@@ -392,51 +392,51 @@
           base::Bind(&TracingControllerImpl::SetEnabledOnFileThread,
                      base::Unretained(this), trace_config,
                      base::trace_event::TraceLog::MONITORING_MODE,
-                     on_enable_monitoring_done_callback))) {
+                     on_start_monitoring_done_callback))) {
     // BrowserThread::PostTask fails if the threads haven't been created yet,
     // so it should be safe to just use TraceLog::SetEnabled directly.
     base::trace_event::TraceLog::GetInstance()->SetEnabled(
         trace_config, base::trace_event::TraceLog::MONITORING_MODE);
     BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
-                            on_enable_monitoring_done_callback);
+                            on_start_monitoring_done_callback);
   }
   return true;
 }
 
-void TracingControllerImpl::OnEnableMonitoringDone(
+void TracingControllerImpl::OnStartMonitoringDone(
     const TraceConfig& trace_config,
-    const EnableMonitoringDoneCallback& callback) {
+    const StartMonitoringDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   // Notify all child processes.
   for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
       it != trace_message_filters_.end(); ++it) {
-    it->get()->SendEnableMonitoring(trace_config);
+    it->get()->SendStartMonitoring(trace_config);
   }
 
   if (!callback.is_null())
     callback.Run();
 }
 
-bool TracingControllerImpl::DisableMonitoring(
-    const DisableMonitoringDoneCallback& callback) {
+bool TracingControllerImpl::StopMonitoring(
+    const StopMonitoringDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
-  if (!can_disable_monitoring())
+  if (!can_stop_monitoring())
     return false;
 
-  base::Closure on_disable_monitoring_done_callback =
-      base::Bind(&TracingControllerImpl::OnDisableMonitoringDone,
+  base::Closure on_stop_monitoring_done_callback =
+      base::Bind(&TracingControllerImpl::OnStopMonitoringDone,
                  base::Unretained(this), callback);
   BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
       base::Bind(&TracingControllerImpl::SetDisabledOnFileThread,
                  base::Unretained(this),
-                 on_disable_monitoring_done_callback));
+                 on_stop_monitoring_done_callback));
   return true;
 }
 
-void TracingControllerImpl::OnDisableMonitoringDone(
-    const DisableMonitoringDoneCallback& callback) {
+void TracingControllerImpl::OnStopMonitoringDone(
+    const StopMonitoringDoneCallback& callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   OnMonitoringStateChanged(false);
@@ -444,7 +444,7 @@
   // Notify all child processes.
   for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
       it != trace_message_filters_.end(); ++it) {
-    it->get()->SendDisableMonitoring();
+    it->get()->SendStopMonitoring();
   }
   if (!callback.is_null())
     callback.Run();
@@ -461,7 +461,7 @@
     const scoped_refptr<TraceDataSink>& monitoring_data_sink) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
-  if (!can_disable_monitoring())
+  if (!can_stop_monitoring())
     return false;
 
   if (!monitoring_data_sink.get())
@@ -572,8 +572,8 @@
   return true;
 }
 
-bool TracingControllerImpl::IsRecording() const {
-  return is_recording_;
+bool TracingControllerImpl::IsTracing() const {
+  return is_tracing_;
 }
 
 void TracingControllerImpl::AddTraceMessageFilter(
@@ -591,12 +591,12 @@
     trace_message_filter->SendSetWatchEvent(watch_category_name_,
                                             watch_event_name_);
   }
-  if (can_disable_recording()) {
+  if (can_stop_tracing()) {
     trace_message_filter->SendBeginTracing(
         TraceLog::GetInstance()->GetCurrentTraceConfig());
   }
-  if (can_disable_monitoring()) {
-    trace_message_filter->SendEnableMonitoring(
+  if (can_stop_monitoring()) {
+    trace_message_filter->SendStartMonitoring(
         TraceLog::GetInstance()->GetCurrentTraceConfig());
   }
 
@@ -617,12 +617,12 @@
   // If a filter is removed while a response from that filter is pending then
   // simulate the response. Otherwise the response count will be wrong and the
   // completion callback will never be executed.
-  if (pending_disable_recording_ack_count_ > 0) {
+  if (pending_stop_tracing_ack_count_ > 0) {
     TraceMessageFilterSet::const_iterator it =
-        pending_disable_recording_filters_.find(trace_message_filter);
-    if (it != pending_disable_recording_filters_.end()) {
+        pending_stop_tracing_filters_.find(trace_message_filter);
+    if (it != pending_stop_tracing_filters_.end()) {
       BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
-          base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
+          base::Bind(&TracingControllerImpl::OnStopTracingAcked,
                      base::Unretained(this),
                      make_scoped_refptr(trace_message_filter),
                      std::vector<std::string>()));
@@ -665,12 +665,12 @@
   trace_message_filters_.erase(trace_message_filter);
 }
 
-void TracingControllerImpl::OnDisableRecordingAcked(
+void TracingControllerImpl::OnStopTracingAcked(
     TraceMessageFilter* trace_message_filter,
     const std::vector<std::string>& known_category_groups) {
   if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
     BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
-        base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
+        base::Bind(&TracingControllerImpl::OnStopTracingAcked,
                    base::Unretained(this),
                    make_scoped_refptr(trace_message_filter),
                    known_category_groups));
@@ -681,16 +681,16 @@
   known_category_groups_.insert(known_category_groups.begin(),
                                 known_category_groups.end());
 
-  if (pending_disable_recording_ack_count_ == 0)
+  if (pending_stop_tracing_ack_count_ == 0)
     return;
 
   if (trace_message_filter &&
-      !pending_disable_recording_filters_.erase(trace_message_filter)) {
+      !pending_stop_tracing_filters_.erase(trace_message_filter)) {
     // The response from the specified message filter has already been received.
     return;
   }
 
-  if (--pending_disable_recording_ack_count_ == 1) {
+  if (--pending_stop_tracing_ack_count_ == 1) {
     // All acks from subprocesses have been received. Now flush the local trace.
     // During or after this call, our OnLocalTraceDataCollected will be
     // called with the last of the local trace data.
@@ -707,12 +707,12 @@
     return;
   }
 
-  if (pending_disable_recording_ack_count_ != 0)
+  if (pending_stop_tracing_ack_count_ != 0)
     return;
 
   // All acks (including from the subprocesses and the local trace) have been
   // received.
-  is_recording_ = false;
+  is_tracing_ = false;
 
   // Trigger callback if one is set.
   if (!pending_get_categories_done_callback_.is_null()) {
@@ -733,7 +733,7 @@
     trace_data_sink_->SetPowerTrace(json_string);
   }
   std::vector<std::string> category_groups;
-  OnDisableRecordingAcked(NULL, category_groups);
+  OnStopTracingAcked(NULL, category_groups);
 }
 
 #if defined(OS_CHROMEOS) || defined(OS_WIN)
@@ -754,7 +754,7 @@
   }
   DCHECK(!is_system_tracing_);
   std::vector<std::string> category_groups;
-  OnDisableRecordingAcked(NULL, category_groups);
+  OnStopTracingAcked(NULL, category_groups);
 }
 #endif
 
@@ -833,10 +833,10 @@
   if (has_more_events)
     return;
 
-  // Simulate an DisableRecordingAcked for the local trace.
+  // Simulate an StopTracingAcked for the local trace.
   std::vector<std::string> category_groups;
   TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups);
-  OnDisableRecordingAcked(NULL, category_groups);
+  OnStopTracingAcked(NULL, category_groups);
 }
 
 void TracingControllerImpl::OnLocalMonitoringTraceDataCollected(
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h
index 9af728e..0d2e4d81 100644
--- a/content/browser/tracing/tracing_controller_impl.h
+++ b/content/browser/tracing/tracing_controller_impl.h
@@ -31,14 +31,14 @@
 
   // TracingController implementation.
   bool GetCategories(const GetCategoriesDoneCallback& callback) override;
-  bool EnableRecording(const base::trace_event::TraceConfig& trace_config,
-                       const EnableRecordingDoneCallback& callback) override;
-  bool DisableRecording(const scoped_refptr<TraceDataSink>& sink) override;
-  bool EnableMonitoring(
+  bool StartTracing(const base::trace_event::TraceConfig& trace_config,
+                    const StartTracingDoneCallback& callback) override;
+  bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override;
+  bool StartMonitoring(
       const base::trace_event::TraceConfig& trace_config,
-      const EnableMonitoringDoneCallback& callback) override;
-  bool DisableMonitoring(
-      const DisableMonitoringDoneCallback& callback) override;
+      const StartMonitoringDoneCallback& callback) override;
+  bool StopMonitoring(
+      const StopMonitoringDoneCallback& callback) override;
   void GetMonitoringStatus(
       bool* out_enabled,
       base::trace_event::TraceConfig* out_trace_config) override;
@@ -50,7 +50,7 @@
                      const std::string& event_name,
                      const WatchEventCallback& callback) override;
   bool CancelWatchEvent() override;
-  bool IsRecording() const override;
+  bool IsTracing() const override;
 
   void RegisterTracingUI(TracingUI* tracing_ui);
   void UnregisterTracingUI(TracingUI* tracing_ui);
@@ -76,19 +76,19 @@
   TracingControllerImpl();
   ~TracingControllerImpl() override;
 
-  bool can_enable_recording() const {
-    return !is_recording_;
+  bool can_start_tracing() const {
+    return !is_tracing_;
   }
 
-  bool can_disable_recording() const {
-    return is_recording_ && !trace_data_sink_.get();
+  bool can_stop_tracing() const {
+    return is_tracing_ && !trace_data_sink_.get();
   }
 
-  bool can_enable_monitoring() const {
+  bool can_start_monitoring() const {
     return !is_monitoring_;
   }
 
-  bool can_disable_monitoring() const {
+  bool can_stop_monitoring() const {
     return is_monitoring_ && !monitoring_data_sink_.get();
   }
 
@@ -118,7 +118,7 @@
       const scoped_refptr<base::RefCountedString>& events_str_ptr,
       bool has_more_events);
 
-  void OnDisableRecordingAcked(
+  void OnStopTracingAcked(
       TraceMessageFilter* trace_message_filter,
       const std::vector<std::string>& known_category_groups);
 
@@ -151,23 +151,23 @@
       int mode,
       const base::Closure& callback);
   void SetDisabledOnFileThread(const base::Closure& callback);
-  void OnEnableRecordingDone(
+  void OnStartTracingDone(
       const base::trace_event::TraceConfig& trace_config,
-      const EnableRecordingDoneCallback& callback);
-  void OnDisableRecordingDone();
-  void OnEnableMonitoringDone(
+      const StartTracingDoneCallback& callback);
+  void OnStopTracingDone();
+  void OnStartMonitoringDone(
       const base::trace_event::TraceConfig& trace_config,
-      const EnableMonitoringDoneCallback& callback);
-  void OnDisableMonitoringDone(const DisableMonitoringDoneCallback& callback);
+      const StartMonitoringDoneCallback& callback);
+  void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback);
 
   void OnMonitoringStateChanged(bool is_monitoring);
 
   typedef std::set<scoped_refptr<TraceMessageFilter>> TraceMessageFilterSet;
   TraceMessageFilterSet trace_message_filters_;
 
-  // Pending acks for DisableRecording.
-  int pending_disable_recording_ack_count_;
-  TraceMessageFilterSet pending_disable_recording_filters_;
+  // Pending acks for StopTracing.
+  int pending_stop_tracing_ack_count_;
+  TraceMessageFilterSet pending_stop_tracing_filters_;
 
   // Pending acks for CaptureMonitoringSnapshot.
   int pending_capture_monitoring_snapshot_ack_count_;
@@ -189,7 +189,7 @@
 #if defined(OS_CHROMEOS) || defined(OS_WIN)
   bool is_system_tracing_;
 #endif
-  bool is_recording_;
+  bool is_tracing_;
   bool is_monitoring_;
   bool is_power_tracing_;
 
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc
index e8e75b5..638d935 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -111,7 +111,7 @@
   if (!GetTracingOptions(data64, &trace_config))
     return false;
 
-  return TracingController::GetInstance()->EnableRecording(
+  return TracingController::GetInstance()->StartTracing(
       trace_config,
       base::Bind(&OnRecordingEnabledAck, callback));
 }
@@ -145,13 +145,13 @@
 
 void OnMonitoringEnabledAck(const WebUIDataSource::GotDataCallback& callback);
 
-bool EnableMonitoring(const std::string& data64,
+bool StartMonitoring(const std::string& data64,
                       const WebUIDataSource::GotDataCallback& callback) {
   base::trace_event::TraceConfig trace_config("", "");
   if (!GetTracingOptions(data64, &trace_config))
     return false;
 
-  return TracingController::GetInstance()->EnableMonitoring(
+  return TracingController::GetInstance()->StartMonitoring(
       trace_config,
       base::Bind(OnMonitoringEnabledAck, callback));
 }
@@ -236,16 +236,16 @@
             TracingController::CreateCallbackEndpoint(
                 base::Bind(TracingCallbackWrapperBase64, callback)));
     AddCustomMetadata(data_sink.get());
-    return TracingController::GetInstance()->DisableRecording(data_sink);
+    return TracingController::GetInstance()->StopTracing(data_sink);
   }
 
-  const char* enableMonitoringPath = "json/begin_monitoring?";
-  if (path.find(enableMonitoringPath) == 0) {
-    std::string data = path.substr(strlen(enableMonitoringPath));
-    return EnableMonitoring(data, callback);
+  const char* StartMonitoringPath = "json/begin_monitoring?";
+  if (path.find(StartMonitoringPath) == 0) {
+    std::string data = path.substr(strlen(StartMonitoringPath));
+    return StartMonitoring(data, callback);
   }
   if (path == "json/end_monitoring") {
-    return TracingController::GetInstance()->DisableMonitoring(
+    return TracingController::GetInstance()->StopMonitoring(
         base::Bind(OnMonitoringDisabled, callback));
   }
   if (path == "json/capture_monitoring_compressed") {
diff --git a/content/browser/wake_lock/wake_lock_service_context.h b/content/browser/wake_lock/wake_lock_service_context.h
index f3114d7..aeaa1302 100644
--- a/content/browser/wake_lock/wake_lock_service_context.h
+++ b/content/browser/wake_lock/wake_lock_service_context.h
@@ -14,7 +14,7 @@
 #include "content/browser/wake_lock/wake_lock_service_impl.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/web_contents_observer.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 
 namespace content {
 
diff --git a/content/browser/wake_lock/wake_lock_service_impl.h b/content/browser/wake_lock/wake_lock_service_impl.h
index 903f5057..3d6a5802 100644
--- a/content/browser/wake_lock/wake_lock_service_impl.h
+++ b/content/browser/wake_lock/wake_lock_service_impl.h
@@ -8,8 +8,8 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/wake_lock_service.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace content {
 
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 67c6f8e..b21a722 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -1215,20 +1215,6 @@
   return blink::WebString("");
 }
 
-static scoped_ptr<base::ProcessMetrics> CurrentProcessMetrics() {
-  using base::ProcessMetrics;
-#if defined(OS_MACOSX)
-  return scoped_ptr<ProcessMetrics>(
-      // The default port provider is sufficient to get data for the current
-      // process.
-      ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
-                                           NULL));
-#else
-  return scoped_ptr<ProcessMetrics>(
-      ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()));
-#endif
-}
-
 static size_t getMemoryUsageMB(bool bypass_cache) {
   size_t current_mem_usage = 0;
   MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance();
@@ -1268,7 +1254,9 @@
 bool BlinkPlatformImpl::processMemorySizesInBytes(
     size_t* private_bytes,
     size_t* shared_bytes) {
-  return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes);
+  scoped_ptr<base::ProcessMetrics> current_process_metrics(
+      base::ProcessMetrics::CreateCurrentProcessMetrics());
+  return current_process_metrics->GetMemoryBytes(private_bytes, shared_bytes);
 }
 
 bool BlinkPlatformImpl::memoryAllocatorWasteInBytes(size_t* size) {
diff --git a/content/common/sandbox_linux/bpf_ppapi_policy_linux.cc b/content/common/sandbox_linux/bpf_ppapi_policy_linux.cc
index 8a7cee5..b4837dcc 100644
--- a/content/common/sandbox_linux/bpf_ppapi_policy_linux.cc
+++ b/content/common/sandbox_linux/bpf_ppapi_policy_linux.cc
@@ -32,6 +32,7 @@
     case __NR_pwrite64:
     case __NR_sched_get_priority_max:
     case __NR_sched_get_priority_min:
+    case __NR_sysinfo:
     case __NR_times:
       return Allow();
     case __NR_sched_getaffinity:
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 0d46bbdd..7d2a67c6a 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -972,8 +972,6 @@
       'browser/media/android/browser_demuxer_android.h',
       'browser/media/android/browser_media_player_manager.cc',
       'browser/media/android/browser_media_player_manager.h',
-      'browser/media/android/media_drm_credential_manager.cc',
-      'browser/media/android/media_drm_credential_manager.h',
       'browser/media/android/media_resource_getter_impl.cc',
       'browser/media/android/media_resource_getter_impl.h',
       'browser/media/android/media_session.cc',
diff --git a/content/content_jni.gypi b/content/content_jni.gypi
index affde12f..a5295d5 100644
--- a/content/content_jni.gypi
+++ b/content/content_jni.gypi
@@ -28,7 +28,6 @@
     'public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java',
     'public/android/java/src/org/chromium/content/browser/InterstitialPageDelegateAndroid.java',
     'public/android/java/src/org/chromium/content/browser/LocationProviderAdapter.java',
-    'public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java',
     'public/android/java/src/org/chromium/content/browser/MediaSession.java',
     'public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java',
     'public/android/java/src/org/chromium/content/browser/MediaThrottler.java',
diff --git a/content/public/browser/tracing_controller.h b/content/public/browser/tracing_controller.h
index f405d67..6467e9521 100644
--- a/content/public/browser/tracing_controller.h
+++ b/content/public/browser/tracing_controller.h
@@ -19,7 +19,7 @@
 class TracingController;
 
 // TracingController is used on the browser processes to enable/disable
-// trace status and collect trace data. Only the browser UI thread is allowed
+// tracing status and collect trace data. Only the browser UI thread is allowed
 // to interact with the TracingController object. All callbacks are called on
 // the UI thread.
 class TracingController {
@@ -76,7 +76,7 @@
     virtual ~TraceDataEndpoint() {}
   };
 
-  // Create a trace sink that may be supplied to DisableRecording or
+  // Create a trace sink that may be supplied to StopTracing or
   // CaptureMonitoringSnapshot to capture the trace data as a string.
   CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink(
       const base::Callback<void(scoped_ptr<const base::DictionaryValue>,
@@ -85,7 +85,7 @@
   CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink(
       scoped_refptr<TraceDataEndpoint> endpoint);
 
-  // Create a trace sink that may be supplied to DisableRecording or
+  // Create a trace sink that may be supplied to StopTracing or
   // CaptureMonitoringSnapshot to dump the trace data to a file.
   CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink(
       const base::FilePath& file_path,
@@ -114,13 +114,13 @@
   virtual bool GetCategories(
       const GetCategoriesDoneCallback& callback) = 0;
 
-  // Start recording on all processes.
+  // Start tracing (recording traces) on all processes.
   //
-  // Recording begins immediately locally, and asynchronously on child processes
-  // as soon as they receive the EnableRecording request.
+  // Tracing begins immediately locally, and asynchronously on child processes
+  // as soon as they receive the StartTracing request.
   //
-  // Once all child processes have acked to the EnableRecording request,
-  // EnableRecordingDoneCallback will be called back.
+  // Once all child processes have acked to the StartTracing request,
+  // StartTracingDoneCallback will be called back.
   //
   // |category_filter| is a filter to control what category groups should be
   // traced. A filter can have an optional '-' prefix to exclude category groups
@@ -131,13 +131,13 @@
   //           "test_MyTest*,test_OtherStuff",
   //           "-excluded_category1,-excluded_category2"
   //
-  // |options| controls what kind of tracing is enabled.
-  typedef base::Callback<void()> EnableRecordingDoneCallback;
-  virtual bool EnableRecording(
+  // |trace_config| controls what kind of tracing is enabled.
+  typedef base::Callback<void()> StartTracingDoneCallback;
+  virtual bool StartTracing(
       const base::trace_event::TraceConfig& trace_config,
-      const EnableRecordingDoneCallback& callback) = 0;
+      const StartTracingDoneCallback& callback) = 0;
 
-  // Stop recording on all processes.
+  // Stop tracing (recording traces) on all processes.
   //
   // Child processes typically are caching trace data and only rarely flush
   // and send trace data back to the browser process. That is because it may be
@@ -145,7 +145,7 @@
   // to avoid much runtime overhead of tracing. So, to end tracing, we must
   // asynchronously ask all child processes to flush any pending trace data.
   //
-  // Once all child processes have acked to the DisableRecording request,
+  // Once all child processes have acked to the StopTracing request,
   // TracingFileResultCallback will be called back with a file that contains
   // the traced data.
   //
@@ -153,33 +153,33 @@
   // as a comma-separated sequences of JSON-stringified events, followed by
   // a notification that the trace collection is finished.
   //
-  virtual bool DisableRecording(
+  virtual bool StopTracing(
       const scoped_refptr<TraceDataSink>& trace_data_sink) = 0;
 
   // Start monitoring on all processes.
   //
   // Monitoring begins immediately locally, and asynchronously on child
-  // processes as soon as they receive the EnableMonitoring request.
+  // processes as soon as they receive the StartMonitoring request.
   //
-  // Once all child processes have acked to the EnableMonitoring request,
-  // EnableMonitoringDoneCallback will be called back.
+  // Once all child processes have acked to the StartMonitoring request,
+  // StartMonitoringDoneCallback will be called back.
   //
   // |category_filter| is a filter to control what category groups should be
   // traced.
   //
-  // |options| controls what kind of tracing is enabled.
-  typedef base::Callback<void()> EnableMonitoringDoneCallback;
-  virtual bool EnableMonitoring(
+  // |trace_config| controls what kind of tracing is enabled.
+  typedef base::Callback<void()> StartMonitoringDoneCallback;
+  virtual bool StartMonitoring(
       const base::trace_event::TraceConfig& trace_config,
-      const EnableMonitoringDoneCallback& callback) = 0;
+      const StartMonitoringDoneCallback& callback) = 0;
 
   // Stop monitoring on all processes.
   //
-  // Once all child processes have acked to the DisableMonitoring request,
-  // DisableMonitoringDoneCallback is called back.
-  typedef base::Callback<void()> DisableMonitoringDoneCallback;
-  virtual bool DisableMonitoring(
-      const DisableMonitoringDoneCallback& callback) = 0;
+  // Once all child processes have acked to the StopMonitoring request,
+  // StopMonitoringDoneCallback is called back.
+  typedef base::Callback<void()> StopMonitoringDoneCallback;
+  virtual bool StopMonitoring(
+      const StopMonitoringDoneCallback& callback) = 0;
 
   // Get the current monitoring configuration.
   virtual void GetMonitoringStatus(
@@ -222,8 +222,8 @@
   // watch event callback.
   virtual bool CancelWatchEvent() = 0;
 
-  // Check if the tracing system is recording
-  virtual bool IsRecording() const = 0;
+  // Check if the tracing system is tracing
+  virtual bool IsTracing() const = 0;
 
  protected:
   virtual ~TracingController() {}
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index 22f9cdf..669a85d4 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -125,7 +125,7 @@
   ~LocalHostResolverProc() override {}
 };
 
-void TraceDisableRecordingComplete(const base::Closure& quit,
+void TraceStopTracingComplete(const base::Closure& quit,
                                    const base::FilePath& file_path) {
   LOG(ERROR) << "Tracing written to: " << file_path.value();
   quit.Run();
@@ -293,9 +293,9 @@
         base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
             switches::kEnableTracing),
         base::trace_event::RECORD_CONTINUOUSLY);
-    TracingController::GetInstance()->EnableRecording(
+    TracingController::GetInstance()->StartTracing(
         trace_config,
-        TracingController::EnableRecordingDoneCallback());
+        TracingController::StartTracingDoneCallback());
   }
 
   RunTestOnMainThreadLoop();
@@ -312,10 +312,10 @@
 
     // Wait for tracing to collect results from the renderers.
     base::RunLoop run_loop;
-    TracingController::GetInstance()->DisableRecording(
+    TracingController::GetInstance()->StopTracing(
         TracingControllerImpl::CreateFileSink(
             trace_file,
-            base::Bind(&TraceDisableRecordingComplete,
+            base::Bind(&TraceStopTracingComplete,
                        run_loop.QuitClosure(),
                        trace_file)));
     run_loop.Run();
diff --git a/content/test/web_contents_observer_sanity_checker.cc b/content/test/web_contents_observer_sanity_checker.cc
index 1935d2ec..a27c96b 100644
--- a/content/test/web_contents_observer_sanity_checker.cc
+++ b/content/test/web_contents_observer_sanity_checker.cc
@@ -255,12 +255,9 @@
 bool WebContentsObserverSanityChecker::OnMessageReceived(
     const IPC::Message& message,
     RenderFrameHost* render_frame_host) {
-  // TODO(nasko): FrameHostMsg_RenderProcessGone is delivered to
-  // WebContentsObserver since RenderFrameHost allows the delegate to handle
-  // the message first. This shouldn't happen, but for now handle it here.
-  // https://crbug.com/450799
-  if (message.type() == FrameHostMsg_RenderProcessGone::ID)
-    return false;
+  // FrameHostMsg_RenderProcessGone is special internal IPC message that
+  // should not be leaking outside of RenderFrameHost.
+  CHECK(message.type() != FrameHostMsg_RenderProcessGone::ID);
 
 #if !defined(OS_MACOSX)
 // TODO(avi): Disabled because of http://crbug.com/445054
diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
index 65a8f84..7dcae774 100644
--- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
+++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
@@ -954,8 +954,9 @@
           {leafCert, base::SysNSStringToUTF8(host)});
       bool cacheHit = error != _certVerificationErrors->end();
       if (cacheHit) {
-        status.cert_status = error->second.status;
         recoverable = error->second.is_recoverable;
+        status.cert_status = error->second.status;
+        info.cert_status = error->second.status;
       }
       UMA_HISTOGRAM_BOOLEAN("WebController.CertVerificationErrorsCacheHit",
                             cacheHit);
diff --git a/ios/web/web_state/wk_web_view_security_util.mm b/ios/web/web_state/wk_web_view_security_util.mm
index 7dc87a36..caa74208 100644
--- a/ios/web/web_state/wk_web_view_security_util.mm
+++ b/ios/web/web_state/wk_web_view_security_util.mm
@@ -120,8 +120,10 @@
                                          net::SSLInfo* ssl_info) {
   DCHECK(IsWKWebViewSSLCertError(error));
   ssl_info->cert_status = GetCertStatusFromNSErrorCode(error.code);
-  ssl_info->cert = web::CreateCertFromChain(
+  scoped_refptr<net::X509Certificate> cert = web::CreateCertFromChain(
       error.userInfo[web::kNSErrorPeerCertificateChainKey]);
+  ssl_info->cert = cert;
+  ssl_info->unverified_cert = cert;
 }
 
 SecurityStyle GetSecurityStyleFromTrustResult(SecTrustResultType result) {
diff --git a/ios/web/web_state/wk_web_view_security_util_unittest.mm b/ios/web/web_state/wk_web_view_security_util_unittest.mm
index d925363..97cb2e3b 100644
--- a/ios/web/web_state/wk_web_view_security_util_unittest.mm
+++ b/ios/web/web_state/wk_web_view_security_util_unittest.mm
@@ -249,6 +249,7 @@
   EXPECT_TRUE(info.is_valid());
   EXPECT_EQ(net::CERT_STATUS_INVALID, info.cert_status);
   EXPECT_TRUE(info.cert->subject().GetDisplayName() == kTestSubject);
+  EXPECT_TRUE(info.unverified_cert->subject().GetDisplayName() == kTestSubject);
 }
 
 // Tests GetSecurityStyleFromTrustResult with bad SecTrustResultType result.
diff --git a/ipc/attachment_broker_mac_unittest.cc b/ipc/attachment_broker_mac_unittest.cc
index 3188640..2e370cd 100644
--- a/ipc/attachment_broker_mac_unittest.cc
+++ b/ipc/attachment_broker_mac_unittest.cc
@@ -14,6 +14,7 @@
 #include "base/mac/mac_util.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
+#include "ipc/attachment_broker_messages.h"
 #include "ipc/attachment_broker_privileged_mac.h"
 #include "ipc/attachment_broker_unprivileged_mac.h"
 #include "ipc/ipc_listener.h"
@@ -348,8 +349,11 @@
 
   void InsertEntry(base::ProcessHandle process, mach_port_t task_port) {
     port_map_[process] = task_port;
+    NotifyObservers(process);
   }
 
+  void ClearPortMap() { port_map_.clear(); }
+
  private:
   std::map<base::ProcessHandle, mach_port_t> port_map_;
 };
@@ -466,17 +470,23 @@
   ResultListener result_listener_;
 };
 
-using OnMessageReceivedCallback = void (*)(IPC::Sender* sender,
-                                           const IPC::Message& message);
-
 // These objects are globally accessible, and are expected to outlive all IPC
 // Channels.
 struct ChildProcessGlobals {
-  scoped_ptr<IPC::AttachmentBrokerPrivilegedMac> broker;
   MockPortProvider port_provider;
+
+  // The broker must be destroyed before the port_provider, so that the broker
+  // gets a chance to unregister itself as an observer. This doesn't matter
+  // outside of tests, since neither port_provider nor broker will ever be
+  // destroyed.
+  scoped_ptr<IPC::AttachmentBrokerPrivilegedMac> broker;
   base::mac::ScopedMachSendRight server_task_port;
 };
 
+using OnMessageReceivedCallback = void (*)(IPC::Sender* sender,
+                                           const IPC::Message& message,
+                                           ChildProcessGlobals* globals);
+
 // Sets up the Mach communication ports with the server. Returns a set of
 // globals that must live at least as long as the test.
 scoped_ptr<ChildProcessGlobals> CommonChildProcessSetUp() {
@@ -527,7 +537,7 @@
 
     while (listener.has_message()) {
       LOG(INFO) << "Privileged process running callback.";
-      callback(channel.get(), listener.get_first_message());
+      callback(channel.get(), listener.get_first_message(), globals.get());
       LOG(INFO) << "Privileged process finishing callback.";
       listener.pop_first_message();
     }
@@ -556,7 +566,8 @@
 }
 
 void SendSharedMemoryHandleCallback(IPC::Sender* sender,
-                                    const IPC::Message& message) {
+                                    const IPC::Message& message,
+                                    ChildProcessGlobals* globals) {
   bool success = CheckContentsOfMessage1(message, kDataBuffer1);
   SendControlMessage(sender, success);
 }
@@ -582,7 +593,8 @@
 }
 
 void SendSharedMemoryHandleLongCallback(IPC::Sender* sender,
-                                        const IPC::Message& message) {
+                                        const IPC::Message& message,
+                                        ChildProcessGlobals* globals) {
   std::string buffer(1 << 23, 'a');
   bool success = CheckContentsOfMessage1(message, buffer);
   SendControlMessage(sender, success);
@@ -610,7 +622,8 @@
 
 void SendTwoMessagesDifferentSharedMemoryHandleCallback(
     IPC::Sender* sender,
-    const IPC::Message& message) {
+    const IPC::Message& message,
+    ChildProcessGlobals* globals) {
   static int count = 0;
   static bool success = true;
   ++count;
@@ -654,7 +667,8 @@
 
 void SendTwoMessagesSameSharedMemoryHandleCallback(
     IPC::Sender* sender,
-    const IPC::Message& message) {
+    const IPC::Message& message,
+    ChildProcessGlobals* globals) {
   static int count = 0;
   static base::SharedMemoryHandle handle1;
   ++count;
@@ -701,7 +715,8 @@
 
 void SendOneMessageWithTwoDifferentSharedMemoryHandlesCallback(
     IPC::Sender* sender,
-    const IPC::Message& message) {
+    const IPC::Message& message,
+    ChildProcessGlobals* globals) {
   base::SharedMemoryHandle handle1;
   base::SharedMemoryHandle handle2;
   if (!GetSharedMemoryHandlesFromMsg2(message, &handle1, &handle2)) {
@@ -745,7 +760,8 @@
 
 void SendOneMessageWithTwoSameSharedMemoryHandlesCallback(
     IPC::Sender* sender,
-    const IPC::Message& message) {
+    const IPC::Message& message,
+    ChildProcessGlobals* globals) {
   base::SharedMemoryHandle handle1;
   base::SharedMemoryHandle handle2;
   if (!GetSharedMemoryHandlesFromMsg2(message, &handle1, &handle2)) {
@@ -802,7 +818,8 @@
 }
 
 void SendPosixFDAndMachPortCallback(IPC::Sender* sender,
-                                    const IPC::Message& message) {
+                                    const IPC::Message& message,
+                                    ChildProcessGlobals* globals) {
   TestSharedMemoryHandleMsg3::Schema::Param p;
   if (!TestSharedMemoryHandleMsg3::Read(&message, &p)) {
     LOG(ERROR) << "Failed to deserialize message.";
@@ -883,7 +900,8 @@
 }
 
 void SendSharedMemoryHandleToSelfCallback(IPC::Sender* sender,
-                                          const IPC::Message&) {
+                                          const IPC::Message&,
+                                          ChildProcessGlobals* globals) {
   // Do nothing special. The default behavior already runs the
   // AttachmentBrokerPrivilegedMac.
 }
@@ -937,7 +955,8 @@
 }
 
 void SendSharedMemoryHandleChannelProxyCallback(IPC::Sender* sender,
-                                                const IPC::Message& message) {
+                                                const IPC::Message& message,
+                                                ChildProcessGlobals* globals) {
   bool success = CheckContentsOfMessage1(message, kDataBuffer1);
   SendControlMessage(sender, success);
 }
@@ -971,7 +990,9 @@
   CommonTearDown();
 }
 
-void ShareToProcessCallback(IPC::Sender* sender, const IPC::Message& message) {
+void ShareToProcessCallback(IPC::Sender* sender,
+                            const IPC::Message& message,
+                            ChildProcessGlobals* globals) {
   bool success = CheckContentsOfMessage1(message, kDataBuffer1);
   SendControlMessage(sender, success);
 }
@@ -1004,7 +1025,8 @@
 }
 
 void ShareReadOnlyToProcessCallback(IPC::Sender* sender,
-                                    const IPC::Message& message) {
+                                    const IPC::Message& message,
+                                    ChildProcessGlobals* globals) {
   base::SharedMemoryHandle shm(GetSharedMemoryHandleFromMsg1(message));
 
   // Try to map the memory as writable.
@@ -1032,4 +1054,102 @@
                                      "ShareReadOnlyToProcess");
 }
 
+// Similar to SendSharedMemoryHandleToSelf, but the child process pretends to
+// not have the task port for the parent process.
+TEST_F(IPCAttachmentBrokerMacTest, SendSharedMemoryHandleToSelfDelayedPort) {
+  // Mach-based SharedMemory isn't support on OSX 10.6.
+  if (base::mac::IsOSSnowLeopard())
+    return;
+
+  SetBroker(new MockBroker);
+  CommonSetUp("SendSharedMemoryHandleToSelfDelayedPort");
+
+  // Technically, the channel is an endpoint, but we need the proxy listener to
+  // receive the messages so that it can quit the message loop.
+  channel()->SetAttachmentBrokerEndpoint(false);
+  get_proxy_listener()->set_listener(get_broker());
+
+  {
+    scoped_ptr<base::SharedMemory> shared_memory(
+        MakeSharedMemory(kDataBuffer1));
+    mach_port_urefs_t ref_count = IPC::GetMachRefCount(
+        shared_memory->handle().GetMemoryObject(), MACH_PORT_RIGHT_SEND);
+
+    std::vector<IPC::BrokerableAttachment::AttachmentId> ids;
+    const int kMessagesToTest = 3;
+    for (int i = 0; i < kMessagesToTest; ++i) {
+      base::SharedMemoryHandle h = shared_memory->handle().Duplicate();
+      ids.push_back(
+          IPC::BrokerableAttachment::AttachmentId::CreateIdWithRandomNonce());
+      IPC::internal::MachPortAttachmentMac::WireFormat wire_format(
+          h.GetMemoryObject(), getpid(), ids[i]);
+      sender()->Send(new AttachmentBrokerMsg_DuplicateMachPort(wire_format));
+
+      // Send a dummy message, which will trigger the callback handler in the
+      // child process.
+      sender()->Send(new TestSharedMemoryHandleMsg4(1));
+    }
+
+    int received_message_count = 0;
+    while (received_message_count < kMessagesToTest) {
+      // Wait until the child process has sent this process a message.
+      base::MessageLoop::current()->Run();
+
+      // Wait for any asynchronous activity to complete.
+      base::MessageLoop::current()->RunUntilIdle();
+
+      while (get_proxy_listener()->has_message()) {
+        get_proxy_listener()->pop_first_message();
+        received_message_count++;
+      }
+    }
+
+    for (int i = 0; i < kMessagesToTest; ++i) {
+      IPC::BrokerableAttachment::AttachmentId* id = &ids[i];
+      ASSERT_TRUE(id);
+      scoped_refptr<IPC::BrokerableAttachment> received_attachment;
+      get_broker()->GetAttachmentWithId(*id, &received_attachment);
+      ASSERT_NE(received_attachment.get(), nullptr);
+
+      base::mac::ScopedMachSendRight memory_object(
+          GetMachPortFromBrokeredAttachment(received_attachment));
+      ASSERT_EQ(shared_memory->handle().GetMemoryObject(), memory_object);
+    }
+
+    // Check that the ref count hasn't changed.
+    EXPECT_EQ(ref_count,
+              IPC::GetMachRefCount(shared_memory->handle().GetMemoryObject(),
+                                   MACH_PORT_RIGHT_SEND));
+  }
+
+  FinalCleanUp();
+}
+
+void SendSharedMemoryHandleToSelfDelayedPortCallback(
+    IPC::Sender* sender,
+    const IPC::Message& message,
+    ChildProcessGlobals* globals) {
+  static int i = 0;
+  static base::ProcessId pid = message.get_sender_pid();
+  static mach_port_t task_port = globals->port_provider.TaskForPid(pid);
+  ++i;
+
+  if (i == 1) {
+    // Pretend to not have the task port for the parent.
+    globals->port_provider.ClearPortMap();
+  } else if (i == 2) {
+    // Intentionally do nothing.
+  } else if (i == 3) {
+    // Setting the task port should trigger callbacks, eventually resulting in
+    // multiple attachment broker messages.
+    globals->port_provider.InsertEntry(pid, task_port);
+  }
+}
+
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandleToSelfDelayedPort) {
+  return CommonPrivilegedProcessMain(
+      &SendSharedMemoryHandleToSelfDelayedPortCallback,
+      "SendSharedMemoryHandleToSelfDelayedPort");
+}
+
 }  // namespace
diff --git a/ipc/attachment_broker_privileged.h b/ipc/attachment_broker_privileged.h
index 5520af2f..5a55e67da 100644
--- a/ipc/attachment_broker_privileged.h
+++ b/ipc/attachment_broker_privileged.h
@@ -71,12 +71,14 @@
     ERROR_MAKE_RECEIVE_PORT = 6,
     // Couldn't change the attributes of a Mach port.
     ERROR_SET_ATTRIBUTES = 7,
-    // Couldn't extract a right.
-    ERROR_EXTRACT_RIGHT = 8,
+    // Couldn't extract a right from the destination.
+    ERROR_EXTRACT_DEST_RIGHT = 8,
     // Couldn't send a Mach port in a call to mach_msg().
     ERROR_SEND_MACH_PORT = 9,
     // Couldn't decrease the ref count on a Mach port.
     ERROR_DECREASE_REF = 10,
+    // Couldn't extract a right from the source.
+    ERROR_EXTRACT_SOURCE_RIGHT = 11,
     ERROR_MAX
   };
 
diff --git a/ipc/attachment_broker_privileged_mac.cc b/ipc/attachment_broker_privileged_mac.cc
index 8965eb5..16dbff4 100644
--- a/ipc/attachment_broker_privileged_mac.cc
+++ b/ipc/attachment_broker_privileged_mac.cc
@@ -55,9 +55,23 @@
 
 AttachmentBrokerPrivilegedMac::AttachmentBrokerPrivilegedMac(
     base::PortProvider* port_provider)
-    : port_provider_(port_provider) {}
+    : port_provider_(port_provider) {
+  port_provider_->AddObserver(this);
+}
 
-AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {}
+AttachmentBrokerPrivilegedMac::~AttachmentBrokerPrivilegedMac() {
+  port_provider_->RemoveObserver(this);
+  {
+    base::AutoLock l(precursors_lock_);
+    for (auto it : precursors_)
+      delete it.second;
+  }
+  {
+    base::AutoLock l(extractors_lock_);
+    for (auto it : extractors_)
+      delete it.second;
+  }
+}
 
 bool AttachmentBrokerPrivilegedMac::SendAttachmentToProcess(
     const scoped_refptr<IPC::BrokerableAttachment>& attachment,
@@ -68,25 +82,11 @@
           static_cast<internal::MachPortAttachmentMac*>(attachment.get());
       MachPortWireFormat wire_format =
           mach_port_attachment->GetWireFormat(destination_process);
-
-      if (destination_process == base::Process::Current().Pid()) {
-        RouteWireFormatToSelf(wire_format);
-        mach_port_attachment->reset_mach_port_ownership();
-        return true;
-      }
-
-      mach_port_name_t intermediate_port = CreateIntermediateMachPort(
-          wire_format.destination_process,
-          base::mac::ScopedMachSendRight(wire_format.mach_port));
+      AddPrecursor(wire_format.destination_process,
+                   base::mac::ScopedMachSendRight(wire_format.mach_port),
+                   wire_format.attachment_id);
       mach_port_attachment->reset_mach_port_ownership();
-      if (intermediate_port == MACH_PORT_NULL) {
-        LogError(ERROR_MAKE_INTERMEDIATE);
-        return false;
-      }
-
-      MachPortWireFormat intermediate_wire_format =
-          CopyWireFormat(wire_format, intermediate_port);
-      RouteWireFormatToAnother(intermediate_wire_format);
+      SendPrecursorsForProcess(wire_format.destination_process);
       return true;
     }
     default:
@@ -106,8 +106,39 @@
   return handled;
 }
 
+void AttachmentBrokerPrivilegedMac::OnReceivedTaskPort(
+    base::ProcessHandle process) {
+  SendPrecursorsForProcess(process);
+}
+
+AttachmentBrokerPrivilegedMac::AttachmentPrecursor::AttachmentPrecursor(
+    const base::ProcessId& pid,
+    base::mac::ScopedMachSendRight port,
+    const BrokerableAttachment::AttachmentId& id)
+    : pid_(pid), port_(port.release()), id_(id) {}
+
+AttachmentBrokerPrivilegedMac::AttachmentPrecursor::~AttachmentPrecursor() {}
+
+base::mac::ScopedMachSendRight
+AttachmentBrokerPrivilegedMac::AttachmentPrecursor::TakePort() {
+  return base::mac::ScopedMachSendRight(port_.release());
+}
+
+AttachmentBrokerPrivilegedMac::AttachmentExtractor::AttachmentExtractor(
+    const base::ProcessId& source_pid,
+    const base::ProcessId& dest_pid,
+    mach_port_name_t port,
+    const BrokerableAttachment::AttachmentId& id)
+    : source_pid_(source_pid),
+      dest_pid_(dest_pid),
+      port_to_extract_(port),
+      id_(id) {}
+
+AttachmentBrokerPrivilegedMac::AttachmentExtractor::~AttachmentExtractor() {}
+
 void AttachmentBrokerPrivilegedMac::OnDuplicateMachPort(
     const IPC::Message& message) {
+  DCHECK_NE(0, message.get_sender_pid());
   AttachmentBrokerMsg_DuplicateMachPort::Param param;
   if (!AttachmentBrokerMsg_DuplicateMachPort::Read(&message, &param)) {
     LogError(ERROR_PARSE_DUPLICATE_MACH_PORT_MESSAGE);
@@ -121,31 +152,18 @@
     return;
   }
 
-  // Acquire a send right to the Mach port.
-  base::ProcessId sender_pid = message.get_sender_pid();
-  DCHECK_NE(sender_pid, base::GetCurrentProcId());
-  base::mac::ScopedMachSendRight send_right(
-      AcquireSendRight(sender_pid, wire_format.mach_port));
-
-  if (wire_format.destination_process == base::GetCurrentProcId()) {
-    // Intentionally leak the reference, as the consumer of the Chrome IPC
-    // message will take ownership.
-    mach_port_t final_mach_port = send_right.release();
-    MachPortWireFormat final_wire_format(
-        CopyWireFormat(wire_format, final_mach_port));
-    RouteWireFormatToSelf(final_wire_format);
-    return;
-  }
-
-  mach_port_name_t intermediate_mach_port = CreateIntermediateMachPort(
-      wire_format.destination_process,
-      base::mac::ScopedMachSendRight(send_right.release()));
-  RouteWireFormatToAnother(CopyWireFormat(wire_format, intermediate_mach_port));
+  AddExtractor(message.get_sender_pid(), wire_format.destination_process,
+               wire_format.mach_port, wire_format.attachment_id);
+  ProcessExtractorsForProcess(message.get_sender_pid());
 }
 
-void AttachmentBrokerPrivilegedMac::RouteWireFormatToSelf(
-    const MachPortWireFormat& wire_format) {
-  DCHECK_EQ(wire_format.destination_process, base::Process::Current().Pid());
+void AttachmentBrokerPrivilegedMac::RoutePrecursorToSelf(
+    AttachmentPrecursor* precursor) {
+  DCHECK_EQ(base::Process::Current().Pid(), precursor->pid());
+
+  // Intentionally leak the port, since the attachment takes ownership.
+  internal::MachPortAttachmentMac::WireFormat wire_format(
+      precursor->TakePort().release(), precursor->pid(), precursor->id());
   scoped_refptr<BrokerableAttachment> attachment(
       new internal::MachPortAttachmentMac(wire_format));
   HandleReceivedAttachment(attachment);
@@ -173,19 +191,6 @@
 }
 
 mach_port_name_t AttachmentBrokerPrivilegedMac::CreateIntermediateMachPort(
-    base::ProcessId pid,
-    base::mac::ScopedMachSendRight port_to_insert) {
-  DCHECK_NE(pid, base::GetCurrentProcId());
-  mach_port_t task_port = port_provider_->TaskForPid(pid);
-  if (task_port == MACH_PORT_NULL) {
-    LogError(ERROR_TASK_FOR_PID);
-    return MACH_PORT_NULL;
-  }
-  return CreateIntermediateMachPort(
-      task_port, base::mac::ScopedMachSendRight(port_to_insert.release()));
-}
-
-mach_port_name_t AttachmentBrokerPrivilegedMac::CreateIntermediateMachPort(
     mach_port_t task_port,
     base::mac::ScopedMachSendRight port_to_insert) {
   DCHECK_NE(mach_task_self(), task_port);
@@ -219,7 +224,7 @@
       mach_port_extract_right(task_port, endpoint, MACH_MSG_TYPE_MAKE_SEND_ONCE,
                               &send_once_right, &send_right_type);
   if (kr != KERN_SUCCESS) {
-    LogError(ERROR_EXTRACT_RIGHT);
+    LogError(ERROR_EXTRACT_DEST_RIGHT);
     mach_port_deallocate(task_port, endpoint);
     return MACH_PORT_NULL;
   }
@@ -263,8 +268,10 @@
   kern_return_t kr =
       mach_port_extract_right(task_port, named_right, MACH_MSG_TYPE_COPY_SEND,
                               &extracted_right, &extracted_right_type);
-  if (kr != KERN_SUCCESS)
+  if (kr != KERN_SUCCESS) {
+    LogError(ERROR_EXTRACT_SOURCE_RIGHT);
     return base::mac::ScopedMachSendRight(MACH_PORT_NULL);
+  }
 
   DCHECK_EQ(static_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND),
             extracted_right_type);
@@ -288,4 +295,108 @@
                             wire_format.attachment_id);
 }
 
+void AttachmentBrokerPrivilegedMac::SendPrecursorsForProcess(
+    base::ProcessId pid) {
+  base::AutoLock l(precursors_lock_);
+  auto it = precursors_.find(pid);
+  if (it == precursors_.end())
+    return;
+
+  // Whether this process is the destination process.
+  bool to_self = pid == base::GetCurrentProcId();
+
+  mach_port_t task_port = port_provider_->TaskForPid(pid);
+  if (!to_self && task_port == MACH_PORT_NULL)
+    return;
+
+  while (!it->second->empty()) {
+    auto precursor_it = it->second->begin();
+    if (to_self)
+      RoutePrecursorToSelf(*precursor_it);
+    else
+      SendPrecursor(*precursor_it, task_port);
+    it->second->erase(precursor_it);
+  }
+
+  delete it->second;
+  precursors_.erase(it);
+}
+
+void AttachmentBrokerPrivilegedMac::SendPrecursor(
+    AttachmentPrecursor* precursor,
+    mach_port_t task_port) {
+  DCHECK(task_port);
+  internal::MachPortAttachmentMac::WireFormat wire_format(
+      MACH_PORT_NULL, precursor->pid(), precursor->id());
+  base::mac::ScopedMachSendRight port_to_insert = precursor->TakePort();
+  mach_port_name_t intermediate_port = MACH_PORT_NULL;
+  if (port_to_insert.get() != MACH_PORT_NULL) {
+    intermediate_port = CreateIntermediateMachPort(
+        task_port, base::mac::ScopedMachSendRight(port_to_insert.release()));
+  }
+  RouteWireFormatToAnother(CopyWireFormat(wire_format, intermediate_port));
+}
+
+void AttachmentBrokerPrivilegedMac::AddPrecursor(
+    base::ProcessId pid,
+    base::mac::ScopedMachSendRight port,
+    const BrokerableAttachment::AttachmentId& id) {
+  base::AutoLock l(precursors_lock_);
+  auto it = precursors_.find(pid);
+  if (it == precursors_.end())
+    precursors_[pid] = new ScopedVector<AttachmentPrecursor>;
+
+  precursors_[pid]->push_back(new AttachmentPrecursor(
+      pid, base::mac::ScopedMachSendRight(port.release()), id));
+}
+
+void AttachmentBrokerPrivilegedMac::ProcessExtractorsForProcess(
+    base::ProcessId pid) {
+  base::AutoLock l(extractors_lock_);
+  auto it = extractors_.find(pid);
+  if (it == extractors_.end())
+    return;
+
+  mach_port_t task_port = port_provider_->TaskForPid(pid);
+  if (task_port == MACH_PORT_NULL)
+    return;
+
+  while (!it->second->empty()) {
+    auto extractor_it = it->second->begin();
+    ProcessExtractor(*extractor_it, task_port);
+    it->second->erase(extractor_it);
+  }
+
+  delete it->second;
+  extractors_.erase(it);
+}
+
+void AttachmentBrokerPrivilegedMac::ProcessExtractor(
+    AttachmentExtractor* extractor,
+    mach_port_t task_port) {
+  DCHECK(task_port);
+  base::mac::ScopedMachSendRight send_right =
+      ExtractNamedRight(task_port, extractor->port());
+  AddPrecursor(extractor->dest_pid(),
+               base::mac::ScopedMachSendRight(send_right.release()),
+               extractor->id());
+  SendPrecursorsForProcess(extractor->dest_pid());
+}
+
+void AttachmentBrokerPrivilegedMac::AddExtractor(
+    base::ProcessId source_pid,
+    base::ProcessId dest_pid,
+    mach_port_name_t port,
+    const BrokerableAttachment::AttachmentId& id) {
+  base::AutoLock l(extractors_lock_);
+  DCHECK_NE(base::GetCurrentProcId(), source_pid);
+
+  auto it = extractors_.find(source_pid);
+  if (it == extractors_.end())
+    extractors_[source_pid] = new ScopedVector<AttachmentExtractor>;
+
+  extractors_[source_pid]->push_back(
+      new AttachmentExtractor(source_pid, dest_pid, port, id));
+}
+
 }  // namespace IPC
diff --git a/ipc/attachment_broker_privileged_mac.h b/ipc/attachment_broker_privileged_mac.h
index e54d8462..36abaf3 100644
--- a/ipc/attachment_broker_privileged_mac.h
+++ b/ipc/attachment_broker_privileged_mac.h
@@ -7,9 +7,14 @@
 
 #include <mach/mach.h>
 
+#include <map>
+
 #include "base/gtest_prod_util.h"
 #include "base/mac/scoped_mach_port.h"
+#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
 #include "base/process/port_provider_mac.h"
+#include "base/synchronization/lock.h"
 #include "ipc/attachment_broker_privileged.h"
 #include "ipc/ipc_export.h"
 #include "ipc/mach_port_attachment_mac.h"
@@ -49,7 +54,8 @@
 // For the rest of this file, and the corresponding implementation file, R will
 // be called the "intermediate Mach port" and M3 the "final Mach port".
 class IPC_EXPORT AttachmentBrokerPrivilegedMac
-    : public AttachmentBrokerPrivileged {
+    : public AttachmentBrokerPrivileged,
+      public base::PortProvider::Observer {
  public:
   explicit AttachmentBrokerPrivilegedMac(base::PortProvider* port_provider);
   ~AttachmentBrokerPrivilegedMac() override;
@@ -62,6 +68,9 @@
   // IPC::Listener overrides.
   bool OnMessageReceived(const Message& message) override;
 
+  // base::PortProvider::Observer override.
+  void OnReceivedTaskPort(base::ProcessHandle process) override;
+
  private:
   FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerPrivilegedMacMultiProcessTest,
                            InsertRight);
@@ -70,6 +79,58 @@
   FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerPrivilegedMacMultiProcessTest,
                            InsertTwoRights);
   using MachPortWireFormat = internal::MachPortAttachmentMac::WireFormat;
+
+  // Contains all the information necessary to broker an attachment into a
+  // destination process. The only thing that prevents an AttachmentPrecusor
+  // from being immediately processed is if |port_provider_| does not yet have a
+  // task port for |pid|.
+  class IPC_EXPORT AttachmentPrecursor {
+   public:
+    AttachmentPrecursor(const base::ProcessId& pid,
+                        base::mac::ScopedMachSendRight port_to_insert,
+                        const BrokerableAttachment::AttachmentId& id);
+    ~AttachmentPrecursor();
+
+    // Caller takes ownership of |port_|.
+    base::mac::ScopedMachSendRight TakePort();
+
+    base::ProcessId pid() const { return pid_; }
+    const BrokerableAttachment::AttachmentId id() const { return id_; }
+
+   private:
+    // The pid of the destination process.
+    const base::ProcessId pid_;
+    // The final Mach port, as per definition at the top of this file.
+    base::mac::ScopedMachSendRight port_;
+    // The id of the attachment.
+    const BrokerableAttachment::AttachmentId id_;
+    DISALLOW_COPY_AND_ASSIGN(AttachmentPrecursor);
+  };
+
+  // Contains all the information necessary to extract a send right and create
+  // an AttachmentPrecursor. The only thing that prevents an AttachmentExtractor
+  // from being immediately processed is if |port_provider_| does not yet have a
+  // task port for |source_pid|.
+  class IPC_EXPORT AttachmentExtractor {
+   public:
+    AttachmentExtractor(const base::ProcessId& source_pid,
+                        const base::ProcessId& dest_pid,
+                        mach_port_name_t port,
+                        const BrokerableAttachment::AttachmentId& id);
+    ~AttachmentExtractor();
+
+    base::ProcessId source_pid() const { return source_pid_; }
+    base::ProcessId dest_pid() const { return dest_pid_; }
+    mach_port_name_t port() const { return port_to_extract_; }
+    const BrokerableAttachment::AttachmentId id() const { return id_; }
+
+   private:
+    const base::ProcessId source_pid_;
+    const base::ProcessId dest_pid_;
+    mach_port_name_t port_to_extract_;
+    const BrokerableAttachment::AttachmentId id_;
+  };
+
   // IPC message handlers.
   void OnDuplicateMachPort(const Message& message);
 
@@ -78,20 +139,14 @@
   MachPortWireFormat DuplicateMachPort(const MachPortWireFormat& wire_format,
                                        base::ProcessId source_process);
 
-  // |pid| must be another process.
+  // |task_port| is the task port of another process.
   // |port_to_insert| must be a send right in the current task's name space.
   // Creates an intermediate Mach port in |pid| and sends |port_to_insert| as a
   // mach_msg to the intermediate Mach port.
-  // On success, returns the name of the intermediate Mach port.
-  // On failure, returns |MACH_PORT_NULL|.
+  // Returns the intermediate port on success, and MACH_PORT_NULL on failure.
   // This method takes ownership of |port_to_insert|. On success, ownership is
   // passed to the intermediate Mach port.
   mach_port_name_t CreateIntermediateMachPort(
-      base::ProcessId pid,
-      base::mac::ScopedMachSendRight port_to_insert);
-
-  // Same as the above method, where |task_port| is the task port of |pid|.
-  mach_port_name_t CreateIntermediateMachPort(
       mach_port_t task_port,
       base::mac::ScopedMachSendRight port_to_insert);
 
@@ -115,7 +170,7 @@
   // Consumes a reference to |wire_format.mach_port|, as ownership is implicitly
   // passed to the consumer of the Chrome IPC message.
   // Makes an attachment, queues it, and notifies the observers.
-  void RouteWireFormatToSelf(const MachPortWireFormat& wire_format);
+  void RoutePrecursorToSelf(AttachmentPrecursor* precursor);
 
   // |wire_format.destination_process| must be another process.
   // |wire_format.mach_port| must be the intermediate Mach port.
@@ -123,8 +178,44 @@
   // that receives the Chrome IPC message.
   void RouteWireFormatToAnother(const MachPortWireFormat& wire_format);
 
+  // Atempts to broker all precursors whose destination is |pid|. Has no effect
+  // if |port_provider_| does not have the task port for |pid|.
+  void SendPrecursorsForProcess(base::ProcessId pid);
+
+  // Brokers a single precursor into the task represented by |task_port|.
+  void SendPrecursor(AttachmentPrecursor* precursor, mach_port_t task_port);
+
+  // Add a precursor to |precursors_|. Takes ownership of |port|.
+  void AddPrecursor(base::ProcessId pid,
+                    base::mac::ScopedMachSendRight port,
+                    const BrokerableAttachment::AttachmentId& id);
+
+  // Atempts to process all extractors whose source is |pid|. Has no effect
+  // if |port_provider_| does not have the task port for |pid|.
+  void ProcessExtractorsForProcess(base::ProcessId pid);
+
+  // Processes a single extractor whose source pid is represented by
+  // |task_port|.
+  void ProcessExtractor(AttachmentExtractor* extractor, mach_port_t task_port);
+
+  // Add an extractor to |extractors_|.
+  void AddExtractor(base::ProcessId source_pid,
+                    base::ProcessId dest_pid,
+                    mach_port_name_t port,
+                    const BrokerableAttachment::AttachmentId& id);
+
   // The port provider must live at least as long as the AttachmentBroker.
-  const base::PortProvider* port_provider_;
+  base::PortProvider* port_provider_;
+
+  // For each ProcessId, a vector of precursors that are waiting to be
+  // sent.
+  std::map<base::ProcessId, ScopedVector<AttachmentPrecursor>*> precursors_;
+  base::Lock precursors_lock_;
+
+  // For each ProcessId, a vector of extractors that are waiting to be
+  // processed.
+  std::map<base::ProcessId, ScopedVector<AttachmentExtractor>*> extractors_;
+  base::Lock extractors_lock_;
 
   DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedMac);
 };
diff --git a/ipc/attachment_broker_privileged_mac_unittest.cc b/ipc/attachment_broker_privileged_mac_unittest.cc
index 07222a3..3ad2a9d 100644
--- a/ipc/attachment_broker_privileged_mac_unittest.cc
+++ b/ipc/attachment_broker_privileged_mac_unittest.cc
@@ -119,6 +119,15 @@
   return shared_memory;
 }
 
+class MockPortProvider : public base::PortProvider {
+ public:
+  MockPortProvider() {}
+  ~MockPortProvider() override {}
+  mach_port_t TaskForPid(base::ProcessHandle process) const override {
+    return MACH_PORT_NULL;
+  }
+};
+
 }  // namespace
 
 class AttachmentBrokerPrivilegedMacMultiProcessTest
@@ -159,6 +168,9 @@
   // Child process's task port.
   base::mac::ScopedMachSendRight client_task_port_;
 
+  // Dummy port provider.
+  MockPortProvider port_provider_;
+
   base::Process child_process_;
   DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedMacMultiProcessTest);
 };
@@ -172,7 +184,7 @@
 
   SetUpChild("InsertRightClient");
   mach_msg_type_number_t original_name_count = GetActiveNameCount();
-  IPC::AttachmentBrokerPrivilegedMac broker(nullptr);
+  IPC::AttachmentBrokerPrivilegedMac broker(&port_provider_);
 
   // Create some shared memory.
   scoped_ptr<base::SharedMemory> shared_memory =
@@ -239,7 +251,7 @@
 
   SetUpChild("InsertSameRightTwiceClient");
   mach_msg_type_number_t original_name_count = GetActiveNameCount();
-  IPC::AttachmentBrokerPrivilegedMac broker(nullptr);
+  IPC::AttachmentBrokerPrivilegedMac broker(&port_provider_);
 
   // Create some shared memory.
   scoped_ptr<base::SharedMemory> shared_memory =
@@ -335,7 +347,7 @@
 
   SetUpChild("InsertTwoRightsClient");
   mach_msg_type_number_t original_name_count = GetActiveNameCount();
-  IPC::AttachmentBrokerPrivilegedMac broker(nullptr);
+  IPC::AttachmentBrokerPrivilegedMac broker(&port_provider_);
 
   for (int i = 0; i < 2; ++i) {
     // Create some shared memory.
diff --git a/ipc/ipc_channel_reader.cc b/ipc/ipc_channel_reader.cc
index f03f002..e1cdc47 100644
--- a/ipc/ipc_channel_reader.cc
+++ b/ipc/ipc_channel_reader.cc
@@ -163,7 +163,6 @@
 bool ChannelReader::HandleTranslatedMessage(
     Message* translated_message,
     const AttachmentIdVector& attachment_ids) {
-
   // Immediately handle internal messages.
   if (IsInternalMessage(*translated_message)) {
     EmitLogBeforeDispatch(*translated_message);
diff --git a/ipc/ipc_test_messages.h b/ipc/ipc_test_messages.h
index d1247cb..62af9137 100644
--- a/ipc/ipc_test_messages.h
+++ b/ipc/ipc_test_messages.h
@@ -31,4 +31,6 @@
                      base::SharedMemoryHandle,
                      base::FileDescriptor,
                      base::SharedMemoryHandle)
+IPC_MESSAGE_CONTROL1(TestSharedMemoryHandleMsg4, int)
+
 #endif  // defined(OS_MACOSX)
diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc
index 6cec880..5a94a32 100644
--- a/mandoline/app/desktop/launcher_process.cc
+++ b/mandoline/app/desktop/launcher_process.cc
@@ -21,7 +21,6 @@
 #include "mandoline/app/desktop/launcher_process.h"
 #include "mojo/runner/context.h"
 #include "mojo/runner/switches.h"
-#include "mojo/runner/tracer.h"
 #include "mojo/shell/switches.h"
 
 namespace mandoline {
@@ -46,13 +45,12 @@
 
   // We want the runner::Context to outlive the MessageLoop so that pipes are
   // all gracefully closed / error-out before we try to shut the Context down.
-  base::FilePath shell_dir;
-  PathService::Get(base::DIR_MODULE, &shell_dir);
-  mojo::runner::Context shell_context(shell_dir, &tracer);
+  mojo::runner::Context shell_context;
   {
     base::MessageLoop message_loop;
-    tracer.DidCreateMessageLoop();
-    if (!shell_context.Init()) {
+    base::FilePath shell_dir;
+    PathService::Get(base::DIR_MODULE, &shell_dir);
+    if (!shell_context.Init(shell_dir)) {
       return 0;
     }
 
diff --git a/mandoline/services/updater/DEPS b/mandoline/services/updater/DEPS
index 07502be..244d48c 100644
--- a/mandoline/services/updater/DEPS
+++ b/mandoline/services/updater/DEPS
@@ -6,4 +6,6 @@
   "+mojo/public/cpp/bindings",
   "+mojo/services/network",
   "+mojo/services/updater",
+  "+third_party/mojo/src/mojo/public/c/system",
+  "+third_party/mojo/src/mojo/public/cpp/bindings",
 ]
diff --git a/mandoline/services/updater/updater_app.cc b/mandoline/services/updater/updater_app.cc
index 0a1675c..211b648 100644
--- a/mandoline/services/updater/updater_app.cc
+++ b/mandoline/services/updater/updater_app.cc
@@ -9,7 +9,7 @@
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/application_runner.h"
-#include "mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 namespace updater {
 
diff --git a/mandoline/services/updater/updater_impl.h b/mandoline/services/updater/updater_impl.h
index b8b7dbc..e0b3e94 100644
--- a/mandoline/services/updater/updater_impl.h
+++ b/mandoline/services/updater/updater_impl.h
@@ -7,8 +7,8 @@
 
 #include "base/macros.h"
 #include "mojo/application/public/cpp/application_impl.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/services/updater/updater.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace updater {
 
diff --git a/mandoline/ui/desktop_ui/browser_manager.cc b/mandoline/ui/desktop_ui/browser_manager.cc
index bef4dd5..3cb2b69 100644
--- a/mandoline/ui/desktop_ui/browser_manager.cc
+++ b/mandoline/ui/desktop_ui/browser_manager.cc
@@ -18,7 +18,7 @@
 }  // namespace
 
 BrowserManager::BrowserManager()
-    : app_(nullptr), startup_time_(base::Time::Now()) {}
+    : app_(nullptr), startup_ticks_(base::TimeTicks::Now()) {}
 
 BrowserManager::~BrowserManager() {
   while (!browsers_.empty())
diff --git a/mandoline/ui/desktop_ui/browser_manager.h b/mandoline/ui/desktop_ui/browser_manager.h
index 88ed3fad..6eee78f8 100644
--- a/mandoline/ui/desktop_ui/browser_manager.h
+++ b/mandoline/ui/desktop_ui/browser_manager.h
@@ -37,7 +37,7 @@
   void BrowserWindowClosed(BrowserWindow* browser);
 
   // Get the time recorded just before the application message loop was started.
-  const base::Time& startup_time() const { return startup_time_; }
+  const base::TimeTicks& startup_ticks() const { return startup_ticks_; }
 
  private:
   // Overridden from LaunchHandler:
@@ -56,7 +56,7 @@
   mus::mojom::WindowTreeHostFactoryPtr host_factory_;
   mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_;
   std::set<BrowserWindow*> browsers_;
-  base::Time startup_time_;
+  const base::TimeTicks startup_ticks_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserManager);
 };
diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc
index 2b4ad48..a78e60ec 100644
--- a/mandoline/ui/desktop_ui/browser_window.cc
+++ b/mandoline/ui/desktop_ui/browser_window.cc
@@ -170,7 +170,7 @@
   CHECK(!root_);
 
   // Record when the browser window was displayed, used for performance testing.
-  const base::Time display_time = base::Time::Now();
+  const base::TimeTicks display_ticks = base::TimeTicks::Now();
 
   root_ = root;
 
@@ -214,7 +214,8 @@
   LoadURL(default_url_);
 
   // Record the time spent opening initial tabs, used for performance testing.
-  const base::TimeDelta open_tabs_delta = base::Time::Now() - display_time;
+  const base::TimeDelta open_tabs_delta =
+      base::TimeTicks::Now() - display_ticks;
 
   // Record the browser startup time metrics, used for performance testing.
   static bool recorded_browser_startup_metrics = false;
@@ -225,10 +226,10 @@
     request->url = mojo::String::From("mojo:tracing");
     tracing::StartupPerformanceDataCollectorPtr collector;
     app_->ConnectToService(request.Pass(), &collector);
-    collector->SetBrowserWindowDisplayTime(display_time.ToInternalValue());
+    collector->SetBrowserWindowDisplayTicks(display_ticks.ToInternalValue());
     collector->SetBrowserOpenTabsTimeDelta(open_tabs_delta.ToInternalValue());
-    collector->SetBrowserMessageLoopStartTime(
-        manager_->startup_time().ToInternalValue());
+    collector->SetBrowserMessageLoopStartTicks(
+        manager_->startup_ticks().ToInternalValue());
     recorded_browser_startup_metrics = true;
   }
 }
diff --git a/media/mojo/services/media_type_converters.h b/media/mojo/services/media_type_converters.h
index 0133a99..5d5f278 100644
--- a/media/mojo/services/media_type_converters.h
+++ b/media/mojo/services/media_type_converters.h
@@ -9,7 +9,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
 #include "media/mojo/interfaces/media_types.mojom.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
 
 namespace media {
 class AudioDecoderConfig;
diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h
index c669a74b..f042dded 100644
--- a/media/mojo/services/mojo_cdm_service.h
+++ b/media/mojo/services/mojo_cdm_service.h
@@ -15,7 +15,7 @@
 #include "media/mojo/services/mojo_cdm_promise.h"
 #include "media/mojo/services/mojo_cdm_service_context.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace media {
 
diff --git a/media/mojo/services/service_factory_impl.h b/media/mojo/services/service_factory_impl.h
index 8357f8a..508a7d1 100644
--- a/media/mojo/services/service_factory_impl.h
+++ b/media/mojo/services/service_factory_impl.h
@@ -9,7 +9,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "media/mojo/services/mojo_cdm_service_context.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 class AppRefCount;
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index 584421b..da4601d 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -96,8 +96,6 @@
 
   deps += [
     "//mojo/package_manager:unittests",
-    "//mojo/runner:apptests",
-    "//mojo/runner:mojo_runner_unittests",
     "//mojo/services/network:apptests",
     "//mojo/shell:mojo_shell_unittests",
   ]
diff --git a/mojo/android/javatests/mojo_test_case.cc b/mojo/android/javatests/mojo_test_case.cc
index 22a08ff6..9170fd0 100644
--- a/mojo/android/javatests/mojo_test_case.cc
+++ b/mojo/android/javatests/mojo_test_case.cc
@@ -14,7 +14,7 @@
 #include "base/test/test_support_android.h"
 #include "jni/MojoTestCase_jni.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace {
 
diff --git a/mojo/android/javatests/validation_test_util.cc b/mojo/android/javatests/validation_test_util.cc
index 1fb0abf..8179fd6 100644
--- a/mojo/android/javatests/validation_test_util.cc
+++ b/mojo/android/javatests/validation_test_util.cc
@@ -9,7 +9,7 @@
 #include "base/android/scoped_java_ref.h"
 #include "base/test/test_support_android.h"
 #include "jni/ValidationTestUtil_jni.h"
-#include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
 
 namespace mojo {
 namespace android {
diff --git a/mojo/android/system/core_impl.cc b/mojo/android/system/core_impl.cc
index 21589876..b474cb6 100644
--- a/mojo/android/system/core_impl.cc
+++ b/mojo/android/system/core_impl.cc
@@ -13,9 +13,9 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "jni/CoreImpl_jni.h"
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace {
 
diff --git a/mojo/application/public/cpp/application_delegate.h b/mojo/application/public/cpp/application_delegate.h
index a378490..22deec75 100644
--- a/mojo/application/public/cpp/application_delegate.h
+++ b/mojo/application/public/cpp/application_delegate.h
@@ -7,7 +7,7 @@
 
 #include <string>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/application_impl.h b/mojo/application/public/cpp/application_impl.h
index 90e79596..53ab791 100644
--- a/mojo/application/public/cpp/application_impl.h
+++ b/mojo/application/public/cpp/application_impl.h
@@ -15,9 +15,9 @@
 #include "mojo/application/public/cpp/lib/service_registry.h"
 #include "mojo/application/public/interfaces/application.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/application_test_base.h b/mojo/application/public/cpp/application_test_base.h
index 5b0fab10..d10ee81e 100644
--- a/mojo/application/public/cpp/application_test_base.h
+++ b/mojo/application/public/cpp/application_test_base.h
@@ -7,10 +7,10 @@
 
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/interfaces/application.mojom.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/interface_factory.h b/mojo/application/public/cpp/interface_factory.h
index c7dd839..2dc0cbc 100644
--- a/mojo/application/public/cpp/interface_factory.h
+++ b/mojo/application/public/cpp/interface_factory.h
@@ -5,7 +5,7 @@
 #ifndef MOJO_APPLICATION_PUBLIC_CPP_INTERFACE_FACTORY_H_
 #define MOJO_APPLICATION_PUBLIC_CPP_INTERFACE_FACTORY_H_
 
-#include "mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc
index 6d2fb46..7e9781c 100644
--- a/mojo/application/public/cpp/lib/application_impl.cc
+++ b/mojo/application/public/cpp/lib/application_impl.cc
@@ -10,8 +10,8 @@
 #include "base/message_loop/message_loop.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/lib/service_registry.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/lib/application_test_base.cc b/mojo/application/public/cpp/lib/application_test_base.cc
index 9d6536e..8f07f1f 100644
--- a/mojo/application/public/cpp/lib/application_test_base.cc
+++ b/mojo/application/public/cpp/lib/application_test_base.cc
@@ -8,9 +8,9 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/interfaces/application.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace test {
diff --git a/mojo/application/public/cpp/lib/application_test_main.cc b/mojo/application/public/cpp/lib/application_test_main.cc
index 5d208c3..8b4c50b 100644
--- a/mojo/application/public/cpp/lib/application_test_main.cc
+++ b/mojo/application/public/cpp/lib/application_test_main.cc
@@ -8,7 +8,7 @@
 #include "mojo/application/public/cpp/application_runner.h"
 #include "mojo/application/public/cpp/application_test_base.h"
 #include "mojo/logging/init_logging.h"
-#include "mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 MojoResult MojoMain(MojoHandle handle) {
   // An AtExitManager instance is needed to construct message loops.
diff --git a/mojo/application/public/cpp/lib/content_handler_factory.cc b/mojo/application/public/cpp/lib/content_handler_factory.cc
index b01868cc..ccd2333d 100644
--- a/mojo/application/public/cpp/lib/content_handler_factory.cc
+++ b/mojo/application/public/cpp/lib/content_handler_factory.cc
@@ -18,7 +18,7 @@
 #include "mojo/application/public/cpp/application_runner.h"
 #include "mojo/application/public/cpp/interface_factory_impl.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/lib/interface_factory_connector.h b/mojo/application/public/cpp/lib/interface_factory_connector.h
index 8d13bc2..88834a0 100644
--- a/mojo/application/public/cpp/lib/interface_factory_connector.h
+++ b/mojo/application/public/cpp/lib/interface_factory_connector.h
@@ -7,7 +7,7 @@
 
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/application/public/cpp/service_connector.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 
 namespace mojo {
 namespace internal {
diff --git a/mojo/application/public/cpp/lib/service_connector_registry.h b/mojo/application/public/cpp/lib/service_connector_registry.h
index b196353..20ad5ff 100644
--- a/mojo/application/public/cpp/lib/service_connector_registry.h
+++ b/mojo/application/public/cpp/lib/service_connector_registry.h
@@ -8,7 +8,7 @@
 #include <map>
 #include <string>
 
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/lib/service_provider_impl.cc b/mojo/application/public/cpp/lib/service_provider_impl.cc
index 6a9282c..cdddad3 100644
--- a/mojo/application/public/cpp/lib/service_provider_impl.cc
+++ b/mojo/application/public/cpp/lib/service_provider_impl.cc
@@ -5,7 +5,7 @@
 #include "mojo/application/public/cpp/service_provider_impl.h"
 
 #include "mojo/application/public/cpp/service_connector.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/lib/service_registry.h b/mojo/application/public/cpp/lib/service_registry.h
index c3610bf..aa209dc9 100644
--- a/mojo/application/public/cpp/lib/service_registry.h
+++ b/mojo/application/public/cpp/lib/service_registry.h
@@ -12,7 +12,7 @@
 #include "mojo/application/public/cpp/lib/service_connector_registry.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
 namespace mojo {
 namespace internal {
diff --git a/mojo/application/public/cpp/service_connector.h b/mojo/application/public/cpp/service_connector.h
index 3a7d6568..498d458 100644
--- a/mojo/application/public/cpp/service_connector.h
+++ b/mojo/application/public/cpp/service_connector.h
@@ -7,7 +7,7 @@
 
 #include <string>
 
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 
diff --git a/mojo/application/public/cpp/service_provider_impl.h b/mojo/application/public/cpp/service_provider_impl.h
index 0a9fb77..2e19a86 100644
--- a/mojo/application/public/cpp/service_provider_impl.h
+++ b/mojo/application/public/cpp/service_provider_impl.h
@@ -10,7 +10,7 @@
 #include "mojo/application/public/cpp/lib/interface_factory_connector.h"
 #include "mojo/application/public/cpp/lib/service_connector_registry.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 
diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn
index 0d8f355..51599b4 100644
--- a/mojo/common/BUILD.gn
+++ b/mojo/common/BUILD.gn
@@ -31,6 +31,10 @@
 
   defines = [ "MOJO_COMMON_IMPLEMENTATION" ]
 
+  public_deps = [
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
   deps = [
     "//base",
     "//base/third_party/dynamic_annotations",
@@ -39,7 +43,6 @@
     "//third_party/mojo/src/mojo/public/c/system:for_component",
     "//third_party/mojo/src/mojo/public/cpp/bindings",
     "//third_party/mojo/src/mojo/public/cpp/environment",
-    "//third_party/mojo/src/mojo/public/cpp/system",
   ]
 }
 
diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h
index 30a548e5..36016d3 100644
--- a/mojo/edk/embedder/embedder.h
+++ b/mojo/edk/embedder/embedder.h
@@ -13,7 +13,7 @@
 #include "base/task_runner.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/embedder_unittest.cc b/mojo/edk/embedder/embedder_unittest.cc
index f53e440..659f0ee 100644
--- a/mojo/edk/embedder/embedder_unittest.cc
+++ b/mojo/edk/embedder/embedder_unittest.cc
@@ -17,11 +17,11 @@
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/entrypoints.cc b/mojo/edk/embedder/entrypoints.cc
index 6247c5f..b491265 100644
--- a/mojo/edk/embedder/entrypoints.cc
+++ b/mojo/edk/embedder/entrypoints.cc
@@ -4,10 +4,10 @@
 
 #include "mojo/edk/embedder/embedder_internal.h"
 #include "mojo/edk/system/core.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
 
 using mojo::edk::internal::g_core;
 
diff --git a/mojo/edk/embedder/platform_channel_pair.h b/mojo/edk/embedder/platform_channel_pair.h
index 7487837..491c602e 100644
--- a/mojo/edk/embedder/platform_channel_pair.h
+++ b/mojo/edk/embedder/platform_channel_pair.h
@@ -10,7 +10,7 @@
 #include "build/build_config.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class CommandLine;
diff --git a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
index a0bb7fd4..cd9d5fe 100644
--- a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
+++ b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
@@ -25,8 +25,8 @@
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/test/test_utils.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/platform_shared_buffer.h b/mojo/edk/embedder/platform_shared_buffer.h
index c7256af..909cd76 100644
--- a/mojo/edk/embedder/platform_shared_buffer.h
+++ b/mojo/edk/embedder/platform_shared_buffer.h
@@ -11,7 +11,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/platform_support.h b/mojo/edk/embedder/platform_support.h
index 160ba79..15a300c6 100644
--- a/mojo/edk/embedder/platform_support.h
+++ b/mojo/edk/embedder/platform_support.h
@@ -9,7 +9,7 @@
 
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/process_delegate.h b/mojo/edk/embedder/process_delegate.h
index e5f90af..d8cebc34 100644
--- a/mojo/edk/embedder/process_delegate.h
+++ b/mojo/edk/embedder/process_delegate.h
@@ -6,7 +6,7 @@
 #define MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
 
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/scoped_platform_handle.h b/mojo/edk/embedder/scoped_platform_handle.h
index ae75202..ce8e28a 100644
--- a/mojo/edk/embedder/scoped_platform_handle.h
+++ b/mojo/edk/embedder/scoped_platform_handle.h
@@ -8,7 +8,7 @@
 #include "base/move.h"
 #include "mojo/edk/embedder/platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.h b/mojo/edk/embedder/simple_platform_shared_buffer.h
index 798bc3a..3235b0b 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer.h
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.h
@@ -9,7 +9,7 @@
 
 #include "mojo/edk/embedder/platform_shared_buffer.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
index a0e915e..9f174eae 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -8,8 +8,8 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/embedder/simple_platform_support.h b/mojo/edk/embedder/simple_platform_support.h
index ef97d91..91bdce0 100644
--- a/mojo/edk/embedder/simple_platform_support.h
+++ b/mojo/edk/embedder/simple_platform_support.h
@@ -7,7 +7,7 @@
 
 #include "mojo/edk/embedder/platform_support.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/drain_data.cc b/mojo/edk/js/drain_data.cc
index d8fa091..f5e6f89 100644
--- a/mojo/edk/js/drain_data.cc
+++ b/mojo/edk/js/drain_data.cc
@@ -9,8 +9,8 @@
 #include "gin/dictionary.h"
 #include "gin/per_context_data.h"
 #include "gin/per_isolate_data.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/drain_data.h b/mojo/edk/js/drain_data.h
index 63c9e49..839241f 100644
--- a/mojo/edk/js/drain_data.h
+++ b/mojo/edk/js/drain_data.h
@@ -7,8 +7,8 @@
 
 #include "base/memory/scoped_vector.h"
 #include "gin/runner.h"
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 #include "v8/include/v8.h"
 
 namespace mojo {
diff --git a/mojo/edk/js/handle.h b/mojo/edk/js/handle.h
index 9fa92b0..4257816a 100644
--- a/mojo/edk/js/handle.h
+++ b/mojo/edk/js/handle.h
@@ -9,7 +9,7 @@
 #include "gin/converter.h"
 #include "gin/handle.h"
 #include "gin/wrappable.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/handle_unittest.cc b/mojo/edk/js/handle_unittest.cc
index 6ee44445..ff15154 100644
--- a/mojo/edk/js/handle_unittest.cc
+++ b/mojo/edk/js/handle_unittest.cc
@@ -5,8 +5,8 @@
 #include "base/macros.h"
 #include "mojo/edk/js/handle.h"
 #include "mojo/edk/js/handle_close_observer.h"
-#include "mojo/public/cpp/system/core.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/mojo_runner_delegate.h b/mojo/edk/js/mojo_runner_delegate.h
index 7b50b30..9a66d88f 100644
--- a/mojo/edk/js/mojo_runner_delegate.h
+++ b/mojo/edk/js/mojo_runner_delegate.h
@@ -7,7 +7,7 @@
 
 #include "base/macros.h"
 #include "gin/modules/module_runner_delegate.h"
-#include "mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/support.cc b/mojo/edk/js/support.cc
index 3e4391ca..0e9708f 100644
--- a/mojo/edk/js/support.cc
+++ b/mojo/edk/js/support.cc
@@ -14,7 +14,7 @@
 #include "gin/wrappable.h"
 #include "mojo/edk/js/handle.h"
 #include "mojo/edk/js/waiting_callback.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/test/run_js_tests.cc b/mojo/edk/js/test/run_js_tests.cc
index 76de3e6a..1505527 100644
--- a/mojo/edk/js/test/run_js_tests.cc
+++ b/mojo/edk/js/test/run_js_tests.cc
@@ -10,8 +10,8 @@
 #include "gin/test/gtest.h"
 #include "mojo/edk/js/core.h"
 #include "mojo/edk/js/support.h"
-#include "mojo/public/cpp/environment/environment.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/tests/js_to_cpp_tests.cc b/mojo/edk/js/tests/js_to_cpp_tests.cc
index f9a9b92..97002f1 100644
--- a/mojo/edk/js/tests/js_to_cpp_tests.cc
+++ b/mojo/edk/js/tests/js_to_cpp_tests.cc
@@ -14,10 +14,10 @@
 #include "mojo/edk/js/mojo_runner_delegate.h"
 #include "mojo/edk/js/tests/js_to_cpp.mojom.h"
 #include "mojo/edk/test/test_utils.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/waiting_callback.cc b/mojo/edk/js/waiting_callback.cc
index 4d017fe..53345ac 100644
--- a/mojo/edk/js/waiting_callback.cc
+++ b/mojo/edk/js/waiting_callback.cc
@@ -7,7 +7,7 @@
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
 #include "gin/per_context_data.h"
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/js/waiting_callback.h b/mojo/edk/js/waiting_callback.h
index c1b76aa..2deedfc1 100644
--- a/mojo/edk/js/waiting_callback.h
+++ b/mojo/edk/js/waiting_callback.h
@@ -11,8 +11,8 @@
 #include "gin/wrappable.h"
 #include "mojo/edk/js/handle.h"
 #include "mojo/edk/js/handle_close_observer.h"
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/async_waiter.h b/mojo/edk/system/async_waiter.h
index 19ef5d6..b8eefa00 100644
--- a/mojo/edk/system/async_waiter.h
+++ b/mojo/edk/system/async_waiter.h
@@ -8,8 +8,8 @@
 #include "base/callback.h"
 #include "mojo/edk/system/awakable.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/awakable.h b/mojo/edk/system/awakable.h
index 2cb10f5..a99038fc 100644
--- a/mojo/edk/system/awakable.h
+++ b/mojo/edk/system/awakable.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/awakable_list.cc b/mojo/edk/system/awakable_list.cc
index 84f7e45..429e691 100644
--- a/mojo/edk/system/awakable_list.cc
+++ b/mojo/edk/system/awakable_list.cc
@@ -51,7 +51,7 @@
 
 void AwakableList::Add(Awakable* awakable,
                        MojoHandleSignals signals,
-                       uint32_t context) {
+                       uintptr_t context) {
   awakables_.push_back(AwakeInfo(awakable, signals, context));
 }
 
diff --git a/mojo/edk/system/awakable_list.h b/mojo/edk/system/awakable_list.h
index 7f8a6d6..40ce9ad 100644
--- a/mojo/edk/system/awakable_list.h
+++ b/mojo/edk/system/awakable_list.h
@@ -10,8 +10,8 @@
 #include <vector>
 
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -33,17 +33,17 @@
 
   void AwakeForStateChange(const HandleSignalsState& state);
   void CancelAll();
-  void Add(Awakable* awakable, MojoHandleSignals signals, uint32_t context);
+  void Add(Awakable* awakable, MojoHandleSignals signals, uintptr_t context);
   void Remove(Awakable* awakable);
 
  private:
   struct AwakeInfo {
-    AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint32_t context)
+    AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uintptr_t context)
         : awakable(awakable), signals(signals), context(context) {}
 
     Awakable* awakable;
     MojoHandleSignals signals;
-    uint32_t context;
+    uintptr_t context;
   };
   using AwakeInfoList = std::vector<AwakeInfo>;
 
diff --git a/mojo/edk/system/awakable_list_unittest.cc b/mojo/edk/system/awakable_list_unittest.cc
index 5b5ba8f..073af967 100644
--- a/mojo/edk/system/awakable_list_unittest.cc
+++ b/mojo/edk/system/awakable_list_unittest.cc
@@ -21,7 +21,7 @@
 
 TEST(AwakableListTest, BasicCancel) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Cancel immediately after thread start.
   {
@@ -62,7 +62,7 @@
 
 TEST(AwakableListTest, BasicAwakeSatisfied) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Awake immediately after thread start.
   {
@@ -112,7 +112,7 @@
 
 TEST(AwakableListTest, BasicAwakeUnsatisfiable) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Awake (for unsatisfiability) immediately after thread start.
   {
@@ -162,10 +162,10 @@
   MojoResult result2;
   MojoResult result3;
   MojoResult result4;
-  uint32_t context1;
-  uint32_t context2;
-  uint32_t context3;
-  uint32_t context4;
+  uintptr_t context1;
+  uintptr_t context2;
+  uintptr_t context3;
+  uintptr_t context4;
 
   // Cancel two awakables.
   {
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index 72d9338e..fe9d09f4 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -21,8 +21,8 @@
 #include "mojo/edk/system/message_pipe_dispatcher.h"
 #include "mojo/edk/system/shared_buffer_dispatcher.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -572,10 +572,13 @@
   }
   uint32_t num_added = i;
 
-  if (rv == MOJO_RESULT_ALREADY_EXISTS)
+  if (rv == MOJO_RESULT_ALREADY_EXISTS) {
     rv = MOJO_RESULT_OK;  // The i-th one is already "triggered".
-  else if (rv == MOJO_RESULT_OK)
-    rv = waiter.Wait(deadline, result_index);
+  } else if (rv == MOJO_RESULT_OK) {
+    uintptr_t uintptr_result = *result_index;
+    rv = waiter.Wait(deadline, &uintptr_result);
+    *result_index = static_cast<uint32_t>(uintptr_result);
+  }
 
   // Make sure no other dispatchers try to wake |waiter| for the current
   // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
diff --git a/mojo/edk/system/core.h b/mojo/edk/system/core.h
index 3c2154a..1e2cd3f1 100644
--- a/mojo/edk/system/core.h
+++ b/mojo/edk/system/core.h
@@ -14,11 +14,11 @@
 #include "mojo/edk/system/handle_table.h"
 #include "mojo/edk/system/mapping_table.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -69,7 +69,7 @@
   // API functions, referenced below.
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/functions.h":
+  // "third_party/mojo/src/mojo/public/c/system/functions.h":
   MojoTimeTicks GetTimeTicksNow();
   MojoResult Close(MojoHandle handle);
   MojoResult Wait(MojoHandle handle,
@@ -84,7 +84,7 @@
                       MojoHandleSignalsState* signals_states);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/message_pipe.h":
+  // "third_party/mojo/src/mojo/public/c/system/message_pipe.h":
   MojoResult CreateMessagePipe(
       const MojoCreateMessagePipeOptions* options,
       MojoHandle* message_pipe_handle0,
@@ -103,7 +103,7 @@
                          MojoReadMessageFlags flags);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/data_pipe.h":
+  // "third_party/mojo/src/mojo/public/c/system/data_pipe.h":
   MojoResult CreateDataPipe(
       const MojoCreateDataPipeOptions* options,
       MojoHandle* data_pipe_producer_handle,
@@ -130,7 +130,7 @@
                          uint32_t num_bytes_read);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/buffer.h":
+  // "third_party/mojo/src/mojo/public/c/system/buffer.h":
   MojoResult CreateSharedBuffer(
       const MojoCreateSharedBufferOptions* options,
       uint64_t num_bytes,
diff --git a/mojo/edk/system/core_test_base.cc b/mojo/edk/system/core_test_base.cc
index 5af507f..e9b5589 100644
--- a/mojo/edk/system/core_test_base.cc
+++ b/mojo/edk/system/core_test_base.cc
@@ -11,7 +11,7 @@
 #include "mojo/edk/system/configuration.h"
 #include "mojo/edk/system/core.h"
 #include "mojo/edk/system/dispatcher.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -128,7 +128,7 @@
 
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals /*signals*/,
-                                   uint32_t /*context*/,
+                                   uintptr_t /*context*/,
                                    HandleSignalsState* signals_state) override {
     info_->IncrementAddAwakableCallCount();
     lock().AssertAcquired();
diff --git a/mojo/edk/system/core_test_base.h b/mojo/edk/system/core_test_base.h
index 774dc95..84bc2e6 100644
--- a/mojo/edk/system/core_test_base.h
+++ b/mojo/edk/system/core_test_base.h
@@ -8,9 +8,9 @@
 #include "base/synchronization/lock.h"
 #include "mojo/edk/embedder/embedder_internal.h"
 #include "mojo/edk/system/test_utils.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/core_unittest.cc b/mojo/edk/system/core_unittest.cc
index 28a038c1..6dfadee 100644
--- a/mojo/edk/system/core_unittest.cc
+++ b/mojo/edk/system/core_unittest.cc
@@ -13,7 +13,7 @@
 #include "mojo/edk/system/awakable.h"
 #include "mojo/edk/system/core_test_base.h"
 #include "mojo/edk/system/test_utils.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/data_pipe.h b/mojo/edk/system/data_pipe.h
index f17416b..46a895d 100644
--- a/mojo/edk/system/data_pipe.h
+++ b/mojo/edk/system/data_pipe.h
@@ -9,9 +9,9 @@
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
index d0db351..0e73f9b 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -289,7 +289,7 @@
 MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   lock().AssertAcquired();
   if (channel_)
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.h b/mojo/edk/system/data_pipe_consumer_dispatcher.h
index 7c09346..c172c5ba 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.h
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -10,7 +10,7 @@
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -62,7 +62,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 4989786a..27113eb 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -227,7 +227,7 @@
 MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   lock().AssertAcquired();
   if (channel_)
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.h b/mojo/edk/system/data_pipe_producer_dispatcher.h
index daf038b..f07c8288 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.h
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.h
@@ -10,7 +10,7 @@
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -62,7 +62,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/mojo/edk/system/data_pipe_unittest.cc b/mojo/edk/system/data_pipe_unittest.cc
index 5c8f0f8..6c6593e6 100644
--- a/mojo/edk/system/data_pipe_unittest.cc
+++ b/mojo/edk/system/data_pipe_unittest.cc
@@ -13,11 +13,11 @@
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/dispatcher.cc b/mojo/edk/system/dispatcher.cc
index 68089a1..38994577 100644
--- a/mojo/edk/system/dispatcher.cc
+++ b/mojo/edk/system/dispatcher.cc
@@ -229,7 +229,7 @@
 
 MojoResult Dispatcher::AddAwakable(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) {
   base::AutoLock locker(lock_);
   if (is_closed_) {
@@ -381,7 +381,7 @@
 MojoResult Dispatcher::AddAwakableImplNoLock(
     Awakable* /*awakable*/,
     MojoHandleSignals /*signals*/,
-    uint32_t /*context*/,
+    uintptr_t /*context*/,
     HandleSignalsState* signals_state) {
   lock_.AssertAcquired();
   DCHECK(!is_closed_);
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
index b583bae..df1e9759 100644
--- a/mojo/edk/system/dispatcher.h
+++ b/mojo/edk/system/dispatcher.h
@@ -17,11 +17,11 @@
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -139,7 +139,7 @@
   //    that |signals| will ever be satisfied.
   MojoResult AddAwakable(Awakable* awakable,
                          MojoHandleSignals signals,
-                         uint32_t context,
+                         uintptr_t context,
                          HandleSignalsState* signals_state);
   // Removes an awakable from this dispatcher. (It is valid to call this
   // multiple times for the same |awakable| on the same object, so long as
@@ -261,7 +261,7 @@
   virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const;
   virtual MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                            MojoHandleSignals signals,
-                                           uint32_t context,
+                                           uintptr_t context,
                                            HandleSignalsState* signals_state);
   virtual void RemoveAwakableImplNoLock(Awakable* awakable,
                                         HandleSignalsState* signals_state);
diff --git a/mojo/edk/system/dispatcher_unittest.cc b/mojo/edk/system/dispatcher_unittest.cc
index 8b3017e..7145eb39 100644
--- a/mojo/edk/system/dispatcher_unittest.cc
+++ b/mojo/edk/system/dispatcher_unittest.cc
@@ -10,8 +10,8 @@
 #include "base/threading/simple_thread.h"
 #include "mojo/edk/embedder/platform_shared_buffer.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/handle_signals_state.h b/mojo/edk/system/handle_signals_state.h
index 1c47a28..2209ffa24 100644
--- a/mojo/edk/system/handle_signals_state.h
+++ b/mojo/edk/system/handle_signals_state.h
@@ -6,7 +6,7 @@
 #define MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
 
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/handle_table.h b/mojo/edk/system/handle_table.h
index de5ac05..57d1aed2 100644
--- a/mojo/edk/system/handle_table.h
+++ b/mojo/edk/system/handle_table.h
@@ -11,8 +11,8 @@
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/mapping_table.h b/mojo/edk/system/mapping_table.h
index fb2acf36..fd822989 100644
--- a/mojo/edk/system/mapping_table.h
+++ b/mojo/edk/system/mapping_table.h
@@ -12,8 +12,8 @@
 #include "base/containers/hash_tables.h"
 #include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/edk/system/master_impl.h b/mojo/edk/system/master_impl.h
index 621db13..d6d1a8d 100644
--- a/mojo/edk/system/master_impl.h
+++ b/mojo/edk/system/master_impl.h
@@ -8,7 +8,7 @@
 #include "base/process/process.h"
 #include "mojo/edk/system/master.mojom.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #if defined(OS_WIN)
 #include <windows.h>
diff --git a/mojo/edk/system/master_impl_unittest.cc b/mojo/edk/system/master_impl_unittest.cc
index a0a731e..04d656e 100644
--- a/mojo/edk/system/master_impl_unittest.cc
+++ b/mojo/edk/system/master_impl_unittest.cc
@@ -10,8 +10,8 @@
 #include "base/files/scoped_temp_dir.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/test/test_utils.h"
-#include "mojo/public/c/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/message_in_transit.h b/mojo/edk/system/message_in_transit.h
index 78dc40a..34396b8 100644
--- a/mojo/edk/system/message_in_transit.h
+++ b/mojo/edk/system/message_in_transit.h
@@ -15,7 +15,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/message_in_transit_queue.h b/mojo/edk/system/message_in_transit_queue.h
index 4a05490..a6e6adb 100644
--- a/mojo/edk/system/message_in_transit_queue.h
+++ b/mojo/edk/system/message_in_transit_queue.h
@@ -10,7 +10,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index 90b37746e..e3e67ab 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -635,7 +635,7 @@
 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   lock().AssertAcquired();
   if (channel_)
diff --git a/mojo/edk/system/message_pipe_dispatcher.h b/mojo/edk/system/message_pipe_dispatcher.h
index 02b66e4..fa7b6e7 100644
--- a/mojo/edk/system/message_pipe_dispatcher.h
+++ b/mojo/edk/system/message_pipe_dispatcher.h
@@ -11,7 +11,7 @@
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -83,7 +83,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/mojo/edk/system/message_pipe_perftest.cc b/mojo/edk/system/message_pipe_perftest.cc
index 5d59e656..053b000 100644
--- a/mojo/edk/system/message_pipe_perftest.cc
+++ b/mojo/edk/system/message_pipe_perftest.cc
@@ -12,9 +12,9 @@
 #include "mojo/edk/system/message_pipe_test_utils.h"
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/test/test_utils.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/message_pipe_test_utils.h b/mojo/edk/system/message_pipe_test_utils.h
index e067329d..ae6f61a 100644
--- a/mojo/edk/system/message_pipe_test_utils.h
+++ b/mojo/edk/system/message_pipe_test_utils.h
@@ -11,7 +11,7 @@
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
 #include "mojo/edk/test/scoped_ipc_support.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/message_pipe_unittest.cc b/mojo/edk/system/message_pipe_unittest.cc
index 9283acc..17e6b62bb 100644
--- a/mojo/edk/system/message_pipe_unittest.cc
+++ b/mojo/edk/system/message_pipe_unittest.cc
@@ -4,8 +4,8 @@
 
 #include "base/memory/ref_counted.h"
 #include "mojo/edk/system/test_utils.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/options_validation.h b/mojo/edk/system/options_validation.h
index 6925075a..2299f611 100644
--- a/mojo/edk/system/options_validation.h
+++ b/mojo/edk/system/options_validation.h
@@ -18,8 +18,8 @@
 
 #include "base/logging.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/options_validation_unittest.cc b/mojo/edk/system/options_validation_unittest.cc
index d2c81808..bd4e14d 100644
--- a/mojo/edk/system/options_validation_unittest.cc
+++ b/mojo/edk/system/options_validation_unittest.cc
@@ -7,8 +7,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "mojo/public/c/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/platform_handle_dispatcher.h b/mojo/edk/system/platform_handle_dispatcher.h
index 99ffcac..701d6ef 100644
--- a/mojo/edk/system/platform_handle_dispatcher.h
+++ b/mojo/edk/system/platform_handle_dispatcher.h
@@ -8,7 +8,7 @@
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/simple_dispatcher.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
index 07b7881..f6ff1af 100644
--- a/mojo/edk/system/raw_channel.h
+++ b/mojo/edk/system/raw_channel.h
@@ -15,7 +15,7 @@
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/message_in_transit_queue.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index e6627d6..9f68d06 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -26,7 +26,7 @@
 #include "mojo/edk/embedder/platform_handle.h"
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/system/transport_data.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #if !defined(SO_PEEK_OFF)
 #define SO_PEEK_OFF 42
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
index fdc77d8..d9be055b 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -31,8 +31,8 @@
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/system/transport_data.h"
 #include "mojo/edk/test/test_utils.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/raw_channel_win.cc b/mojo/edk/system/raw_channel_win.cc
index 3063ebe..ec315017 100644
--- a/mojo/edk/system/raw_channel_win.cc
+++ b/mojo/edk/system/raw_channel_win.cc
@@ -19,7 +19,7 @@
 #include "mojo/edk/embedder/embedder_internal.h"
 #include "mojo/edk/embedder/platform_handle.h"
 #include "mojo/edk/system/transport_data.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #define STATUS_CANCELLED 0xC0000120
 #define STATUS_PIPE_BROKEN 0xC000014B
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc
index 1f15ea2..1f373d8 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.cc
+++ b/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -12,7 +12,7 @@
 #include "mojo/edk/embedder/platform_support.h"
 #include "mojo/edk/system/configuration.h"
 #include "mojo/edk/system/options_validation.h"
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/shared_buffer_dispatcher.h b/mojo/edk/system/shared_buffer_dispatcher.h
index f3fc9e80c..5c7cbb7c 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.h
+++ b/mojo/edk/system/shared_buffer_dispatcher.h
@@ -8,7 +8,7 @@
 #include "mojo/edk/embedder/platform_shared_buffer.h"
 #include "mojo/edk/system/simple_dispatcher.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/edk/system/shared_buffer_dispatcher_unittest.cc b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
index ceb936b..bcbc49e 100644
--- a/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
+++ b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
@@ -10,8 +10,8 @@
 #include "mojo/edk/embedder/platform_shared_buffer.h"
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/system/dispatcher.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/simple_dispatcher.cc b/mojo/edk/system/simple_dispatcher.cc
index 447fe2e..7dd0270 100644
--- a/mojo/edk/system/simple_dispatcher.cc
+++ b/mojo/edk/system/simple_dispatcher.cc
@@ -28,7 +28,7 @@
 MojoResult SimpleDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   lock().AssertAcquired();
 
diff --git a/mojo/edk/system/simple_dispatcher.h b/mojo/edk/system/simple_dispatcher.h
index ccef564..705c5a1 100644
--- a/mojo/edk/system/simple_dispatcher.h
+++ b/mojo/edk/system/simple_dispatcher.h
@@ -10,7 +10,7 @@
 #include "mojo/edk/system/awakable_list.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -33,7 +33,7 @@
   void CancelAllAwakablesNoLock() override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/mojo/edk/system/simple_dispatcher_unittest.cc b/mojo/edk/system/simple_dispatcher_unittest.cc
index 7d7b9c2..6f854961 100644
--- a/mojo/edk/system/simple_dispatcher_unittest.cc
+++ b/mojo/edk/system/simple_dispatcher_unittest.cc
@@ -16,8 +16,8 @@
 #include "mojo/edk/system/test_utils.h"
 #include "mojo/edk/system/waiter.h"
 #include "mojo/edk/system/waiter_test_utils.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -94,7 +94,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a readable waiter when already readable.
@@ -196,7 +196,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a writable waiter when it can never be writable.
@@ -269,7 +269,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d;
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a writable waiter when the dispatcher has been closed.
@@ -332,7 +332,7 @@
   test::Stopwatch stopwatch;
   bool did_wait;
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   HandleSignalsState hss;
 
   // Wait for readable (already readable).
@@ -460,7 +460,7 @@
 
   bool did_wait[kNumWaiters];
   MojoResult result[kNumWaiters];
-  uint32_t context[kNumWaiters];
+  uintptr_t context[kNumWaiters];
   HandleSignalsState hss[kNumWaiters];
 
   // All wait for readable and becomes readable after some time.
diff --git a/mojo/edk/system/test_utils.h b/mojo/edk/system/test_utils.h
index cf244b3..2baff3c 100644
--- a/mojo/edk/system/test_utils.h
+++ b/mojo/edk/system/test_utils.h
@@ -8,9 +8,9 @@
 #include "base/test/test_io_thread.h"
 #include "base/time/time.h"
 #include "mojo/edk/test/scoped_ipc_support.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/transport_data.h b/mojo/edk/system/transport_data.h
index 16d8d01..bd56463 100644
--- a/mojo/edk/system/transport_data.h
+++ b/mojo/edk/system/transport_data.h
@@ -16,7 +16,7 @@
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/system/waiter.cc b/mojo/edk/system/waiter.cc
index 1a9c0b1..b02603996 100644
--- a/mojo/edk/system/waiter.cc
+++ b/mojo/edk/system/waiter.cc
@@ -36,7 +36,7 @@
 }
 
 // TODO(vtl): Fast-path the |deadline == 0| case?
-MojoResult Waiter::Wait(MojoDeadline deadline, uint32_t* context) {
+MojoResult Waiter::Wait(MojoDeadline deadline, uintptr_t* context) {
   base::AutoLock locker(lock_);
 
 #ifndef NDEBUG
@@ -49,7 +49,7 @@
   if (awoken_) {
     DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
     if (context)
-      *context = static_cast<uint32_t>(awake_context_);
+      *context = awake_context_;
     return awake_result_;
   }
 
@@ -78,7 +78,7 @@
 
   DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
   if (context)
-    *context = static_cast<uint32_t>(awake_context_);
+    *context = awake_context_;
   return awake_result_;
 }
 
diff --git a/mojo/edk/system/waiter.h b/mojo/edk/system/waiter.h
index 8e983ec1..541e9c15 100644
--- a/mojo/edk/system/waiter.h
+++ b/mojo/edk/system/waiter.h
@@ -11,8 +11,8 @@
 #include "base/synchronization/lock.h"
 #include "mojo/edk/system/awakable.h"
 #include "mojo/edk/system/system_impl_export.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -54,7 +54,7 @@
   //     |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by
   //     the corresponding handle (e.g., if the other end of a message or data
   //     pipe is closed).
-  MojoResult Wait(MojoDeadline deadline, uint32_t* context);
+  MojoResult Wait(MojoDeadline deadline, uintptr_t* context);
 
   // Wake the waiter up with the given result and context (or no-op if it's been
   // woken up already).
diff --git a/mojo/edk/system/waiter_test_utils.cc b/mojo/edk/system/waiter_test_utils.cc
index bd7f55e..c7681e91 100644
--- a/mojo/edk/system/waiter_test_utils.cc
+++ b/mojo/edk/system/waiter_test_utils.cc
@@ -8,7 +8,7 @@
 namespace edk {
 namespace test {
 
-SimpleWaiterThread::SimpleWaiterThread(MojoResult* result, uint32_t* context)
+SimpleWaiterThread::SimpleWaiterThread(MojoResult* result, uintptr_t* context)
     : base::SimpleThread("waiter_thread"), result_(result), context_(context) {
   waiter_.Init();
   *result_ = 5420734;    // Totally invalid result.
@@ -26,10 +26,10 @@
 WaiterThread::WaiterThread(scoped_refptr<Dispatcher> dispatcher,
                            MojoHandleSignals handle_signals,
                            MojoDeadline deadline,
-                           uint32_t context,
+                           uintptr_t context,
                            bool* did_wait_out,
                            MojoResult* result_out,
-                           uint32_t* context_out,
+                           uintptr_t* context_out,
                            HandleSignalsState* signals_state_out)
     : base::SimpleThread("waiter_thread"),
       dispatcher_(dispatcher),
diff --git a/mojo/edk/system/waiter_test_utils.h b/mojo/edk/system/waiter_test_utils.h
index a55d5073..ca2158a 100644
--- a/mojo/edk/system/waiter_test_utils.h
+++ b/mojo/edk/system/waiter_test_utils.h
@@ -12,8 +12,8 @@
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -47,7 +47,7 @@
  public:
   // For the duration of the lifetime of this object, |*result| belongs to it
   // (in the sense that it will write to it whenever it wants).
-  SimpleWaiterThread(MojoResult* result, uint32_t* context);
+  SimpleWaiterThread(MojoResult* result, uintptr_t* context);
   ~SimpleWaiterThread() override;  // Joins the thread.
 
   Waiter* waiter() { return &waiter_; }
@@ -56,7 +56,7 @@
   void Run() override;
 
   MojoResult* const result_;
-  uint32_t* const context_;
+  uintptr_t* const context_;
   Waiter waiter_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleWaiterThread);
@@ -73,10 +73,10 @@
   WaiterThread(scoped_refptr<Dispatcher> dispatcher,
                MojoHandleSignals handle_signals,
                MojoDeadline deadline,
-               uint32_t context,
+               uintptr_t context,
                bool* did_wait_out,
                MojoResult* result_out,
-               uint32_t* context_out,
+               uintptr_t* context_out,
                HandleSignalsState* signals_state_out);
   ~WaiterThread() override;
 
@@ -89,7 +89,7 @@
   const uint32_t context_;
   bool* const did_wait_out_;
   MojoResult* const result_out_;
-  uint32_t* const context_out_;
+  uintptr_t* const context_out_;
   HandleSignalsState* const signals_state_out_;
 
   Waiter waiter_;
diff --git a/mojo/edk/system/waiter_unittest.cc b/mojo/edk/system/waiter_unittest.cc
index 71d9d8c..ed6be9a2 100644
--- a/mojo/edk/system/waiter_unittest.cc
+++ b/mojo/edk/system/waiter_unittest.cc
@@ -14,8 +14,8 @@
 #include "base/synchronization/lock.h"
 #include "base/threading/simple_thread.h"
 #include "mojo/edk/system/test_utils.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
@@ -30,14 +30,14 @@
         deadline_(deadline),
         done_(false),
         result_(MOJO_RESULT_UNKNOWN),
-        context_(static_cast<uint32_t>(-1)) {
+        context_(static_cast<uintptr_t>(-1)) {
     waiter_.Init();
   }
 
   ~WaitingThread() override { Join(); }
 
   void WaitUntilDone(MojoResult* result,
-                     uint32_t* context,
+                     uintptr_t* context,
                      MojoDeadline* elapsed) {
     for (;;) {
       {
@@ -60,7 +60,7 @@
   void Run() override {
     test::Stopwatch stopwatch;
     MojoResult result;
-    uint32_t context = static_cast<uint32_t>(-1);
+    uintptr_t context = static_cast<uintptr_t>(-1);
     MojoDeadline elapsed;
 
     stopwatch.Start();
@@ -82,7 +82,7 @@
   base::Lock lock_;  // Protects the following members.
   bool done_;
   MojoResult result_;
-  uint32_t context_;
+  uintptr_t context_;
   MojoDeadline elapsed_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(WaitingThread);
@@ -90,7 +90,7 @@
 
 TEST(WaiterTest, Basic) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   MojoDeadline elapsed;
 
   // Finite deadline.
@@ -149,7 +149,7 @@
     thread.Start();
     thread.WaitUntilDone(&result, &context, &elapsed);
     EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result);
-    EXPECT_EQ(static_cast<uint32_t>(-1), context);
+    EXPECT_EQ(static_cast<uintptr_t>(-1), context);
     EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
     EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
   }
@@ -210,7 +210,7 @@
   MojoDeadline elapsed;
 
   Waiter waiter;
-  uint32_t context = 123;
+  uintptr_t context = 123;
 
   waiter.Init();
   stopwatch.Start();
@@ -241,7 +241,7 @@
 // The first |Awake()| should always win.
 TEST(WaiterTest, MultipleAwakes) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   MojoDeadline elapsed;
 
   {
diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h
index 3ff8b85..14a40350 100644
--- a/mojo/edk/test/multiprocess_test_helper.h
+++ b/mojo/edk/test/multiprocess_test_helper.h
@@ -11,8 +11,8 @@
 #include "base/test/multiprocess_test.h"
 #include "base/test/test_timeouts.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/multiprocess_func_list.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/edk/test/run_all_perftests.cc b/mojo/edk/test/run_all_perftests.cc
index d700bc3..c9692ef 100644
--- a/mojo/edk/test/run_all_perftests.cc
+++ b/mojo/edk/test/run_all_perftests.cc
@@ -6,7 +6,7 @@
 #include "base/test/perf_test_suite.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/test/test_support_impl.h"
-#include "mojo/public/tests/test_support_private.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 int main(int argc, char** argv) {
   mojo::edk::Init();
diff --git a/mojo/edk/test/run_all_unittests.cc b/mojo/edk/test/run_all_unittests.cc
index 23266444..26744ee 100644
--- a/mojo/edk/test/run_all_unittests.cc
+++ b/mojo/edk/test/run_all_unittests.cc
@@ -11,8 +11,8 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/test/scoped_ipc_support.h"
 #include "mojo/edk/test/test_support_impl.h"
-#include "mojo/public/tests/test_support_private.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 int main(int argc, char** argv) {
 #if !defined(OS_ANDROID)
diff --git a/mojo/edk/test/scoped_ipc_support.h b/mojo/edk/test/scoped_ipc_support.h
index cff0da76..2bb5ff79 100644
--- a/mojo/edk/test/scoped_ipc_support.h
+++ b/mojo/edk/test/scoped_ipc_support.h
@@ -11,7 +11,7 @@
 #include "base/task_runner.h"
 #include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/edk/test/test_support_impl.h b/mojo/edk/test/test_support_impl.h
index e672999b..85e640e 100644
--- a/mojo/edk/test/test_support_impl.h
+++ b/mojo/edk/test/test_support_impl.h
@@ -7,8 +7,8 @@
 
 #include <stdio.h>
 
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/tests/test_support_private.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 namespace mojo {
 namespace edk {
diff --git a/mojo/environment/BUILD.gn b/mojo/environment/BUILD.gn
index d233c3bf..f376bac 100644
--- a/mojo/environment/BUILD.gn
+++ b/mojo/environment/BUILD.gn
@@ -49,9 +49,6 @@
 
   defines = [ "MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION" ]
 
-  public_configs =
-      [ "//third_party/mojo/src/mojo/public/build/config:mojo_sdk" ]
-
   deps = [
     "//base",
     "//base/third_party/dynamic_annotations",
diff --git a/mojo/fetcher/about_fetcher_unittest.cc b/mojo/fetcher/about_fetcher_unittest.cc
index 1537d22..35f60f13 100644
--- a/mojo/fetcher/about_fetcher_unittest.cc
+++ b/mojo/fetcher/about_fetcher_unittest.cc
@@ -16,7 +16,6 @@
 #include "mojo/common/weak_binding_set.h"
 #include "mojo/fetcher/about_fetcher.h"
 #include "mojo/package_manager/package_manager_impl.h"
-#include "mojo/runner/context.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/application_manager.h"
 #include "mojo/util/filename_util.h"
@@ -124,7 +123,6 @@
 
   // Overridden from testing::Test:
   void SetUp() override {
-    runner::Context::EnsureEmbedderIsInitialized();
     base::FilePath shell_dir;
     PathService::Get(base::DIR_MODULE, &shell_dir);
     scoped_ptr<package_manager::PackageManagerImpl> package_manager(
diff --git a/mojo/fetcher/data_fetcher_unittest.cc b/mojo/fetcher/data_fetcher_unittest.cc
index 568088e..b1612300 100644
--- a/mojo/fetcher/data_fetcher_unittest.cc
+++ b/mojo/fetcher/data_fetcher_unittest.cc
@@ -11,7 +11,6 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
-#include "mojo/runner/context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h"
 
@@ -57,9 +56,6 @@
   ~DataFetcherTest() override {}
 
  protected:
-  // Overridden from testing::Test:
-  void SetUp() override { runner::Context::EnsureEmbedderIsInitialized(); }
-
   void TestFetchURL(const std::string& url,
                     uint32_t expected_status_code,
                     const std::string& expected_mime_type,
diff --git a/mojo/fetcher/network_fetcher_unittest.cc b/mojo/fetcher/network_fetcher_unittest.cc
index eb344ed..cd6c8d932 100644
--- a/mojo/fetcher/network_fetcher_unittest.cc
+++ b/mojo/fetcher/network_fetcher_unittest.cc
@@ -11,11 +11,10 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "mojo/fetcher/network_fetcher.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/runner/context.h"
 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 namespace fetcher {
@@ -121,7 +120,6 @@
  protected:
   // Overridden from testing::Test:
   void SetUp() override {
-    runner::Context::EnsureEmbedderIsInitialized();
     // Automatically destroyed when |url_loader_factory_| is closed.
     new TestURLLoaderFactoryImpl(GetProxy(&url_loader_factory_));
   }
diff --git a/mojo/gles2/gles2_context.cc b/mojo/gles2/gles2_context.cc
index 5574840..d16bc42 100644
--- a/mojo/gles2/gles2_context.cc
+++ b/mojo/gles2/gles2_context.cc
@@ -7,8 +7,8 @@
 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "gpu/command_buffer/client/transfer_buffer.h"
-#include "mojo/public/c/gles2/gles2.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace gles2 {
 
diff --git a/mojo/gles2/gles2_context.h b/mojo/gles2/gles2_context.h
index 5ab4b844..829b3240 100644
--- a/mojo/gles2/gles2_context.h
+++ b/mojo/gles2/gles2_context.h
@@ -11,7 +11,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "mojo/gles2/command_buffer_client_impl.h"
-#include "mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 struct MojoGLES2ContextPrivate {};
 
diff --git a/mojo/gles2/gles2_impl.cc b/mojo/gles2/gles2_impl.cc
index d9c42a61..f1069774 100644
--- a/mojo/gles2/gles2_impl.cc
+++ b/mojo/gles2/gles2_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 #include "base/lazy_instance.h"
 #include "base/threading/thread_local.h"
@@ -94,8 +94,8 @@
     DCHECK(g_gpu_interface.Get().Get());                           \
     return g_gpu_interface.Get().Get()->Function ARGUMENTS;        \
   }
-#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
-#include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
 #undef VISIT_GL_CALL
 
 }  // extern "C"
diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp
index 3187a98..44879eb 100644
--- a/mojo/mojo_base.gyp
+++ b/mojo/mojo_base.gyp
@@ -167,13 +167,7 @@
       ],
       'include_dirs': [
         '..',
-        '../third_party/mojo/src',
       ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '../third_party/mojo/src',
-        ],
-      },
       'export_dependent_settings': [
         'mojo_environment_chromium_impl',
       ],
@@ -203,13 +197,7 @@
       ],
       'include_dirs': [
         '..',
-        '../third_party/mojo/src',
       ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '../third_party/mojo/src',
-        ],
-      },
     },
     {
       'target_name': 'mojo_application_bindings_mojom',
diff --git a/mojo/mojo_edk.gyp b/mojo/mojo_edk.gyp
index a7467dfb..79bd3c4 100644
--- a/mojo/mojo_edk.gyp
+++ b/mojo/mojo_edk.gyp
@@ -9,7 +9,6 @@
   'target_defaults' : {
     'include_dirs': [
       '..',
-      '../third_party/mojo/src',
     ],
     'direct_dependent_settings': {
       'include_dirs': [
diff --git a/mojo/package_manager/content_handler_unittest.cc b/mojo/package_manager/content_handler_unittest.cc
index dfce5fc..0b1dca2a 100644
--- a/mojo/package_manager/content_handler_unittest.cc
+++ b/mojo/package_manager/content_handler_unittest.cc
@@ -16,13 +16,13 @@
 #include "mojo/application/public/interfaces/content_handler.mojom.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "mojo/package_manager/package_manager_impl.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/application_manager.h"
 #include "mojo/shell/connect_util.h"
 #include "mojo/shell/fetcher.h"
 #include "mojo/shell/test_package_manager.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 namespace package_manager {
diff --git a/mojo/runner/BUILD.gn b/mojo/runner/BUILD.gn
index a26595b3..803b4ff1 100644
--- a/mojo/runner/BUILD.gn
+++ b/mojo/runner/BUILD.gn
@@ -13,6 +13,7 @@
   deps = [
     ":mojo_runner",
     "//mojo/runner/child",
+    "//mojo/runner/host",
   ]
 }
 
@@ -127,6 +128,7 @@
     "//base:base_static",
     "//components/devtools_service/public/cpp",
     "//components/devtools_service/public/interfaces",
+    "//components/tracing:startup_tracing",
     "//mojo/application/public/cpp",
     "//mojo/message_pump",
     "//mojo/package_manager",
@@ -200,7 +202,6 @@
       "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
       "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
       "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
-      "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
     ]
     jni_package = "mojo/shell"
   }
@@ -361,89 +362,4 @@
     ]
     dir = mojo_runner_test_assets_dir
   }
-
-  android_library("mojo_runner_tests_java") {
-    java_files =
-        [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
-
-    deps = [
-      ":java",
-      "//base:base_java",
-    ]
-  }
-}
-
-test("mojo_runner_unittests") {
-  sources = [
-    "../fetcher/about_fetcher_unittest.cc",
-    "../fetcher/data_fetcher_unittest.cc",
-    "../fetcher/network_fetcher_unittest.cc",
-    "../fetcher/url_resolver_unittest.cc",
-    "data_pipe_peek_unittest.cc",
-    "native_runner_unittest.cc",
-    "register_local_aliases.cc",
-    "register_local_aliases.h",
-    "shell_test_base.cc",
-    "shell_test_base.h",
-    "shell_test_base_android.cc",
-    "shell_test_base_unittest.cc",
-    "shell_test_main.cc",
-  ]
-
-  deps = [
-    ":lib",
-    "//base",
-    "//base:i18n",
-    "//base/test:test_support",
-    "//mojo/application/public/cpp",
-    "//mojo/common",
-    "//mojo/environment:chromium",
-    "//mojo/fetcher",
-    "//mojo/message_pump",
-    "//mojo/package_manager",
-    "//mojo/services/test_service:bindings",
-    "//mojo/shell",
-    "//mojo/util:filename_util",
-    "//testing/gtest",
-    "//third_party/mojo/src/mojo/edk/system",
-    "//third_party/mojo/src/mojo/public/cpp/bindings",
-    "//url",
-  ]
-
-  data_deps = [
-    "//mojo/services/test_service:test_app",
-    "//mojo/services/test_service:test_request_tracker_app",
-  ]
-
-  if (is_android) {
-    sources += [ "android/background_application_loader_unittest.cc" ]
-
-    deps += [ ":jni_headers" ]
-
-    apk_deps = [
-      ":build_mojo_runner_test_assets",
-      ":mojo_runner_tests_java",
-    ]
-
-    apk_asset_location = mojo_runner_test_assets_dir
-  }
-}
-
-mojo_native_application("apptests") {
-  output_name = "runner_apptests"
-
-  testonly = true
-
-  sources = [
-    # TODO(jam): needs http_server service. http://crbug.com/479316
-    #"shell_apptest.cc",
-  ]
-
-  deps = [
-    "//base",
-    "//mojo/application/public/cpp:test_support",
-    "//mojo/runner/test:bindings",
-    "//mojo/services/network/public/interfaces",
-    "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
-  ]
 }
diff --git a/mojo/runner/android/android_handler.cc b/mojo/runner/android/android_handler.cc
index 98313e3..9cc4a81 100644
--- a/mojo/runner/android/android_handler.cc
+++ b/mojo/runner/android/android_handler.cc
@@ -12,10 +12,10 @@
 #include "jni/AndroidHandler_jni.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/common/data_pipe_utils.h"
-#include "mojo/public/c/system/main.h"
 #include "mojo/runner/android/run_android_application_function.h"
 #include "mojo/runner/host/native_application_support.h"
 #include "mojo/util/filename_util.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 #include "url/gurl.h"
 
 using base::android::AttachCurrentThread;
diff --git a/mojo/runner/android/main.cc b/mojo/runner/android/main.cc
index ec59d793..fdce835 100644
--- a/mojo/runner/android/main.cc
+++ b/mojo/runner/android/main.cc
@@ -135,13 +135,13 @@
   // will be invoked first-in-last-out.
   base::FilePath shell_file_root(
       base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory));
-  Context* shell_context = new Context(shell_file_root, nullptr);
+  Context* shell_context = new Context;
   g_context.Get().reset(shell_context);
 
   g_java_message_loop.Get().reset(new base::MessageLoopForUI);
   base::MessageLoopForUI::current()->Start();
 
-  shell_context->Init();
+  shell_context->Init(shell_file_root);
   ConfigureAndroidServices(shell_context);
 
   // This is done after the main message loop is started since it may post
diff --git a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java b/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
deleted file mode 100644
index 98a53ad..0000000
--- a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.mojo.shell;
-
-import android.content.Context;
-
-import org.chromium.base.Log;
-import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.JNINamespace;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Helper method for ShellTestBase.
- */
-@JNINamespace("mojo::runner::test")
-public class ShellTestBase {
-    private static final String TAG = "ShellTestBase";
-
-    /**
-     * Extracts the mojo applications from the apk assets and returns the directory where they are.
-     */
-    @CalledByNative
-    private static String extractMojoApplications(Context context) throws IOException {
-        File cachedAppsDir = FileHelper.getCachedAppsDir(context);
-        try {
-            FileHelper.prepareDirectoryForAssets(context, cachedAppsDir);
-            for (String assetPath : FileHelper.getAssetsList(context)) {
-                FileHelper.extractFromAssets(
-                        context, assetPath, cachedAppsDir, FileHelper.FileType.PERMANENT);
-            }
-        } catch (Exception e) {
-            Log.e(TAG, "ShellTestBase initialization failed.", e);
-            throw new RuntimeException(e);
-        }
-        return cachedAppsDir.getAbsolutePath();
-    }
-}
diff --git a/mojo/runner/child/runner_connection.cc b/mojo/runner/child/runner_connection.cc
index c7758c4..015df41 100644
--- a/mojo/runner/child/runner_connection.cc
+++ b/mojo/runner/child/runner_connection.cc
@@ -13,11 +13,11 @@
 #include "base/threading/thread.h"
 #include "base/threading/thread_checker.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/runner/child/child_controller.mojom.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
 namespace mojo {
 namespace runner {
diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc
index 6c2a90d2..58279f89 100644
--- a/mojo/runner/context.cc
+++ b/mojo/runner/context.cc
@@ -22,6 +22,7 @@
 #include "build/build_config.h"
 #include "components/devtools_service/public/cpp/switches.h"
 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h"
+#include "components/tracing/tracing_switches.h"
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/application_impl.h"
@@ -171,11 +172,8 @@
 
 }  // namespace
 
-Context::Context(const base::FilePath& shell_file_root, Tracer* tracer)
-    : shell_file_root_(shell_file_root),
-      tracer_(tracer),
-      package_manager_(nullptr),
-      main_entry_time_(base::Time::Now()) {}
+Context::Context()
+    : package_manager_(nullptr), main_entry_time_(base::Time::Now()) {}
 
 Context::~Context() {
   DCHECK(!base::MessageLoop::current());
@@ -187,11 +185,19 @@
   setup.Get();
 }
 
-bool Context::Init() {
+bool Context::Init(const base::FilePath& shell_file_root) {
   TRACE_EVENT0("mojo_shell", "Context::Init");
   const base::CommandLine& command_line =
       *base::CommandLine::ForCurrentProcess();
 
+  bool trace_startup = command_line.HasSwitch(switches::kTraceStartup);
+  if (trace_startup) {
+    tracer_.Start(
+        command_line.GetSwitchValueASCII(switches::kTraceStartup),
+        command_line.GetSwitchValueASCII(switches::kTraceStartupDuration),
+        "mojo_runner.trace");
+  }
+
   EnsureEmbedderIsInitialized();
   task_runners_.reset(
       new TaskRunners(base::MessageLoop::current()->task_runner()));
@@ -202,7 +208,7 @@
       task_runners_->io_runner(), embedder::ScopedPlatformHandle());
 
   package_manager_ = new package_manager::PackageManagerImpl(
-      shell_file_root_, task_runners_->blocking_pool());
+      shell_file_root, task_runners_->blocking_pool());
   InitContentHandlers(package_manager_, command_line);
 
   RegisterLocalAliases(package_manager_);
@@ -226,7 +232,7 @@
 
   ServiceProviderPtr tracing_services;
   ServiceProviderPtr tracing_exposed_services;
-  new TracingServiceProvider(tracer_, GetProxy(&tracing_exposed_services));
+  new TracingServiceProvider(&tracer_, GetProxy(&tracing_exposed_services));
 
   scoped_ptr<shell::ConnectToApplicationParams> params(
       new shell::ConnectToApplicationParams);
@@ -239,12 +245,11 @@
   application_manager_->ConnectToApplication(params.Pass());
 
   if (command_line.HasSwitch(tracing::kTraceStartup)) {
-    DCHECK(tracer_);
     tracing::TraceCollectorPtr coordinator;
     auto coordinator_request = GetProxy(&coordinator);
     tracing_services->ConnectToService(tracing::TraceCollector::Name_,
                                        coordinator_request.PassMessagePipe());
-    tracer_->StartCollectingFromTracingService(coordinator.Pass());
+    tracer_.StartCollectingFromTracingService(coordinator.Pass());
   }
 
   // Record the shell startup metrics used for performance testing.
diff --git a/mojo/runner/context.h b/mojo/runner/context.h
index e2517259..35ced140 100644
--- a/mojo/runner/context.h
+++ b/mojo/runner/context.h
@@ -13,6 +13,7 @@
 #include "base/time/time.h"
 #include "mojo/runner/scoped_user_data_dir.h"
 #include "mojo/runner/task_runners.h"
+#include "mojo/runner/tracer.h"
 #include "mojo/shell/application_manager.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "url/gurl.h"
@@ -24,14 +25,13 @@
 namespace runner {
 
 class NativeApplicationLoader;
-class Tracer;
 
 // The "global" context for the shell's main process.
 // TODO(use_chrome_edk)
 //class Context : public edk::ProcessDelegate {
 class Context : public embedder::ProcessDelegate {
  public:
-  Context(const base::FilePath& shell_file_root, Tracer* tracer);
+  Context();
   ~Context() override;
 
   static void EnsureEmbedderIsInitialized();
@@ -39,7 +39,7 @@
   // This must be called with a message loop set up for the current thread,
   // which must remain alive until after Shutdown() is called. Returns true on
   // success.
-  bool Init();
+  bool Init(const base::FilePath& shell_file_root);
 
   // If Init() was called and succeeded, this must be called before destruction.
   void Shutdown();
@@ -73,8 +73,9 @@
   ScopedUserDataDir scoped_user_data_dir;
   std::set<GURL> app_urls_;
   scoped_ptr<TaskRunners> task_runners_;
-  base::FilePath shell_file_root_;
-  Tracer* const tracer_;
+  // Ensure this is destructed before task_runners_ since it owns a message pipe
+  // that needs the IO thread to destruct cleanly.
+  Tracer tracer_;
   // Owned by |application_manager_|.
   package_manager::PackageManagerImpl* package_manager_;
   scoped_ptr<shell::ApplicationManager> application_manager_;
diff --git a/mojo/runner/desktop/launcher_process.cc b/mojo/runner/desktop/launcher_process.cc
index d79f45b..295aaa59 100644
--- a/mojo/runner/desktop/launcher_process.cc
+++ b/mojo/runner/desktop/launcher_process.cc
@@ -17,10 +17,8 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/trace_event/trace_event.h"
 #include "components/tracing/trace_config_file.h"
-#include "components/tracing/tracing_switches.h"
 #include "mojo/runner/context.h"
 #include "mojo/runner/switches.h"
-#include "mojo/runner/tracer.h"
 #include "mojo/shell/switches.h"
 
 namespace mojo {
@@ -36,23 +34,14 @@
   // http://crbug.com/546644
   command_line->AppendSwitch(switches::kMojoNoSandbox);
 
-  bool trace_startup = command_line->HasSwitch(switches::kTraceStartup);
-  if (trace_startup) {
-    tracer.Start(
-        command_line->GetSwitchValueASCII(switches::kTraceStartup),
-        command_line->GetSwitchValueASCII(switches::kTraceStartupDuration),
-        "mojo_runner.trace");
-  }
-
   // We want the shell::Context to outlive the MessageLoop so that pipes are
   // all gracefully closed / error-out before we try to shut the Context down.
-  base::FilePath shell_dir;
-  PathService::Get(base::DIR_MODULE, &shell_dir);
-  Context shell_context(shell_dir, &tracer);
+  Context shell_context;
   {
     base::MessageLoop message_loop;
-    tracer.DidCreateMessageLoop();
-    if (!shell_context.Init()) {
+    base::FilePath shell_dir;
+    PathService::Get(base::DIR_MODULE, &shell_dir);
+    if (!shell_context.Init(shell_dir)) {
       return 0;
     }
 
diff --git a/mojo/runner/host/BUILD.gn b/mojo/runner/host/BUILD.gn
index aba7b53..b534287 100644
--- a/mojo/runner/host/BUILD.gn
+++ b/mojo/runner/host/BUILD.gn
@@ -12,7 +12,7 @@
 
   deps = [
     ":lib",
-    ":unittests",
+    ":mojo_runner_host_unittests",
   ]
 }
 
@@ -86,9 +86,7 @@
   }
 }
 
-test("unittests") {
-  output_name = "mojo_runner_host_unittests"
-
+test("mojo_runner_host_unittests") {
   sources = [
     "child_process_host_unittest.cc",
     "host_unittests.cc",
diff --git a/mojo/runner/host/child_process.cc b/mojo/runner/host/child_process.cc
index dc04176..0bb20b1 100644
--- a/mojo/runner/host/child_process.cc
+++ b/mojo/runner/host/child_process.cc
@@ -21,8 +21,6 @@
 #include "base/threading/thread.h"
 #include "base/threading/thread_checker.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/system/core.h"
 #include "mojo/runner/child/child_controller.mojom.h"
 #include "mojo/runner/host/native_application_support.h"
 #include "mojo/runner/host/switches.h"
@@ -30,6 +28,8 @@
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 #if defined(OS_LINUX) && !defined(OS_ANDROID)
 #include "base/rand_util.h"
diff --git a/mojo/runner/host/child_process_host.cc b/mojo/runner/host/child_process_host.cc
index 6074b5b..8cc2b018 100644
--- a/mojo/runner/host/child_process_host.cc
+++ b/mojo/runner/host/child_process_host.cc
@@ -14,10 +14,10 @@
 #include "base/process/launch.h"
 #include "base/task_runner.h"
 #include "base/thread_task_runner_handle.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/system/core.h"
 #include "mojo/runner/host/switches.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 #if defined(OS_LINUX) && !defined(OS_ANDROID)
 #include "sandbox/linux/services/namespace_sandbox.h"
diff --git a/mojo/runner/host/native_application_support.cc b/mojo/runner/host/native_application_support.cc
index 5b53744..eae4e98 100644
--- a/mojo/runner/host/native_application_support.cc
+++ b/mojo/runner/host/native_application_support.cc
@@ -9,10 +9,10 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "mojo/platform_handle/platform_handle_private_thunks.h"
-#include "mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h"
-#include "mojo/public/platform/native/gles2_impl_thunks.h"
-#include "mojo/public/platform/native/gles2_thunks.h"
-#include "mojo/public/platform/native/system_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/system_thunks.h"
 
 namespace mojo {
 namespace runner {
diff --git a/mojo/runner/host/native_application_support.h b/mojo/runner/host/native_application_support.h
index dca22de..209cc18 100644
--- a/mojo/runner/host/native_application_support.h
+++ b/mojo/runner/host/native_application_support.h
@@ -6,7 +6,7 @@
 #define MOJO_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_
 
 #include "base/native_library.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 
 namespace base {
 class FilePath;
diff --git a/mojo/runner/native_runner_unittest.cc b/mojo/runner/native_runner_unittest.cc
deleted file mode 100644
index cadf9df..0000000
--- a/mojo/runner/native_runner_unittest.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/files/scoped_temp_dir.h"
-#include "base/path_service.h"
-#include "mojo/package_manager/package_manager_impl.h"
-#include "mojo/runner/context.h"
-#include "mojo/shell/application_manager.h"
-#include "mojo/util/filename_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace runner {
-namespace {
-
-struct TestState {
-  TestState()
-      : runner_was_created(false),
-        runner_was_started(false),
-        runner_was_destroyed(false) {}
-
-  bool runner_was_created;
-  bool runner_was_started;
-  bool runner_was_destroyed;
-};
-
-class TestNativeRunner : public shell::NativeRunner {
- public:
-  explicit TestNativeRunner(TestState* state) : state_(state) {
-    state_->runner_was_created = true;
-  }
-  ~TestNativeRunner() override {
-    state_->runner_was_destroyed = true;
-    if (base::MessageLoop::current()->is_running())
-      base::MessageLoop::current()->QuitWhenIdle();
-  }
-  void Start(const base::FilePath& app_path,
-             bool start_sandboxed,
-             InterfaceRequest<Application> application_request,
-             const base::Closure& app_completed_callback) override {
-    state_->runner_was_started = true;
-  }
-
- private:
-  TestState* state_;
-};
-
-class TestNativeRunnerFactory : public shell::NativeRunnerFactory {
- public:
-  explicit TestNativeRunnerFactory(TestState* state) : state_(state) {}
-  ~TestNativeRunnerFactory() override {}
-  scoped_ptr<shell::NativeRunner> Create(const base::FilePath& path) override {
-    return scoped_ptr<shell::NativeRunner>(new TestNativeRunner(state_));
-  }
-
- private:
-  TestState* state_;
-};
-
-class NativeApplicationLoaderTest : public testing::Test {
- public:
-  NativeApplicationLoaderTest() {
-    loop_.reset(new base::MessageLoop);
-  }
-  ~NativeApplicationLoaderTest() override {
-    loop_.reset();
-  }
-  void SetUp() override {
-    base::FilePath shell_dir;
-    PathService::Get(base::DIR_MODULE, &shell_dir);
-    scoped_ptr<package_manager::PackageManagerImpl> package_manager(
-        new package_manager::PackageManagerImpl(shell_dir, nullptr));
-    scoped_ptr<shell::NativeRunnerFactory> factory(
-        new TestNativeRunnerFactory(&state_));
-    application_manager_.reset(new shell::ApplicationManager(
-        package_manager.Pass(), factory.Pass(), nullptr));
-  }
-  void TearDown() override { application_manager_.reset(); }
-
- protected:
-  scoped_ptr<base::MessageLoop> loop_;
-  scoped_ptr<shell::ApplicationManager> application_manager_;
-  TestState state_;
-};
-
-TEST_F(NativeApplicationLoaderTest, DoesNotExist) {
-  base::ScopedTempDir temp_dir;
-  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-  base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt"));
-  GURL url(util::FilePathToFileURL(temp_dir.path().Append(nonexistent_file)));
-
-  scoped_ptr<shell::ConnectToApplicationParams> params(
-      new shell::ConnectToApplicationParams);
-  params->SetTargetURL(url);
-  application_manager_->ConnectToApplication(params.Pass());
-  EXPECT_FALSE(state_.runner_was_created);
-  EXPECT_FALSE(state_.runner_was_started);
-  EXPECT_FALSE(state_.runner_was_destroyed);
-}
-
-}  // namespace
-}  // namespace runner
-}  // namespace mojo
diff --git a/mojo/runner/shell_apptest.cc b/mojo/runner/shell_apptest.cc
deleted file mode 100644
index f0eb95c..0000000
--- a/mojo/runner/shell_apptest.cc
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/base_paths.h"
-#include "base/bind.h"
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/path_service.h"
-#include "base/run_loop.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "mojo/application/public/cpp/application_impl.h"
-#include "mojo/application/public/cpp/application_test_base.h"
-#include "mojo/common/data_pipe_utils.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/runner/kPingable.h"
-#include "mojo/runner/test/pingable.mojom.h"
-#include "mojo/services/http_server/public/cpp/http_server_util.h"
-#include "mojo/services/http_server/public/interfaces/http_server.mojom.h"
-#include "mojo/services/http_server/public/interfaces/http_server_factory.mojom.h"
-#include "mojo/services/network/public/interfaces/net_address.mojom.h"
-
-namespace mojo {
-namespace {
-
-std::string GetURL(uint16_t port, const std::string& path) {
-  return base::StringPrintf("http://127.0.0.1:%u/%s",
-                            static_cast<unsigned>(port), path.c_str());
-}
-
-class GetHandler : public http_server::HttpHandler {
- public:
-  GetHandler(InterfaceRequest<http_server::HttpHandler> request, uint16_t port)
-      : binding_(this, request.Pass()), port_(port) {
-  }
-  ~GetHandler() override {}
-
- private:
-  // http_server::HttpHandler:
-  void HandleRequest(
-      http_server::HttpRequestPtr request,
-      const Callback<void(http_server::HttpResponsePtr)>& callback) override {
-    http_server::HttpResponsePtr response;
-    if (base::StartsWith(request->relative_url, "/app",
-                         base::CompareCase::SENSITIVE)) {
-      response = http_server::CreateHttpResponse(
-          200, std::string(kPingable.data, kPingable.size));
-      response->content_type = "application/octet-stream";
-    } else if (request->relative_url == "/redirect") {
-      response = http_server::HttpResponse::New();
-      response->status_code = 302;
-      response->custom_headers.insert("Location", GetURL(port_, "app"));
-    } else {
-      NOTREACHED();
-    }
-
-    callback.Run(response.Pass());
-  }
-
-  Binding<http_server::HttpHandler> binding_;
-  uint16_t port_;
-
-  MOJO_DISALLOW_COPY_AND_ASSIGN(GetHandler);
-};
-
-typedef test::ApplicationTestBase ShellAppTest;
-
-class ShellHTTPAppTest : public test::ApplicationTestBase {
- public:
-  ShellHTTPAppTest() : ApplicationTestBase() {}
-  ~ShellHTTPAppTest() override {}
-
- protected:
-  // ApplicationTestBase:
-  void SetUp() override {
-    ApplicationTestBase::SetUp();
-
-    application_impl()->ConnectToService("mojo:http_server",
-                                         &http_server_factory_);
-
-    NetAddressPtr local_address(NetAddress::New());
-    local_address->family = NET_ADDRESS_FAMILY_IPV4;
-    local_address->ipv4 = NetAddressIPv4::New();
-    local_address->ipv4->addr.resize(4);
-    local_address->ipv4->addr[0] = 127;
-    local_address->ipv4->addr[1] = 0;
-    local_address->ipv4->addr[2] = 0;
-    local_address->ipv4->addr[3] = 1;
-    local_address->ipv4->port = 0;
-    http_server_factory_->CreateHttpServer(GetProxy(&http_server_),
-                                           local_address.Pass());
-
-    http_server_->GetPort([this](uint16_t p) { port_ = p; });
-    EXPECT_TRUE(http_server_.WaitForIncomingResponse());
-
-    InterfacePtr<http_server::HttpHandler> http_handler;
-    handler_.reset(new GetHandler(GetProxy(&http_handler).Pass(), port_));
-    http_server_->SetHandler(".*", http_handler.Pass(),
-                             [](bool result) { EXPECT_TRUE(result); });
-    EXPECT_TRUE(http_server_.WaitForIncomingResponse());
-  }
-
-  std::string GetURL(const std::string& path) {
-    return ::mojo::GetURL(port_, path);
-  }
-
-  http_server::HttpServerFactoryPtr http_server_factory_;
-  http_server::HttpServerPtr http_server_;
-  scoped_ptr<GetHandler> handler_;
-  uint16_t port_;
-
- private:
-  MOJO_DISALLOW_COPY_AND_ASSIGN(ShellHTTPAppTest);
-};
-
-// Test that we can load apps over http.
-TEST_F(ShellHTTPAppTest, Http) {
-  InterfacePtr<Pingable> pingable;
-  application_impl()->ConnectToService(GetURL("app"), &pingable);
-  pingable->Ping("hello",
-                 [this](const String& app_url, const String& connection_url,
-                        const String& message) {
-                   EXPECT_EQ(GetURL("app"), app_url);
-                   EXPECT_EQ(GetURL("app"), connection_url);
-                   EXPECT_EQ("hello", message);
-                   base::MessageLoop::current()->QuitWhenIdle();
-                 });
-  base::RunLoop().Run();
-}
-
-// Test that redirects work.
-// TODO(aa): Test that apps receive the correct URL parameters.
-TEST_F(ShellHTTPAppTest, Redirect) {
-  InterfacePtr<Pingable> pingable;
-  application_impl()->ConnectToService(GetURL("redirect"), &pingable);
-  pingable->Ping("hello",
-                 [this](const String& app_url, const String& connection_url,
-                        const String& message) {
-                   EXPECT_EQ(GetURL("app"), app_url);
-                   EXPECT_EQ(GetURL("app"), connection_url);
-                   EXPECT_EQ("hello", message);
-                   base::MessageLoop::current()->QuitWhenIdle();
-                 });
-  base::RunLoop().Run();
-}
-
-// Test that querystring is not considered when resolving http applications.
-// TODO(aa|qsr): Fix this test on Linux ASAN http://crbug.com/463662
-#if defined(ADDRESS_SANITIZER)
-#define MAYBE_QueryHandling DISABLED_QueryHandling
-#else
-#define MAYBE_QueryHandling QueryHandling
-#endif  // ADDRESS_SANITIZER
-TEST_F(ShellHTTPAppTest, MAYBE_QueryHandling) {
-  InterfacePtr<Pingable> pingable1;
-  InterfacePtr<Pingable> pingable2;
-  application_impl()->ConnectToService(GetURL("app?foo"), &pingable1);
-  application_impl()->ConnectToService(GetURL("app?bar"), &pingable2);
-
-  int num_responses = 0;
-  auto callback = [this, &num_responses](const String& app_url,
-                                         const String& connection_url,
-                                         const String& message) {
-    EXPECT_EQ(GetURL("app"), app_url);
-    EXPECT_EQ("hello", message);
-    ++num_responses;
-    if (num_responses == 1) {
-      EXPECT_EQ(GetURL("app?foo"), connection_url);
-    } else if (num_responses == 2) {
-      EXPECT_EQ(GetURL("app?bar"), connection_url);
-      base::MessageLoop::current()->QuitWhenIdle();
-    } else {
-      CHECK(false);
-    }
-  };
-  pingable1->Ping("hello", callback);
-  pingable2->Ping("hello", callback);
-  base::RunLoop().Run();
-}
-
-// mojo: URLs can have querystrings too
-TEST_F(ShellAppTest, MojoURLQueryHandling) {
-  InterfacePtr<Pingable> pingable;
-  application_impl()->ConnectToService("mojo:pingable_app?foo", &pingable);
-  auto callback = [this](const String& app_url, const String& connection_url,
-                         const String& message) {
-    EXPECT_TRUE(base::EndsWith(app_url, "/pingable_app.mojo",
-                               base::CompareCase::SENSITIVE));
-    EXPECT_EQ(app_url.To<std::string>() + "?foo", connection_url);
-    EXPECT_EQ("hello", message);
-    base::MessageLoop::current()->QuitWhenIdle();
-  };
-  pingable->Ping("hello", callback);
-  base::RunLoop().Run();
-}
-
-}  // namespace
-}  // namespace mojo
diff --git a/mojo/runner/shell_test_base.cc b/mojo/runner/shell_test_base.cc
deleted file mode 100644
index b6d828d8..0000000
--- a/mojo/runner/shell_test_base.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/runner/shell_test_base.h"
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "build/build_config.h"
-#include "mojo/shell/capability_filter.h"
-#include "mojo/util/filename_util.h"
-#include "url/gurl.h"
-
-namespace mojo {
-namespace runner {
-namespace test {
-
-namespace {
-
-void QuitIfRunning() {
-  if (base::MessageLoop::current() &&
-      base::MessageLoop::current()->is_running()) {
-    base::MessageLoop::current()->QuitWhenIdle();
-  }
-}
-
-}  // namespace
-
-ShellTestBase::ShellTestBase()
-    : shell_context_(GetTestAppFilePath(), nullptr) {}
-
-ShellTestBase::~ShellTestBase() {
-}
-
-void ShellTestBase::SetUp() {
-  CHECK(shell_context_.Init());
-}
-
-void ShellTestBase::TearDown() {
-  shell_context_.Shutdown();
-}
-
-ScopedMessagePipeHandle ShellTestBase::ConnectToService(
-    const GURL& application_url,
-    const std::string& service_name) {
-  ServiceProviderPtr services;
-
-  scoped_ptr<shell::ConnectToApplicationParams> params(
-      new shell::ConnectToApplicationParams);
-  params->SetTarget(shell::Identity(application_url, std::string(),
-                                    shell::GetPermissiveCapabilityFilter()));
-  params->set_services(GetProxy(&services));
-  params->set_on_application_end(base::Bind(&QuitIfRunning));
-  shell_context_.application_manager()->ConnectToApplication(params.Pass());
-  MessagePipe pipe;
-  services->ConnectToService(service_name, pipe.handle1.Pass());
-  return pipe.handle0.Pass();
-}
-
-#if !defined(OS_ANDROID)
-base::FilePath ShellTestBase::GetTestAppFilePath() const {
-  base::FilePath shell_dir;
-  PathService::Get(base::DIR_MODULE, &shell_dir);
-  return shell_dir;
-}
-#endif
-
-}  // namespace test
-}  // namespace runner
-}  // namespace mojo
diff --git a/mojo/runner/shell_test_base.h b/mojo/runner/shell_test_base.h
index 73343a8..861b023 100644
--- a/mojo/runner/shell_test_base.h
+++ b/mojo/runner/shell_test_base.h
@@ -9,10 +9,10 @@
 
 #include "base/macros.h"
 #include "base/message_loop/message_loop.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/system/core.h"
 #include "mojo/runner/context.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 class GURL;
 
diff --git a/mojo/runner/shell_test_base_android.cc b/mojo/runner/shell_test_base_android.cc
deleted file mode 100644
index a1768070..0000000
--- a/mojo/runner/shell_test_base_android.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/runner/shell_test_base.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "jni/ShellTestBase_jni.h"
-#include "mojo/util/filename_util.h"
-#include "url/gurl.h"
-
-namespace mojo {
-namespace runner {
-namespace test {
-
-namespace {
-
-JNIEnv* InitEnv() {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  static bool initialized = false;
-  if (!initialized) {
-    RegisterNativesImpl(env);
-    initialized = true;
-  }
-  return env;
-}
-
-}  // namespace
-
-base::FilePath ShellTestBase::GetTestAppFilePath() const {
-  // Extract mojo applications, and set the resolve base URL to the directory
-  // containing those.
-  JNIEnv* env = InitEnv();
-  base::android::ScopedJavaLocalRef<jstring> service_dir(
-      Java_ShellTestBase_extractMojoApplications(
-          env, base::android::GetApplicationContext()));
-  return base::FilePath(
-      base::android::ConvertJavaStringToUTF8(env, service_dir.obj()));
-}
-
-}  // namespace test
-}  // namespace runner
-}  // namespace mojo
diff --git a/mojo/runner/shell_test_base_unittest.cc b/mojo/runner/shell_test_base_unittest.cc
index 998d55b..3d2cca1 100644
--- a/mojo/runner/shell_test_base_unittest.cc
+++ b/mojo/runner/shell_test_base_unittest.cc
@@ -9,11 +9,11 @@
 #include "base/macros.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/utf_string_conversions.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/system/core.h"
 #include "mojo/services/test_service/test_request_tracker.mojom.h"
 #include "mojo/services/test_service/test_service.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 #include "url/gurl.h"
 
 using mojo::test::ServiceReport;
diff --git a/mojo/runner/test/BUILD.gn b/mojo/runner/test/BUILD.gn
deleted file mode 100644
index 310dfa9..0000000
--- a/mojo/runner/test/BUILD.gn
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//mojo/public/mojo_application.gni")
-import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
-
-mojom("bindings") {
-  sources = [
-    "pingable.mojom",
-  ]
-}
-
-mojo_native_application("pingable_app") {
-  output_name = "pingable_app"
-
-  testonly = true
-
-  sources = [
-    "pingable_app.cc",
-  ]
-
-  deps = [
-    ":bindings",
-    "//mojo/application/public/cpp",
-    "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
-  ]
-}
diff --git a/mojo/runner/test/pingable.mojom b/mojo/runner/test/pingable.mojom
deleted file mode 100644
index 74ed38d..0000000
--- a/mojo/runner/test/pingable.mojom
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module mojo;
-
-interface Pingable {
-  Ping(string message) => (string app_url, string connection_url, string message);
-};
diff --git a/mojo/runner/test/pingable_app.cc b/mojo/runner/test/pingable_app.cc
index 2930a51e..f700044 100644
--- a/mojo/runner/test/pingable_app.cc
+++ b/mojo/runner/test/pingable_app.cc
@@ -6,11 +6,11 @@
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/application_runner.h"
 #include "mojo/application/public/cpp/interface_factory.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/runner/test/pingable.mojom.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 
diff --git a/mojo/runner/tracer.cc b/mojo/runner/tracer.cc
index 211d1c5..6334dbd4 100644
--- a/mojo/runner/tracer.cc
+++ b/mojo/runner/tracer.cc
@@ -27,12 +27,6 @@
 void Tracer::Start(const std::string& categories,
                    const std::string& duration_seconds_str,
                    const std::string& filename) {
-  trace_duration_secs_ = 5;
-  if (!duration_seconds_str.empty()) {
-    CHECK(base::StringToInt(duration_seconds_str, &trace_duration_secs_))
-        << "Could not parse --trace-startup-duration value "
-        << duration_seconds_str;
-  }
   tracing_ = true;
   trace_filename_ = filename;
   categories_ = categories;
@@ -40,16 +34,17 @@
                                         base::trace_event::RECORD_UNTIL_FULL);
   base::trace_event::TraceLog::GetInstance()->SetEnabled(
       config, base::trace_event::TraceLog::RECORDING_MODE);
-}
 
-void Tracer::DidCreateMessageLoop() {
-  if (!tracing_)
-    return;
-
+  int trace_duration_secs = 5;
+  if (!duration_seconds_str.empty()) {
+    CHECK(base::StringToInt(duration_seconds_str, &trace_duration_secs))
+        << "Could not parse --trace-startup-duration value "
+        << duration_seconds_str;
+  }
   base::MessageLoop::current()->PostDelayedTask(
       FROM_HERE,
       base::Bind(&Tracer::StopAndFlushToFile, base::Unretained(this)),
-      base::TimeDelta::FromSeconds(trace_duration_secs_));
+      base::TimeDelta::FromSeconds(trace_duration_secs));
 }
 
 void Tracer::StartCollectingFromTracingService(
diff --git a/mojo/runner/tracer.h b/mojo/runner/tracer.h
index eb495914..6fd8b1c 100644
--- a/mojo/runner/tracer.h
+++ b/mojo/runner/tracer.h
@@ -37,10 +37,6 @@
              const std::string& duration_seconds_str,
              const std::string& filename);
 
-  // Notifies the tracer that a message loop has been created. If startup
-  // tracing is active the tracer can use this to schedule when to stop tracing.
-  void DidCreateMessageLoop();
-
   // Starts collecting data from the tracing service with the given set of
   // categories.
   void StartCollectingFromTracingService(
@@ -85,8 +81,6 @@
   mojo::TraceProviderImpl trace_provider_impl_;
   // Whether we're currently tracing.
   bool tracing_;
-  // How long to trace after message loop creation.
-  int trace_duration_secs_;
   // Categories to trace.
   std::string categories_;
 
diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_apptest.cc
index 0c92ede9..5b2032f 100644
--- a/mojo/services/network/udp_socket_apptest.cc
+++ b/mojo/services/network/udp_socket_apptest.cc
@@ -8,12 +8,12 @@
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/application_test_base.h"
-#include "mojo/public/cpp/bindings/callback.h"
 #include "mojo/services/network/public/cpp/udp_socket_wrapper.h"
 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
 #include "mojo/services/network/public/interfaces/udp_socket.mojom.h"
 #include "net/base/net_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
 
 namespace mojo {
 namespace service {
diff --git a/mojo/services/test_service/test_request_tracker_application.cc b/mojo/services/test_service/test_request_tracker_application.cc
index 6facdc5..cc6869b 100644
--- a/mojo/services/test_service/test_request_tracker_application.cc
+++ b/mojo/services/test_service/test_request_tracker_application.cc
@@ -8,8 +8,8 @@
 
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_runner.h"
-#include "mojo/public/c/system/main.h"
 #include "mojo/services/test_service/test_time_service_impl.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 namespace mojo {
 namespace test {
diff --git a/mojo/services/test_service/test_request_tracker_application.h b/mojo/services/test_service/test_request_tracker_application.h
index a009f62..371ee1f 100644
--- a/mojo/services/test_service/test_request_tracker_application.h
+++ b/mojo/services/test_service/test_request_tracker_application.h
@@ -7,8 +7,8 @@
 
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/interface_factory_impl.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/services/test_service/test_request_tracker_impl.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class ApplicationImpl;
diff --git a/mojo/services/test_service/test_request_tracker_impl.h b/mojo/services/test_service/test_request_tracker_impl.h
index 0ed220ac0..2edb5cc 100644
--- a/mojo/services/test_service/test_request_tracker_impl.h
+++ b/mojo/services/test_service/test_request_tracker_impl.h
@@ -6,9 +6,9 @@
 #define SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_IMPL_H_
 
 #include "base/memory/weak_ptr.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/services/test_service/test_request_tracker.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class ApplicationConnection;
diff --git a/mojo/services/test_service/test_service_application.cc b/mojo/services/test_service/test_service_application.cc
index 7fd16fa..493551c4 100644
--- a/mojo/services/test_service/test_service_application.cc
+++ b/mojo/services/test_service/test_service_application.cc
@@ -8,9 +8,9 @@
 
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_runner.h"
-#include "mojo/public/c/system/main.h"
 #include "mojo/services/test_service/test_service_impl.h"
 #include "mojo/services/test_service/test_time_service_impl.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 namespace mojo {
 namespace test {
diff --git a/mojo/services/test_service/test_service_application.h b/mojo/services/test_service/test_service_application.h
index 4ad5559..704eb409 100644
--- a/mojo/services/test_service/test_service_application.h
+++ b/mojo/services/test_service/test_service_application.h
@@ -7,7 +7,7 @@
 
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/interface_factory.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class ApplicationConnection;
diff --git a/mojo/services/test_service/test_service_impl.h b/mojo/services/test_service/test_service_impl.h
index c6680a2..9c8c86d 100644
--- a/mojo/services/test_service/test_service_impl.h
+++ b/mojo/services/test_service/test_service_impl.h
@@ -6,9 +6,9 @@
 #define SERVICES_TEST_SERVICE_TEST_SERVICE_IMPL_H_
 
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/services/test_service/test_service.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class ApplicationImpl;
diff --git a/mojo/services/test_service/test_time_service_impl.h b/mojo/services/test_service/test_time_service_impl.h
index 242f66c6..af92964d 100644
--- a/mojo/services/test_service/test_time_service_impl.h
+++ b/mojo/services/test_service/test_time_service_impl.h
@@ -6,10 +6,10 @@
 #define SERVICES_TEST_SERVICE_TEST_TIME_SERVICE_IMPL_H_
 
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/services/test_service/test_service.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/mojo/services/test_service/tracked_service.h b/mojo/services/test_service/tracked_service.h
index 62ec14a..bd9cd21 100644
--- a/mojo/services/test_service/tracked_service.h
+++ b/mojo/services/test_service/tracked_service.h
@@ -5,8 +5,8 @@
 #ifndef SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_
 #define SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/services/test_service/test_request_tracker.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace test {
diff --git a/mojo/services/tracing/main.cc b/mojo/services/tracing/main.cc
index 1810d1b..a7875aa9 100644
--- a/mojo/services/tracing/main.cc
+++ b/mojo/services/tracing/main.cc
@@ -4,8 +4,8 @@
 
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/application_runner.h"
-#include "mojo/public/c/system/main.h"
 #include "mojo/services/tracing/tracing_app.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
 
 MojoResult MojoMain(MojoHandle shell_handle) {
   mojo::ApplicationRunner runner(new tracing::TracingApp);
diff --git a/mojo/services/tracing/public/cpp/trace_provider_impl.h b/mojo/services/tracing/public/cpp/trace_provider_impl.h
index 5774911..dca965fd 100644
--- a/mojo/services/tracing/public/cpp/trace_provider_impl.h
+++ b/mojo/services/tracing/public/cpp/trace_provider_impl.h
@@ -8,9 +8,9 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted_memory.h"
 #include "base/memory/weak_ptr.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 
 namespace mojo {
 
diff --git a/mojo/services/tracing/public/interfaces/tracing.mojom b/mojo/services/tracing/public/interfaces/tracing.mojom
index b702163e..b624f81e 100644
--- a/mojo/services/tracing/public/interfaces/tracing.mojom
+++ b/mojo/services/tracing/public/interfaces/tracing.mojom
@@ -31,18 +31,19 @@
 };
 
 // These times are used to determine startup performance metrics.
-// TODO(msw): Use TimeTicks to avoid system clock changes: crbug.com/521164
+// TODO(msw): Find a way to convert *_time metrics into TimeTicks earlier (ref:
+// https://goo.gl/vZ8dZW).
 struct StartupPerformanceTimes {
   // TODO(msw): Rename to match "BrowserMainEntryTimeAbsolute" metric?
   int64 shell_process_creation_time;
   int64 shell_main_entry_point_time;
-  int64 browser_message_loop_start_time;
-  int64 browser_window_display_time;
+  int64 browser_message_loop_start_ticks;
+  int64 browser_window_display_ticks;
   int64 browser_open_tabs_time_delta;
   // TODO(msw): Rename to avoid "web contents"?
-  int64 first_web_contents_main_frame_load_time;
+  int64 first_web_contents_main_frame_load_ticks;
   // TODO(msw): Rename to match "FirstWebContents.NonEmptyPaint" metric?
-  int64 first_visually_non_empty_layout_time;
+  int64 first_visually_non_empty_layout_ticks;
 };
 
 // This interface accepts startup performance timing from a variety of sources.
@@ -50,11 +51,11 @@
   // These setters may be called many times, only the first time is recorded.
   SetShellProcessCreationTime(int64 time);
   SetShellMainEntryPointTime(int64 time);
-  SetBrowserMessageLoopStartTime(int64 time);
-  SetBrowserWindowDisplayTime(int64 time);
+  SetBrowserMessageLoopStartTicks(int64 ticks);
+  SetBrowserWindowDisplayTicks(int64 ticks);
   SetBrowserOpenTabsTimeDelta(int64 delta);
-  SetFirstWebContentsMainFrameLoadTime(int64 time);
-  SetFirstVisuallyNonEmptyLayoutTime(int64 time);
+  SetFirstWebContentsMainFrameLoadTicks(int64 ticks);
+  SetFirstVisuallyNonEmptyLayoutTicks(int64 ticks);
 
   // Get the currently available startup performance times.
   GetStartupPerformanceTimes() => (StartupPerformanceTimes times);
diff --git a/mojo/services/tracing/trace_data_sink.h b/mojo/services/tracing/trace_data_sink.h
index f945d4f..658a2653 100644
--- a/mojo/services/tracing/trace_data_sink.h
+++ b/mojo/services/tracing/trace_data_sink.h
@@ -8,7 +8,7 @@
 #include <string>
 
 #include "base/basictypes.h"
-#include "mojo/public/cpp/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h"
 
 namespace tracing {
 
diff --git a/mojo/services/tracing/trace_recorder_impl.h b/mojo/services/tracing/trace_recorder_impl.h
index 55640e1..ea74dd6b9 100644
--- a/mojo/services/tracing/trace_recorder_impl.h
+++ b/mojo/services/tracing/trace_recorder_impl.h
@@ -6,10 +6,10 @@
 #define MOJO_SERVICES_TRACING_TRACE_RECORDER_IMPL_H_
 
 #include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/string.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 #include "mojo/services/tracing/trace_data_sink.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 namespace tracing {
 
diff --git a/mojo/services/tracing/tracing_app.cc b/mojo/services/tracing/tracing_app.cc
index 5162c669..e73f0ab1 100644
--- a/mojo/services/tracing/tracing_app.cc
+++ b/mojo/services/tracing/tracing_app.cc
@@ -136,14 +136,14 @@
     startup_performance_times_.shell_main_entry_point_time = time;
 }
 
-void TracingApp::SetBrowserMessageLoopStartTime(int64 time) {
-  if (startup_performance_times_.browser_message_loop_start_time == 0)
-    startup_performance_times_.browser_message_loop_start_time = time;
+void TracingApp::SetBrowserMessageLoopStartTicks(int64 ticks) {
+  if (startup_performance_times_.browser_message_loop_start_ticks == 0)
+    startup_performance_times_.browser_message_loop_start_ticks = ticks;
 }
 
-void TracingApp::SetBrowserWindowDisplayTime(int64 time) {
-  if (startup_performance_times_.browser_window_display_time == 0)
-    startup_performance_times_.browser_window_display_time = time;
+void TracingApp::SetBrowserWindowDisplayTicks(int64 ticks) {
+  if (startup_performance_times_.browser_window_display_ticks == 0)
+    startup_performance_times_.browser_window_display_ticks = ticks;
 }
 
 void TracingApp::SetBrowserOpenTabsTimeDelta(int64 delta) {
@@ -151,14 +151,14 @@
     startup_performance_times_.browser_open_tabs_time_delta = delta;
 }
 
-void TracingApp::SetFirstWebContentsMainFrameLoadTime(int64 time) {
-  if (startup_performance_times_.first_web_contents_main_frame_load_time == 0)
-    startup_performance_times_.first_web_contents_main_frame_load_time = time;
+void TracingApp::SetFirstWebContentsMainFrameLoadTicks(int64 ticks) {
+  if (startup_performance_times_.first_web_contents_main_frame_load_ticks == 0)
+    startup_performance_times_.first_web_contents_main_frame_load_ticks = ticks;
 }
 
-void TracingApp::SetFirstVisuallyNonEmptyLayoutTime(int64 time) {
-  if (startup_performance_times_.first_visually_non_empty_layout_time == 0)
-    startup_performance_times_.first_visually_non_empty_layout_time = time;
+void TracingApp::SetFirstVisuallyNonEmptyLayoutTicks(int64 ticks) {
+  if (startup_performance_times_.first_visually_non_empty_layout_ticks == 0)
+    startup_performance_times_.first_visually_non_empty_layout_ticks = ticks;
 }
 
 void TracingApp::GetStartupPerformanceTimes(
diff --git a/mojo/services/tracing/tracing_app.h b/mojo/services/tracing/tracing_app.h
index 40cec2c..2c70fdd 100644
--- a/mojo/services/tracing/tracing_app.h
+++ b/mojo/services/tracing/tracing_app.h
@@ -12,10 +12,10 @@
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/common/weak_binding_set.h"
 #include "mojo/common/weak_interface_ptr_set.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 #include "mojo/services/tracing/trace_data_sink.h"
 #include "mojo/services/tracing/trace_recorder_impl.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace tracing {
 
@@ -51,11 +51,11 @@
   // StartupPerformanceDataCollector implementation.
   void SetShellProcessCreationTime(int64 time) override;
   void SetShellMainEntryPointTime(int64 time) override;
-  void SetBrowserMessageLoopStartTime(int64 time) override;
-  void SetBrowserWindowDisplayTime(int64 time) override;
+  void SetBrowserMessageLoopStartTicks(int64 ticks) override;
+  void SetBrowserWindowDisplayTicks(int64 ticks) override;
   void SetBrowserOpenTabsTimeDelta(int64 delta) override;
-  void SetFirstWebContentsMainFrameLoadTime(int64 time) override;
-  void SetFirstVisuallyNonEmptyLayoutTime(int64 time) override;
+  void SetFirstWebContentsMainFrameLoadTicks(int64 ticks) override;
+  void SetFirstVisuallyNonEmptyLayoutTicks(int64 ticks) override;
   void GetStartupPerformanceTimes(
       const GetStartupPerformanceTimesCallback& callback) override;
 
diff --git a/mojo/shell/BUILD.gn b/mojo/shell/BUILD.gn
index 9a1fe45..089d9ef 100644
--- a/mojo/shell/BUILD.gn
+++ b/mojo/shell/BUILD.gn
@@ -75,8 +75,13 @@
 
 test("mojo_shell_unittests") {
   sources = [
+    "../fetcher/about_fetcher_unittest.cc",
+    "../fetcher/data_fetcher_unittest.cc",
+    "../fetcher/network_fetcher_unittest.cc",
+    "../fetcher/url_resolver_unittest.cc",
     "application_manager_unittest.cc",
     "capability_filter_unittest.cc",
+    "data_pipe_peek_unittest.cc",
     "query_util_unittest.cc",
   ]
 
@@ -86,7 +91,11 @@
     ":test_support",
     "//base",
     "//mojo/application/public/cpp",
+    "//mojo/fetcher",
+    "//mojo/package_manager",
+    "//mojo/util:filename_util",
     "//third_party/mojo/src/mojo/edk/test:run_all_unittests",
+    "//third_party/mojo/src/mojo/public/cpp/system",
     "//testing/gtest",
     "//url",
   ]
diff --git a/mojo/shell/application_instance.h b/mojo/shell/application_instance.h
index a99a385..ea6a91b 100644
--- a/mojo/shell/application_instance.h
+++ b/mojo/shell/application_instance.h
@@ -11,10 +11,10 @@
 #include "base/memory/scoped_ptr.h"
 #include "mojo/application/public/interfaces/application.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/shell/capability_filter.h"
 #include "mojo/shell/connect_to_application_params.h"
 #include "mojo/shell/identity.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 #include "url/gurl.h"
 
 namespace mojo {
diff --git a/mojo/shell/application_loader.h b/mojo/shell/application_loader.h
index f464ab13..a13b254c 100644
--- a/mojo/shell/application_loader.h
+++ b/mojo/shell/application_loader.h
@@ -7,8 +7,8 @@
 
 #include "base/callback.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/system/core.h"
 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 #include "url/gurl.h"
 
 namespace mojo {
diff --git a/mojo/shell/application_manager.cc b/mojo/shell/application_manager.cc
index 6c6064d..add0bd8f 100644
--- a/mojo/shell/application_manager.cc
+++ b/mojo/shell/application_manager.cc
@@ -11,12 +11,12 @@
 #include "base/stl_util.h"
 #include "base/strings/string_util.h"
 #include "base/trace_event/trace_event.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/shell/application_instance.h"
 #include "mojo/shell/fetcher.h"
 #include "mojo/shell/package_manager.h"
 #include "mojo/shell/query_util.h"
 #include "mojo/shell/switches.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
 namespace mojo {
 namespace shell {
diff --git a/mojo/shell/application_manager.h b/mojo/shell/application_manager.h
index 16afd44..3b8d90aa 100644
--- a/mojo/shell/application_manager.h
+++ b/mojo/shell/application_manager.h
@@ -14,14 +14,14 @@
 #include "mojo/application/public/interfaces/application.mojom.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/capability_filter.h"
 #include "mojo/shell/connect_to_application_params.h"
 #include "mojo/shell/fetcher.h"
 #include "mojo/shell/identity.h"
 #include "mojo/shell/native_runner.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc
index e13f616f..72a4182 100644
--- a/mojo/shell/application_manager_unittest.cc
+++ b/mojo/shell/application_manager_unittest.cc
@@ -13,7 +13,6 @@
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/application_manager.h"
 #include "mojo/shell/connect_util.h"
@@ -22,6 +21,7 @@
 #include "mojo/shell/test.mojom.h"
 #include "mojo/shell/test_package_manager.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 namespace shell {
diff --git a/mojo/shell/capability_filter.h b/mojo/shell/capability_filter.h
index a2a9dfd..685496f 100644
--- a/mojo/shell/capability_filter.h
+++ b/mojo/shell/capability_filter.h
@@ -8,7 +8,7 @@
 #include <map>
 #include <set>
 
-#include "mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
 
 namespace mojo {
 namespace shell {
diff --git a/mojo/shell/capability_filter_test.cc b/mojo/shell/capability_filter_test.cc
index b50f7174..6214554f 100644
--- a/mojo/shell/capability_filter_test.cc
+++ b/mojo/shell/capability_filter_test.cc
@@ -12,9 +12,9 @@
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/application/public/cpp/service_provider_impl.h"
 #include "mojo/common/weak_binding_set.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/package_manager.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
 
 namespace mojo {
 namespace shell {
diff --git a/mojo/shell/connect_to_application_params.h b/mojo/shell/connect_to_application_params.h
index badca06..457db98 100644
--- a/mojo/shell/connect_to_application_params.h
+++ b/mojo/shell/connect_to_application_params.h
@@ -10,9 +10,9 @@
 #include "base/callback.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "mojo/application/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
 #include "mojo/shell/identity.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
 #include "url/gurl.h"
 
 namespace mojo {
diff --git a/mojo/shell/data_pipe_peek.h b/mojo/shell/data_pipe_peek.h
index 0bcf1dd9..a26e079 100644
--- a/mojo/shell/data_pipe_peek.h
+++ b/mojo/shell/data_pipe_peek.h
@@ -7,7 +7,7 @@
 
 #include <string>
 
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace shell {
diff --git a/mojo/runner/data_pipe_peek_unittest.cc b/mojo/shell/data_pipe_peek_unittest.cc
similarity index 96%
rename from mojo/runner/data_pipe_peek_unittest.cc
rename to mojo/shell/data_pipe_peek_unittest.cc
index 42c2177..b71f9bbb 100644
--- a/mojo/runner/data_pipe_peek_unittest.cc
+++ b/mojo/shell/data_pipe_peek_unittest.cc
@@ -4,7 +4,6 @@
 
 #include "mojo/shell/data_pipe_peek.h"
 
-#include "mojo/runner/context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojo {
@@ -12,8 +11,6 @@
 namespace {
 
 TEST(DataPipePeek, PeekNBytes) {
-  Context::EnsureEmbedderIsInitialized();
-
   DataPipe data_pipe;
   DataPipeConsumerHandle consumer(data_pipe.consumer_handle.get());
   DataPipeProducerHandle producer(data_pipe.producer_handle.get());
@@ -72,8 +69,6 @@
 }
 
 TEST(DataPipePeek, PeekLine) {
-  Context::EnsureEmbedderIsInitialized();
-
   DataPipe data_pipe;
   DataPipeConsumerHandle consumer(data_pipe.consumer_handle.get());
   DataPipeProducerHandle producer(data_pipe.producer_handle.get());
diff --git a/mojo/util/capture_util.h b/mojo/util/capture_util.h
index 4b89eb7..c4ccd0d 100644
--- a/mojo/util/capture_util.h
+++ b/mojo/util/capture_util.h
@@ -5,7 +5,7 @@
 #ifndef MOJO_UTIL_CAPTURE_UTIL_H_
 #define MOJO_UTIL_CAPTURE_UTIL_H_
 
-#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 
 namespace mojo {
 
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 59d170778..00ccb3f 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -21,6 +21,7 @@
 #include "base/lazy_instance.h"
 #include "base/memory/singleton.h"
 #include "base/metrics/histogram_macros.h"
+#include "base/metrics/sparse_histogram.h"
 #include "base/profiler/scoped_tracker.h"
 #include "base/stl_util.h"
 #include "base/strings/string_piece.h"
@@ -1208,6 +1209,12 @@
   if (IsRenegotiationAllowed())
     SSL_set_renegotiate_mode(ssl_, ssl_renegotiate_freely);
 
+  uint8_t server_key_exchange_hash = SSL_get_server_key_exchange_hash(ssl_);
+  if (server_key_exchange_hash != TLSEXT_hash_none) {
+    UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLServerKeyExchangeHash",
+                                server_key_exchange_hash);
+  }
+
   // Verify the certificate.
   UpdateServerCert();
   GotoState(STATE_VERIFY_CERT);
@@ -1313,16 +1320,6 @@
     }
   }
 
-  if (result == OK) {
-    if (SSL_session_reused(ssl_)) {
-      // Record whether or not the server tried to resume a session for a
-      // different version. See https://crbug.com/441456.
-      UMA_HISTOGRAM_BOOLEAN(
-          "Net.SSLSessionVersionMatch",
-          SSL_version(ssl_) == SSL_get_session(ssl_)->ssl_version);
-    }
-  }
-
   const CertStatus cert_status = server_cert_verify_result_.cert_status;
   if (transport_security_state_ &&
       (result == OK ||
diff --git a/remoting/android/apk/src/org/chromium/chromoting/RemotingApplication.java b/remoting/android/apk/src/org/chromium/chromoting/RemotingApplication.java
index f7239203..9e3d8d6 100644
--- a/remoting/android/apk/src/org/chromium/chromoting/RemotingApplication.java
+++ b/remoting/android/apk/src/org/chromium/chromoting/RemotingApplication.java
@@ -7,11 +7,14 @@
 import android.app.Application;
 
 import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory;
+import org.chromium.chromoting.help.HelpAndFeedbackBasic;
+import org.chromium.chromoting.help.HelpSingleton;
 
 /** Main context for the application. */
 public class RemotingApplication extends Application {
     @Override
     public void onCreate() {
         AccountSwitcherFactory.setInstance(new AccountSwitcherFactory());
+        HelpSingleton.setInstance(new HelpAndFeedbackBasic());
     }
 }
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
index 375de53e..bf7dd02 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -29,6 +29,8 @@
 import org.chromium.base.Log;
 import org.chromium.chromoting.accountswitcher.AccountSwitcher;
 import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory;
+import org.chromium.chromoting.help.HelpContext;
+import org.chromium.chromoting.help.HelpSingleton;
 import org.chromium.chromoting.jni.JniInterface;
 
 import java.util.ArrayList;
@@ -45,14 +47,6 @@
     /** Only accounts of this type will be selectable for authentication. */
     private static final String ACCOUNT_TYPE = "com.google";
 
-    /** Web page to be displayed in the Help screen when launched from this activity. */
-    private static final String HELP_URL =
-            "https://support.google.com/chrome/?p=mobile_crd_hostslist";
-
-    /** Web page to be displayed when user triggers the hyperlink for setting up hosts. */
-    private static final String HOST_SETUP_URL =
-            "https://support.google.com/chrome/answer/1649523";
-
     /** Result code used for starting {@link DesktopActivity}. */
     public static final int DESKTOP_ACTIVITY = 0;
 
@@ -212,7 +206,8 @@
                     @Override
                     public void onItemClick(AdapterView<?> parent, View view, int position,
                             long id) {
-                        HelpActivity.launch(Chromoting.this, HELP_URL);
+                        HelpSingleton.getInstance().launchHelp(Chromoting.this,
+                                HelpContext.HOST_LIST);
                     }
                 });
 
@@ -367,7 +362,7 @@
     /** Called when the user touches hyperlinked text. */
     @Override
     public void onClick(View view) {
-        HelpActivity.launch(this, HOST_SETUP_URL);
+        HelpSingleton.getInstance().launchHelp(this, HelpContext.HOST_SETUP);
     }
 
     /** Called when the user taps on a host entry. */
diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
index 428636e0..e7b2628 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
@@ -29,6 +29,8 @@
 import android.view.inputmethod.InputMethodManager;
 
 import org.chromium.chromoting.cardboard.DesktopActivity;
+import org.chromium.chromoting.help.HelpContext;
+import org.chromium.chromoting.help.HelpSingleton;
 import org.chromium.chromoting.jni.JniInterface;
 
 import java.util.Set;
@@ -38,10 +40,6 @@
  * A simple screen that does nothing except display a DesktopView and notify it of rotations.
  */
 public class Desktop extends AppCompatActivity implements View.OnSystemUiVisibilityChangeListener {
-    /** Web page to be displayed in the Help screen when launched from this activity. */
-    private static final String HELP_URL =
-            "https://support.google.com/chrome/?p=mobile_crd_connecthost";
-
     /**
      * Preference used for displaying an interestitial dialog only when the user first accesses the
      * Cardboard function.
@@ -407,7 +405,7 @@
             return true;
         }
         if (id == R.id.actionbar_help) {
-            HelpActivity.launch(this, HELP_URL);
+            HelpSingleton.getInstance().launchHelp(this, HelpContext.DESKTOP);
             return true;
         }
         return super.onOptionsItemSelected(item);
diff --git a/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedback.java b/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedback.java
new file mode 100644
index 0000000..2fd560de
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedback.java
@@ -0,0 +1,21 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting.help;
+
+import android.app.Activity;
+
+/** Common interface for help-and-feedback implementations. */
+public interface HelpAndFeedback {
+    /**
+     * Launches a new activity for displaying a Help screen. The implementation will show
+     * information depending on the context, and will allow the user to submit a Feedback
+     * report. The implementation may also grab a screenshot, so the caller should take
+     * any steps to prepare the display before calling this method (for example, closing
+     * navigation drawers).
+     * @param activity Parent activity of the Help screen.
+     * @param helpContext String used by the implementation to show context-based help.
+     */
+    void launchHelp(Activity activity, HelpContext helpContext);
+}
diff --git a/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedbackBasic.java b/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedbackBasic.java
new file mode 100644
index 0000000..fec9f8a4
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/help/HelpAndFeedbackBasic.java
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting.help;
+
+import android.app.Activity;
+
+import org.chromium.chromoting.HelpActivity;
+
+/**
+ * This class implements a basic UI for help-and-feedback.
+ */
+public class HelpAndFeedbackBasic implements HelpAndFeedback {
+    @Override
+    public void launchHelp(Activity activity, HelpContext helpContext) {
+        HelpActivity.launch(activity, urlFromHelpContext(helpContext));
+    }
+
+    private static String urlFromHelpContext(HelpContext helpContext) {
+        switch (helpContext) {
+            case HOST_LIST:
+                return "https://support.google.com/chrome/answer/6002441#hosts";
+            case HOST_SETUP:
+                return "https://support.google.com/chrome/answer/1649523";
+            case DESKTOP:
+                return "https://support.google.com/chrome/answer/6002441#gestures";
+            default:
+                // Unreachable, but required by Java style.
+                assert false;
+                return "";
+        }
+    }
+}
diff --git a/remoting/android/java/src/org/chromium/chromoting/help/HelpContext.java b/remoting/android/java/src/org/chromium/chromoting/help/HelpContext.java
new file mode 100644
index 0000000..298a653
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/help/HelpContext.java
@@ -0,0 +1,21 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting.help;
+
+/**
+ * Enumeration of contexts from which the user could request help in the application. The
+ * HelpAndFeedback implementation is responsible for displaying an appropriate Help article for
+ * each context.
+ */
+public enum HelpContext {
+  // Help for the host-list screen.
+  HOST_LIST,
+
+  // Help on setting up a new host.
+  HOST_SETUP,
+
+  // Help for the connected desktop screen, including touch gestures.
+  DESKTOP,
+}
diff --git a/remoting/android/java/src/org/chromium/chromoting/help/HelpSingleton.java b/remoting/android/java/src/org/chromium/chromoting/help/HelpSingleton.java
new file mode 100644
index 0000000..140e098a
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/help/HelpSingleton.java
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting.help;
+
+/**
+ * Holder for a singleton {@link HelpAndFeedback} instance for the application.
+ */
+public class HelpSingleton {
+    private static HelpAndFeedback sInstance;
+
+    private HelpSingleton() {}
+
+    /** Returns the instance. Called on the UI thread. */
+    public static HelpAndFeedback getInstance() {
+        if (sInstance == null) {
+            // Create a new instance, so that official builds still work before the internal
+            // implementation is complete.
+            sInstance = new HelpAndFeedbackBasic();
+        }
+        return sInstance;
+    }
+
+    /** Sets the instance. Called during application startup on the UI thread. */
+    public static void setInstance(HelpAndFeedback instance) {
+        sInstance = instance;
+    }
+}
diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn
index 8bf1c5e..f62a03f 100644
--- a/remoting/host/BUILD.gn
+++ b/remoting/host/BUILD.gn
@@ -336,7 +336,7 @@
 
   if (is_win) {
     import("//build/toolchain/win/midl.gni")
-    import("//remoting/tools/build/message_compiler.gni")
+    import("//build/win/message_compiler.gni")
 
     # TODO(brettw) these should not be generated via exec_script. This should be
     # part of the build process rather than the metabuild. Instead, a script
diff --git a/remoting/tools/build/message_compiler.gni b/remoting/tools/build/message_compiler.gni
deleted file mode 100644
index 20eae139..0000000
--- a/remoting/tools/build/message_compiler.gni
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-assert(is_win, "This only runs on Windows.")
-
-# Runs mc.exe over a list of sources.
-#
-# sources
-#   List of .mc files to process.
-template("message_compiler") {
-  action_name = "${target_name}_mc"
-  source_set_name = target_name
-
-  action_foreach(action_name) {
-    visibility = [ ":$source_set_name" ]
-    script = "//remoting/tools/build/message_compiler.py"
-
-    sources = invoker.sources
-
-    outputs = [
-      "$target_gen_dir/{{source_name_part}}.h",
-      "$target_gen_dir/{{source_name_part}}.rc",
-    ]
-
-    args = [
-      # Where to put the header.
-      "-h",
-      rebase_path(target_gen_dir, root_build_dir),
-
-      # Where to put the .rc file.
-      "-r",
-      rebase_path(target_gen_dir, root_build_dir),
-
-      # Input is Unicode.
-      "-u",
-      "{{source}}",
-    ]
-
-    if (defined(invoker.deps)) {
-      deps = invoker.deps
-    }
-  }
-
-  source_set(source_set_name) {
-    sources = get_target_outputs(":$action_name")
-    deps = [
-      ":$action_name",
-    ]
-  }
-}
diff --git a/remoting/tools/build/message_compiler.py b/remoting/tools/build/message_compiler.py
deleted file mode 100644
index 60b0eaa5..0000000
--- a/remoting/tools/build/message_compiler.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Runs the Microsoft Message Compiler (mc.exe). This Python adapter is for the
-# GYP build, which can only run Python and not native binaries.
-
-import subprocess
-import sys
-
-# mc writes to stderr, so this explicily redirects to stdout and eats it.
-try:
-  subprocess.check_output(["mc.exe"] + sys.argv[1:], stderr=subprocess.STDOUT)
-except subprocess.CalledProcessError as e:
-  print e.output
-  sys.exit(e.returncode)
diff --git a/remoting/webapp/base/js/chromoting_event.js b/remoting/webapp/base/js/chromoting_event.js
index 7bd21df..afb400d 100644
--- a/remoting/webapp/base/js/chromoting_event.js
+++ b/remoting/webapp/base/js/chromoting_event.js
@@ -95,6 +95,8 @@
   this.auth_method;
   /** @type {string} */
   this.raw_plugin_error;
+  /** @type {remoting.ChromotingEvent.SessionSummary} */
+  this.previous_session;
 
   this.init_();
 };
@@ -175,6 +177,27 @@
   this.raw_stanza = stanza;
 };
 
+/**
+ * See class comments on logs/proto/chromoting/chromoting_extensions.proto.
+ *
+ * @struct
+ * @constructor
+ */
+remoting.ChromotingEvent.SessionSummary = function() {
+  /** @type {string} */
+  this.session_id;
+  /** @type {remoting.ChromotingEvent.SessionState} */
+  this.last_state;
+  /** @type {remoting.ChromotingEvent.ConnectionError} */
+  this.last_error;
+  /** @type {number} */
+  this.duration;
+  /** @type {number} */
+  this.session_end_elapsed_time;
+  /** @type {remoting.ChromotingEvent.SessionEntryPoint} */
+  this.entry_point;
+};
+
 })();
 
 /**
diff --git a/remoting/webapp/base/js/client_plugin_impl.js b/remoting/webapp/base/js/client_plugin_impl.js
index b23e0e7..be06f9854 100644
--- a/remoting/webapp/base/js/client_plugin_impl.js
+++ b/remoting/webapp/base/js/client_plugin_impl.js
@@ -175,7 +175,7 @@
   // https://developer.chrome.com/native-client/devguide/coding/progress-events,
   // which is extremely unlikely in retail builds.  So we just log it without
   // propagating it to the UI.
-  console.error('Plugin crashed.');
+  console.error('Plugin crashed. ');
 };
 
 /** @private */
diff --git a/remoting/webapp/base/js/client_session.js b/remoting/webapp/base/js/client_session.js
index 38532c647..27e6853 100644
--- a/remoting/webapp/base/js/client_session.js
+++ b/remoting/webapp/base/js/client_session.js
@@ -308,9 +308,13 @@
       '</jingle>' +
     '</cli:iq>');
 
-  var state = error.isNone() ?
-                  remoting.ClientSession.State.CLOSED :
-                  remoting.ClientSession.State.FAILED;
+  var state = remoting.ClientSession.State.FAILED;
+  if (error.hasTag(
+          remoting.Error.Tag.NONE,
+          remoting.Error.Tag.CLIENT_SUSPENDED)) {
+    state = remoting.ClientSession.State.CLOSED;
+  }
+
   this.error_ = error;
   this.setState_(state);
 };
@@ -610,8 +614,7 @@
  */
 remoting.ClientSession.prototype.notifyStateChanges_ =
     function(oldState, newState) {
-  /** @type {remoting.Error} */
-  var error;
+  var error = this.getError();
   switch (this.state_) {
     case remoting.ClientSession.State.CONNECTED:
       console.log('Connection established.');
@@ -636,12 +639,11 @@
 
     case remoting.ClientSession.State.CLOSED:
       console.log('Connection closed.');
-      this.listener_.onDisconnected(remoting.Error.none());
+      this.listener_.onDisconnected(error);
       break;
 
     case remoting.ClientSession.State.CONNECTION_CANCELED:
     case remoting.ClientSession.State.FAILED:
-      error = this.getError();
       if (!error.isNone()) {
         console.error('Connection failed: ' + error.toString());
       }
@@ -649,7 +651,6 @@
       break;
 
     case remoting.ClientSession.State.CONNECTION_DROPPED:
-      error = this.getError();
       console.error('Connection dropped: ' + error.toString());
       this.listener_.onDisconnected(error);
       break;
diff --git a/remoting/webapp/base/js/session_logger.js b/remoting/webapp/base/js/session_logger.js
index 95eaa73e..c05b5e8 100644
--- a/remoting/webapp/base/js/session_logger.js
+++ b/remoting/webapp/base/js/session_logger.js
@@ -31,7 +31,9 @@
   /** @private */
   this.sessionIdGenerationTime_ = 0;
   /** @private */
-  this.sessionStartTime_ = new Date().getTime();
+  this.sessionStartTime_ = Date.now();
+  /** @private */
+  this.sessionEndTime_ = 0;
   /** @private {remoting.ChromotingEvent.ConnectionType} */
   this.connectionType_;
   /** @private {remoting.ChromotingEvent.SessionEntryPoint} */
@@ -52,6 +54,10 @@
   this.mode_ = remoting.ChromotingEvent.Mode.ME2ME;
   /** @private {remoting.ChromotingEvent.AuthMethod} */
   this.authMethod_;
+  /** @private {remoting.ChromotingEvent} */
+  this.lastSessionEntry_ = null;
+  /** @private {remoting.ChromotingEvent.SessionSummary} */
+  this.previousSessionSummary_ = null;
 
   this.setSessionId_();
 };
@@ -129,6 +135,14 @@
 };
 
 /**
+ * @param {remoting.ChromotingEvent.SessionSummary} summary
+ */
+remoting.SessionLogger.prototype.setPreviousSessionSummary =
+    function(summary) {
+  this.previousSessionSummary_ = summary;
+};
+
+/**
  * @return {string} The current session id. This is random GUID, refreshed
  *     every 24hrs.
  */
@@ -137,6 +151,24 @@
 };
 
 /**
+ * @return {remoting.ChromotingEvent.SessionSummary} A snapshot of the current
+ *     session.
+ */
+remoting.SessionLogger.prototype.createSummary = function() {
+  var summary = new remoting.ChromotingEvent.SessionSummary();
+  summary.session_id = this.lastSessionEntry_.session_id;
+  summary.last_state = this.lastSessionEntry_.session_state;
+  summary.last_error = this.lastSessionEntry_.connection_error;
+  summary.entry_point = this.lastSessionEntry_.session_entry_point;
+  summary.duration = this.lastSessionEntry_.session_duration;
+  if (this.sessionEndTime_ > 0) {
+    summary.session_end_elapsed_time =
+        (Date.now() - this.sessionEndTime_) / 1000;
+  }
+  return summary;
+};
+
+/**
  * @param {remoting.SignalStrategy.Type} strategyType
  * @param {remoting.FallbackSignalStrategy.Progress} progress
  */
@@ -166,6 +198,14 @@
 
   this.log_(entry);
 
+  this.lastSessionEntry_ =
+      /** @type {remoting.ChromotingEvent} */ (base.deepCopy(entry));
+
+  // Update the session summary.
+  if (remoting.ChromotingEvent.isEndOfSession(entry)) {
+    this.sessionEndTime_ = Date.now();
+  }
+
   // Don't accumulate connection statistics across state changes.
   this.logAccumulatedStatistics_();
   this.statsAccumulator_.empty();
@@ -296,6 +336,9 @@
   if (this.authMethod_ != undefined) {
     entry.auth_method = this.authMethod_;
   }
+  if (this.previousSessionSummary_) {
+    entry.previous_session = this.previousSessionSummary_;
+  }
   entry.host_version = this.hostVersion_;
   entry.host_os = this.hostOs_;
   entry.host_os_version = this.hostOsVersion_;
diff --git a/remoting/webapp/crd/js/me2me_activity.js b/remoting/webapp/crd/js/me2me_activity.js
index d479df7..a1b5b71 100644
--- a/remoting/webapp/crd/js/me2me_activity.js
+++ b/remoting/webapp/crd/js/me2me_activity.js
@@ -31,8 +31,8 @@
   /** @private */
   this.retryOnHostOffline_ = true;
 
-  /** @private {remoting.NetworkConnectivityDetector} */
-  this.networkDetector_ = null;
+  /** @private {remoting.AutoReconnector} */
+  this.reconnector_ = null;
 
   /** @private {remoting.SessionLogger} */
   this.logger_ = null;
@@ -44,8 +44,8 @@
 remoting.Me2MeActivity.prototype.dispose = function() {
   base.dispose(this.desktopActivity_);
   this.desktopActivity_ = null;
-  base.dispose(this.networkDetector_);
-  this.networkDetector_ = null;
+  base.dispose(this.reconnector_);
+  this.reconnector_ = null;
 };
 
 remoting.Me2MeActivity.prototype.start = function() {
@@ -112,7 +112,10 @@
  * @private
  */
 remoting.Me2MeActivity.prototype.reconnect_ = function(entryPoint) {
+  console.assert(this.logger_, 'Reconnecting without a previous session.');
+  var previousSessionSummary = this.logger_.createSummary();
   this.logger_ = this.createLogger_(entryPoint);
+  this.logger_.setPreviousSessionSummary(previousSessionSummary);
   var Event = remoting.ChromotingEvent;
   this.logger_.logSessionStateChange(Event.SessionState.STARTED);
   this.connect_();
@@ -157,12 +160,12 @@
    */
   var requestPin = function(supportsPairing, onPinFetched) {
     // Set time when PIN was requested.
-    var authStartTime = new Date().getTime();
+    var authStartTime = Date.now();
     that.desktopActivity_.getConnectingDialog().hide();
     that.pinDialog_.show(supportsPairing).then(function(/** string */ pin) {
       remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
       // Done obtaining PIN information. Log time taken for PIN entry.
-      that.logger_.setAuthTotalTime(new Date().getTime() - authStartTime);
+      that.logger_.setAuthTotalTime(Date.now() - authStartTime);
       onPinFetched(pin);
     }).catch(remoting.Error.handler(function(/** remoting.Error */ error) {
       console.assert(error.hasTag(remoting.Error.Tag.CANCELLED),
@@ -254,14 +257,13 @@
 
   if (error.isNone()) {
     this.showFinishDialog_(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME);
-  } else {
-    this.showErrorMessage_(error);
+  } else if (remoting.AutoReconnector.shouldAutoReconnect(error)) {
     var SessionEntryPoint = remoting.ChromotingEvent.SessionEntryPoint;
-    base.dispose(this.networkDetector_);
-    this.networkDetector_ = remoting.NetworkConnectivityDetector.create();
-    this.networkDetector_.waitForOnline().then(
+    this.reconnector_ = new remoting.AutoReconnector(
       this.reconnect_.bind(
           this, SessionEntryPoint.AUTO_RECONNECT_ON_CONNECTION_DROPPED));
+  } else {
+    this.showErrorMessage_(error);
   }
 };
 
@@ -290,8 +292,8 @@
   var that = this;
 
   dialog.show().then(function(/** Result */result) {
-    base.dispose(that.networkDetector_);
-    that.networkDetector_ = null;
+    base.dispose(that.reconnector_);
+    that.reconnector_ = null;
 
     if (result === Result.PRIMARY) {
       remoting.setMode(remoting.AppMode.HOME);
@@ -418,4 +420,45 @@
   }
 };
 
+/**
+ * A helper class to handle auto reconnect when the connection is dropped due to
+ * client connectivity issues.
+ *
+ * @param {Function} reconnectCallback callback to initiate the reconnect
+ *
+ * @constructor
+ * @implements {base.Disposable}
+ *
+ * @private
+ */
+remoting.AutoReconnector = function(reconnectCallback) {
+  /** @private */
+  this.reconnectCallback_ = reconnectCallback;
+  /** @private */
+  this.networkDetector_ =  remoting.NetworkConnectivityDetector.create();
+  /** @private */
+  this.connectingDialog_ = remoting.modalDialogFactory.createConnectingDialog(
+      this.dispose.bind(this));
+
+  var that = this;
+  this.connectingDialog_.show();
+  this.networkDetector_.waitForOnline().then(function() {
+    if (that.reconnectCallback_) {
+      that.connectingDialog_.hide();
+      that.reconnectCallback_();
+    }
+  });
+};
+
+remoting.AutoReconnector.shouldAutoReconnect = function(error) {
+  return error.hasTag(remoting.Error.Tag.CLIENT_SUSPENDED);
+};
+
+remoting.AutoReconnector.prototype.dispose = function() {
+  base.dispose(this.networkDetector_);
+  this.networkDetector_ = null;
+  this.reconnectCallback_ = null;
+  this.connectingDialog_.hide();
+};
+
 })();
diff --git a/remoting/webapp/crd/js/me2me_telemetry_integration_test.js b/remoting/webapp/crd/js/me2me_telemetry_integration_test.js
index d93149c..51a239f 100644
--- a/remoting/webapp/crd/js/me2me_telemetry_integration_test.js
+++ b/remoting/webapp/crd/js/me2me_telemetry_integration_test.js
@@ -199,6 +199,11 @@
     session_entry_point: EntryPoint.RECONNECT_BUTTON,
     role: remoting.ChromotingEvent.Role.CLIENT,
     mode: remoting.ChromotingEvent.Mode.ME2ME,
+    previous_session: {
+      last_state: remoting.ChromotingEvent.SessionState.CLOSED,
+      last_error: remoting.ChromotingEvent.ConnectionError.NONE,
+      entry_point: EntryPoint.CONNECT_BUTTON
+    }
   });
 
   var count = 0;
@@ -274,6 +279,11 @@
     session_entry_point: EntryPoint.AUTO_RECONNECT_ON_HOST_OFFLINE,
     role: remoting.ChromotingEvent.Role.CLIENT,
     mode: remoting.ChromotingEvent.Mode.ME2ME,
+    previous_session: {
+      last_state: remoting.ChromotingEvent.SessionState.CONNECTION_FAILED,
+      last_error: remoting.ChromotingEvent.ConnectionError.HOST_OFFLINE,
+      entry_point: EntryPoint.CONNECT_BUTTON
+    }
   });
 
   var count = 0;
@@ -320,6 +330,11 @@
     session_entry_point:EntryPoint.AUTO_RECONNECT_ON_HOST_OFFLINE,
     role: remoting.ChromotingEvent.Role.CLIENT,
     mode: remoting.ChromotingEvent.Mode.ME2ME,
+    previous_session: {
+      last_state: remoting.ChromotingEvent.SessionState.CONNECTION_FAILED,
+      last_error: remoting.ChromotingEvent.ConnectionError.HOST_OFFLINE,
+      entry_point: EntryPoint.CONNECT_BUTTON
+    }
   }, remoting.ChromotingEvent.ConnectionError.HOST_OVERLOAD);
 
   var count = 0;
@@ -358,24 +373,21 @@
 
 QUnit.test('Connection dropped - Auto Reconnect', function() {
   var EntryPoint = remoting.ChromotingEvent.SessionEntryPoint;
-  expectSequence(testDriver, {
+  expectSucceeded(testDriver, {
     session_entry_point: EntryPoint.CONNECT_BUTTON,
     role: remoting.ChromotingEvent.Role.CLIENT,
     mode: remoting.ChromotingEvent.Mode.ME2ME,
-  }, [
-    remoting.ChromotingEvent.SessionState.STARTED,
-    remoting.ChromotingEvent.SessionState.SIGNALING,
-    remoting.ChromotingEvent.SessionState.CREATING_PLUGIN,
-    remoting.ChromotingEvent.SessionState.CONNECTING,
-    remoting.ChromotingEvent.SessionState.AUTHENTICATED,
-    remoting.ChromotingEvent.SessionState.CONNECTED,
-    remoting.ChromotingEvent.SessionState.CONNECTION_DROPPED,
-  ]);
+  });
 
   expectSucceeded(testDriver, {
     session_entry_point: EntryPoint.AUTO_RECONNECT_ON_CONNECTION_DROPPED,
     role: remoting.ChromotingEvent.Role.CLIENT,
     mode: remoting.ChromotingEvent.Mode.ME2ME,
+    previous_session: {
+      last_state: remoting.ChromotingEvent.SessionState.CLOSED,
+      last_error: remoting.ChromotingEvent.ConnectionError.CLIENT_SUSPENDED,
+      entry_point: EntryPoint.CONNECT_BUTTON
+    }
   });
 
   var count = 0;
@@ -388,10 +400,9 @@
     if (state == remoting.ClientSession.State.CONNECTED) {
       count++;
       if (count == 1) {
-        // On first CONNECTED, fake network failure.
-        plugin.mock$setConnectionStatus(
-            remoting.ClientSession.State.FAILED,
-            remoting.ClientSession.ConnectionError.NETWORK_FAILURE);
+        // On first CONNECTED, fake client suspension.
+        testDriver.me2meActivity().getDesktopActivity().getSession().disconnect(
+            new remoting.Error(remoting.Error.Tag.CLIENT_SUSPENDED));
       } else if (count == 2) {
         // On second CONNECTED, disconnect and finish the test.
         testDriver.me2meActivity().stop();
diff --git a/sql/mojo/DEPS b/sql/mojo/DEPS
index be63411..23304c8 100644
--- a/sql/mojo/DEPS
+++ b/sql/mojo/DEPS
@@ -3,4 +3,5 @@
   "+mojo/application",
   "+mojo/public",
   "+mojo/util",
+  "+third_party/mojo/src/mojo/public",
 ]
diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc
index 943f38b..e2fe138e 100644
--- a/sql/mojo/mojo_vfs.cc
+++ b/sql/mojo/mojo_vfs.cc
@@ -11,8 +11,8 @@
 #include "components/filesystem/public/interfaces/file.mojom.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
 #include "components/filesystem/public/interfaces/types.mojom.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
 #include "mojo/util/capture_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 #include "third_party/sqlite/sqlite3.h"
 
 using mojo::Capture;
diff --git a/sql/mojo/sql_test_base.h b/sql/mojo/sql_test_base.h
index d39198da..11131d4 100644
--- a/sql/mojo/sql_test_base.h
+++ b/sql/mojo/sql_test_base.h
@@ -9,9 +9,9 @@
 #include "base/memory/scoped_ptr.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
 #include "mojo/application/public/cpp/application_test_base.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "sql/connection.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
 namespace sql {
 
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index 502294f..b5a7ade0 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -84,7 +84,7 @@
         "test": "mojo_public_utility_unittests"
       },
       {
-        "test": "mojo_runner_unittests"
+        "test": "mojo_runner_host_unittests"
       },
       {
         "test": "mojo_shell_unittests"
@@ -193,6 +193,12 @@
         "test": "cast_media_unittests"
       },
       {
+        "args": [
+          "--enable-local-file-accesses",
+          "--enable-cma-media-pipeline",
+          "--ozone-platform=cast",
+          "--no-sandbox"
+        ],
         "test": "cast_shell_browser_test"
       },
       {
@@ -553,7 +559,7 @@
         "test": "mojo_public_utility_unittests"
       },
       {
-        "test": "mojo_runner_unittests"
+        "test": "mojo_runner_host_unittests"
       },
       {
         "test": "mojo_shell_unittests"
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json
index 5aada22..6fe68af 100644
--- a/testing/buildbot/chromium.win.json
+++ b/testing/buildbot/chromium.win.json
@@ -1587,7 +1587,7 @@
         "test": "mojo_public_utility_unittests"
       },
       {
-        "test": "mojo_runner_unittests"
+        "test": "mojo_runner_host_unittests"
       },
       {
         "test": "mojo_shell_unittests"
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index a87beb9..904b6e0 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -280,8 +280,8 @@
     "label": "//third_party/mojo/src/mojo/edk/test:mojo_public_utility_unittests",
     "type": "console_test_launcher",
   },
-  "mojo_runner_unittests": {
-    "label": "//mojo/runner:mojo_runner_unittests",
+  "mojo_runner_host_unittests": {
+    "label": "//mojo/runner/host:unittests",
     "type": "unknown",
   },
   "mojo_shell_unittests": {
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 930470c..4733b71 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -225,7 +225,6 @@
 crbug.com/248938 [ Win ] virtual/threaded/animations/change-keyframes.html [ Pass Failure ]
 crbug.com/248938 virtual/threaded/transitions/transition-end-event-nested.html [ Pass Failure ]
 crbug.com/503874 http/tests/inspector/sources/debugger/worker-debugging-script-mapping.html [ Pass Failure ]
-crbug.com/503875 inspector/sources/debugger-step/debugger-step-into-document-write.html [ Pass Failure Timeout ]
 crbug.com/513143 virtual/threaded/fast/scroll-behavior/subframe-interrupted-scroll.html [ Failure Pass ]
 crbug.com/513143 virtual/threaded_animation_timelines/fast/scroll-behavior/subframe-interrupted-scroll.html [ Failure Pass ]
 crbug.com/248938 virtual/threaded/animations/display-none-terminates-animation.html  [ Pass Failure ]
@@ -277,7 +276,6 @@
 crbug.com/498539 [ Mac10.8 Mac10.10 ] inspector/sources/debugger/debug-inlined-scripts-fragment-id.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] inspector/sources/debugger-pause/pause-in-inline-script.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] inspector/sources/debugger-step/debugger-step-over-inlined-scripts.html [ Pass Timeout ]
-crbug.com/498539 [ Precise Mac10.8 Trusty Mac10.9 Retina Win7 Mac10.7 Linux32 Mac10.6 XP Mac10.10 ] inspector/sources/debugger-ui/script-formatter-breakpoints-2.html [ Failure Pass ]
 crbug.com/498539 [ Precise Win7 Mac10.10 ] inspector/sources/debugger-breakpoints/dynamic-scripts-breakpoints.html [ Pass Timeout ]
 crbug.com/498539 [ Precise Mac10.10 ] inspector/sources/debugger-breakpoints/set-breakpoint.html [ Pass Timeout ]
 crbug.com/498539 [ Trusty ] inspector/sources/debugger/mutation-observer-suspend-while-paused.html [ Pass Timeout ]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
index ccf79869..6adf832 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
@@ -26,6 +26,14 @@
 });
 
 promise_test(() => {
+  testRunner.setBluetoothMockDataSet('HeartRateAdapter');
+  return assert_promise_rejects_with_message(
+    requestDeviceWithKeyDown({filters: []}),
+    new TypeError('Failed to execute \'requestDevice\' on \'Bluetooth\': ' +
+                  '\'filters\' member must be non-empty to find any devices.'))
+}, 'An empty |filters| member should result in a TypeError');
+
+promise_test(() => {
   testRunner.setBluetoothMockDataSet('EmptyAdapter');
   return assert_promise_rejects(requestDeviceWithKeyDown({
     filters: [{}]
diff --git a/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them-expected.txt b/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them-expected.txt
new file mode 100644
index 0000000..2a78c6e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them-expected.txt
@@ -0,0 +1,3 @@
+
+PASS
+crbug.com/553048: Don't attempt to collapse anonymous children when destroying them.
diff --git a/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them.html b/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them.html
new file mode 100644
index 0000000..0158147
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/block/dont-collapse-anonymous-children-when-destroying-them.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+    .img { display: table; }
+</style>
+<body>
+    <img id="first" data-expected-width=0>
+    <img id="second" class="img">
+    crbug.com/553048: Don't attempt to collapse anonymous children when destroying them.
+</body>
+<script src="../../resources/check-layout.js"></script>
+<script>
+    document.body.offsetTop;
+    document.getElementById("second").style.position = "fixed";
+    document.body.offsetTop;
+    document.getElementById("second").style.display = "inline-block";
+    window.checkLayout("#first");
+</script>
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
index 530d3b3..362a56e5 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 20 tests started and ended at the correct time.
-PASS All 20 tests passed within an acceptable relative tolerance of 4.657e-10.
+PASS All 20 tests passed within an acceptable relative tolerance of 0.0000037194.
 PASS AudioParam setValueCurveAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation-expected.txt
index c5e874b..c4c0948 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation-expected.txt
@@ -6,29 +6,29 @@
 PASS Check: Curve end time is less than or equal to 1.
 PASS Check: Full gain start time is less than or equal to 1.
 PASS Check: Full gain start time is greater than or equal to 0.021718750000000002.
-PASS SNR is greater than or equal to 172.068.
-PASS Max difference is less than or equal to 5.961e-8.
+PASS SNR is greater than or equal to 171.206.
+PASS Max difference is less than or equal to 5.9605e-8.
 PASS Test: curve length = 2; duration frames = 300.
 
 PASS Check: Curve end time is less than or equal to 1.
 PASS Check: Full gain start time is less than or equal to 1.
 PASS Check: Full gain start time is greater than or equal to 0.021718750000000002.
-PASS SNR is greater than or equal to 172.068.
-PASS Max difference is less than or equal to 5.961e-8.
+PASS SNR is greater than or equal to 171.206.
+PASS Max difference is less than or equal to 5.9605e-8.
 PASS Test: curve length = 3; duration frames = 300.
 
 PASS Check: Curve end time is less than or equal to 1.
 PASS Check: Full gain start time is less than or equal to 1.
 PASS Check: Full gain start time is greater than or equal to 0.021718750000000002.
-PASS SNR is greater than or equal to 170.012.
-PASS Max difference is less than or equal to 5.961e-8.
+PASS SNR is greater than or equal to 170.892.
+PASS Max difference is less than or equal to 5.9605e-8.
 PASS Test: curve length = 16; duration frames = 300.
 
 PASS Check: Curve end time is less than or equal to 1.
 PASS Check: Full gain start time is less than or equal to 1.
 PASS Check: Full gain start time is greater than or equal to 0.021718750000000002.
-PASS SNR is greater than or equal to 170.196.
-PASS Max difference is less than or equal to 5.961e-8.
+PASS SNR is greater than or equal to 168.712.
+PASS Max difference is less than or equal to 1.1921e-7.
 PASS Test: curve length = 100; duration frames = 300.
 
 PASS Check: Curve end time is less than or equal to 1.
@@ -55,10 +55,15 @@
 PASS Check: Curve end time is less than or equal to 1.
 PASS Check: Full gain start time is less than or equal to 1.
 PASS Check: Full gain start time is greater than or equal to 0.51.
-PASS SNR is greater than or equal to 152.8.
-PASS Max difference is less than or equal to 5.961e-8.
+PASS SNR is greater than or equal to 152.784.
+PASS Max difference is less than or equal to 5.9605e-8.
 PASS Test: curve length = 1000; duration frames = 12800.
 
+PASS Curve value at time 0.7 is equal to -1.
+PASS Curve value at time 0.7999999999999999 is equal to 0.
+PASS Curve value at time 0.8999999999999999 is equal to 1.
+PASS Test: crbug.com/44471
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
index 06a6e14..e9bb6b9 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
@@ -51,32 +51,32 @@
         curveDuration: 300 / sampleRate,
         curveLength: 2,
         fullGainTime: 0.75,
-        maxErrorThreshold: 5.961e-8,
-        snrThreshold: 172.068
+        maxErrorThreshold: 5.9605e-8,
+        snrThreshold: 171.206
       }, {
         // Increase the curve length
         curveStartTime: 256 / sampleRate,
         curveDuration: 300 / sampleRate,
         curveLength: 3,
         fullGainTime: 0.75,
-        maxErrorThreshold: 5.961e-8,
-        snrThreshold: 172.068
+        maxErrorThreshold: 5.9605e-8,
+        snrThreshold: 171.206
       }, {
         // Increase the curve length
         curveStartTime: 256 / sampleRate,
         curveDuration: 300 / sampleRate,
         curveLength: 16,
         fullGainTime: 0.75,
-        maxErrorThreshold: 5.961e-8,
-        snrThreshold: 170.012
+        maxErrorThreshold: 5.9605e-8,
+        snrThreshold: 170.892
       }, {
         // Increase the curve length
         curveStartTime: 256 / sampleRate,
         curveDuration: 300 / sampleRate,
         curveLength: 100,
         fullGainTime: 0.75,
-        maxErrorThreshold: 5.961e-8,
-        snrThreshold: 170.196
+        maxErrorThreshold: 1.1921e-7,
+        snrThreshold: 168.712
       }, {
         // Corner case with duration less than a frame!
         curveStartTime: 256 / sampleRate,
@@ -107,8 +107,8 @@
         curveDuration: .5,
         curveLength: 1000,
         fullGainTime: 0.75,
-        maxErrorThreshold: 5.961e-8,
-        snrThreshold: 152.800
+        maxErrorThreshold: 5.9605e-8,
+        snrThreshold: 152.784
       }];
 
       // Creates a function based on the test config that is suitable for use by defineTask().
@@ -125,6 +125,54 @@
         audit.defineTask(name, createTaskFunction(config));
       }
 
+      // Simple test from crbug.com/441471.  Makes sure the end points and the middle point are
+      // interpolated correctly.
+      audit.defineTask("crbug-441471", function (done) {
+        // Any sample rate should work; we pick something small such that the time end points are on
+        // a sampling point.
+        var context = new OfflineAudioContext(1, 5000, 5000)
+
+        // A constant source 
+        var source = context.createBufferSource();
+        source.buffer = createConstantBuffer(context, 1, 1);
+        source.loop = true;
+
+        var gain = context.createGain();
+
+        var startTime = 0.7;
+        var duration = 0.2;
+        
+        // Create the curve.  The interpolated result should be just a straight line from -1 to 1
+        // from time startTime to startTime + duration.
+
+        var c = new Float32Array(3);
+        c[0] = -1;
+        c[1] = 0;
+        c[2] = 1;
+        gain.gain.setValueCurveAtTime(c, startTime, duration);
+        source.connect(gain);
+        gain.connect(context.destination);
+        source.start();
+
+        context.startRendering().then(function (renderedBuffer) { 
+          var data = renderedBuffer.getChannelData(0);
+          var endTime = startTime + duration;
+          var midPoint = (startTime + endTime) / 2;
+          var success = true;
+
+          success = Should("Curve value at time " + startTime,
+            data[timeToSampleFrame(startTime, context.sampleRate)]).beEqualTo(c[0]) && success;
+          success = Should("Curve value at time " + midPoint,
+            data[timeToSampleFrame(midPoint, context.sampleRate)]).beEqualTo(c[1]) && success;
+          success = Should("Curve value at time " + endTime,
+            data[timeToSampleFrame(endTime, context.sampleRate)]).beEqualTo(c[2]) && success;
+          if (success)
+            testPassed("Test: crbug.com/44471\n");
+          else
+            testFailed("Test: crbug.com/44471\n");
+        }).then(done);
+      });
+
       // Must be the last defined task.
       audit.defineTask("end", function (done) {
         finishJSTest();
@@ -229,7 +277,7 @@
 
          // Linearly ramp now.  This assumes that the actual curve used is a linear ramp, even if
          // there are many curve points.
-         var stepSize = curveValue / (config.curveDuration * sampleRate - 1);
+         var stepSize = curveValue / (config.curveDuration * sampleRate);
          for (; k < curveEndFrame; ++k)
            expected[k] = stepSize * (k - curveStartFrame);
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
index ffbc5706..09f60e9 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
@@ -26,7 +26,7 @@
 // Max allowed difference between the rendered data and the expected result.  Because of the linear
 // interpolation, the rendered curve isn't exactly the same as the reference.  This value is
 // experimentally determined.
-var maxAllowedError = 4.657e-10;
+var maxAllowedError = 3.7194e-6;
 
 // The amplitude of the sine wave.
 var sineAmplitude = 1;
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
index abcbce1..b0461fc 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
@@ -151,8 +151,8 @@
     var length = Math.floor(endFrame - startFrame);
     var array = new Array(length);
 
-    // v(t) = linearly interpolate between V[k] and V[k + 1] where k = floor(N/duration*(t - t0))
-    var f = length / (endTime - startTime);
+    // v(t) = linearly interpolate between V[k] and V[k + 1] where k = floor((N-1)/duration*(t - t0))
+    var f = (length - 1) / (endTime - startTime);
 
     for (var k = 0; k < length; ++k) {
         var t = (startFrame + k) / sampleRate;
diff --git a/third_party/WebKit/Source/core/animation/AnimationEffect.cpp b/third_party/WebKit/Source/core/animation/AnimationEffect.cpp
index 6668ffb..3d64889 100644
--- a/third_party/WebKit/Source/core/animation/AnimationEffect.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationEffect.cpp
@@ -52,9 +52,7 @@
 } // namespace
 
 AnimationEffect::AnimationEffect(const Timing& timing, EventDelegate* eventDelegate)
-    : m_parent(nullptr)
-    , m_startTime(0)
-    , m_animation(nullptr)
+    : m_animation(nullptr)
     , m_timing(timing)
     , m_eventDelegate(eventDelegate)
     , m_calculated()
@@ -100,7 +98,7 @@
 void AnimationEffect::computedTiming(ComputedTimingProperties& computedTiming)
 {
     // ComputedTimingProperties members.
-    computedTiming.setStartTime(startTimeInternal() * 1000);
+    computedTiming.setStartTime(0);
     computedTiming.setEndTime(endTimeInternal() * 1000);
     computedTiming.setActiveDuration(activeDurationInternal() * 1000);
 
@@ -142,7 +140,7 @@
     m_needsUpdate = false;
     m_lastUpdateTime = inheritedTime;
 
-    const double localTime = inheritedTime - m_startTime;
+    const double localTime = inheritedTime;
     double timeToNextIteration = std::numeric_limits<double>::infinity();
     if (needsUpdate) {
         const double activeDuration = this->activeDurationInternal();
@@ -191,9 +189,9 @@
 
         m_calculated.phase = currentPhase;
         m_calculated.isInEffect = !isNull(activeTime);
-        m_calculated.isInPlay = phase() == PhaseActive && (!m_parent || m_parent->isInPlay());
-        m_calculated.isCurrent = phase() == PhaseBefore || isInPlay() || (m_parent && m_parent->isCurrent());
-        m_calculated.localTime = m_lastUpdateTime - m_startTime;
+        m_calculated.isInPlay = phase() == PhaseActive;
+        m_calculated.isCurrent = phase() == PhaseBefore || isInPlay();
+        m_calculated.localTime = m_lastUpdateTime;
     }
 
     // Test for events even if timing didn't need an update as the animation may have gained a start time.
@@ -228,7 +226,6 @@
 
 DEFINE_TRACE(AnimationEffect)
 {
-    visitor->trace(m_parent);
     visitor->trace(m_animation);
     visitor->trace(m_eventDelegate);
 }
diff --git a/third_party/WebKit/Source/core/animation/AnimationEffect.h b/third_party/WebKit/Source/core/animation/AnimationEffect.h
index dbf91c9d..41de54a 100644
--- a/third_party/WebKit/Source/core/animation/AnimationEffect.h
+++ b/third_party/WebKit/Source/core/animation/AnimationEffect.h
@@ -96,8 +96,7 @@
 
     double iterationDuration() const;
     double activeDurationInternal() const;
-    double startTimeInternal() const { return m_startTime; }
-    double endTimeInternal() const { return std::max(startTimeInternal(), startTimeInternal() + specifiedTiming().startDelay + activeDurationInternal() + specifiedTiming().endDelay); }
+    double endTimeInternal() const { return specifiedTiming().startDelay + activeDurationInternal() + specifiedTiming().endDelay; }
 
     const Animation* animation() const { return m_animation; }
     Animation* animation() { return m_animation; }
@@ -142,9 +141,6 @@
     virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const = 0;
     virtual void specifiedTimingChanged() { }
 
-    // FIXME: m_parent and m_startTime are placeholders, they depend on timing groups.
-    Member<AnimationEffect> m_parent;
-    const double m_startTime;
     Member<Animation> m_animation;
     Timing m_timing;
     Member<EventDelegate> m_eventDelegate;
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
index e2a7467..1ac4bf6 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
@@ -224,7 +224,7 @@
 
 double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const
 {
-    const double start = startTimeInternal() + specifiedTiming().startDelay;
+    const double start = specifiedTiming().startDelay;
     const double end = start + activeDurationInternal();
 
     switch (phase()) {
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index c34fd02..398d3fd 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -2335,6 +2335,8 @@
             'dom/DocumentOrderedList.h',
             'dom/DocumentOrderedMap.cpp',
             'dom/DocumentParser.cpp',
+            'dom/DocumentStatisticsCollector.cpp',
+            'dom/DocumentStatisticsCollector.h',
             'dom/DocumentStyleSheetCollection.cpp',
             'dom/DocumentStyleSheetCollection.h',
             'dom/DocumentStyleSheetCollector.cpp',
@@ -3790,6 +3792,7 @@
             'dom/AttrTest.cpp',
             'dom/CrossThreadTaskTest.cpp',
             'dom/DOMImplementationTest.cpp',
+            'dom/DocumentStatisticsCollectorTest.cpp',
             'dom/DocumentTest.cpp',
             'dom/MainThreadTaskRunnerTest.cpp',
             'dom/NthIndexCacheTest.cpp',
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp
new file mode 100644
index 0000000..695cecac
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp
@@ -0,0 +1,253 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "DocumentStatisticsCollector.h"
+
+#include "core/HTMLNames.h"
+#include "core/InputTypeNames.h"
+#include "core/dom/ElementTraversal.h"
+#include "core/dom/NodeComputedStyle.h"
+#include "core/dom/Text.h"
+#include "core/frame/FrameHost.h"
+#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLMetaElement.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebDistillability.h"
+
+namespace blink {
+
+using namespace HTMLNames;
+
+namespace {
+
+// Saturate the length of a paragraph to save time.
+const int kTextContentLengthSaturation = 1000;
+
+// Filter out short P elements. The threshold is set to around 2 English sentences.
+const unsigned kParagraphLengthThreshold = 140;
+
+// Saturate the scores to save time. The max is the score of 6 long paragraphs.
+const double kMozScoreSaturation = 175.954539583; // 6 * sqrt(kTextContentLengthSaturation - kParagraphLengthThreshold)
+const double kMozScoreAllSqrtSaturation = 189.73665961; // 6 * sqrt(kTextContentLengthSaturation);
+const double kMozScoreAllLinearSaturation = 6 * kTextContentLengthSaturation;
+
+unsigned textContentLengthSaturated(Element& root)
+{
+    unsigned length = 0;
+    // This skips shadow DOM intentionally, to match the JavaScript implementation.
+    // We would like to use the same statistics extracted by the JavaScript implementation
+    // on iOS, and JavaScript cannot peek deeply into shadow DOM except on modern Chrome
+    // versions.
+    // Given shadow DOM rarely appears in <P> elements in long-form articles, the overall
+    // accuracy should not be largely affected.
+    for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
+        if (!node.isTextNode()) {
+            continue;
+        }
+        length += toText(node).length();
+        if (length > kTextContentLengthSaturation) {
+            return kTextContentLengthSaturation;
+        }
+    }
+    return length;
+}
+
+bool isVisible(const Element& element)
+{
+    const ComputedStyle* style = element.computedStyle();
+    if (!style)
+        return false;
+    return (
+        style->display() != NONE
+        && style->visibility() != HIDDEN
+        && style->opacity() != 0
+    );
+}
+
+bool matchAttributes(const Element& element, const Vector<String>& words)
+{
+    const String& classes = element.getClassAttribute();
+    const String& id = element.getIdAttribute();
+    for (const String& word : words) {
+        if (classes.findIgnoringCase(word) != WTF::kNotFound
+            || id.findIgnoringCase(word) != WTF::kNotFound) {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool isGoodForScoring(const WebDistillabilityFeatures& features, const Element& element)
+{
+    DEFINE_STATIC_LOCAL(Vector<String>, unlikelyCandidates, ());
+    if (unlikelyCandidates.isEmpty()) {
+        auto words = {
+            "banner",
+            "combx",
+            "comment",
+            "community",
+            "disqus",
+            "extra",
+            "foot",
+            "header",
+            "menu",
+            "related",
+            "remark",
+            "rss",
+            "share",
+            "shoutbox",
+            "sidebar",
+            "skyscraper",
+            "sponsor",
+            "ad-break",
+            "agegate",
+            "pagination",
+            "pager",
+            "popup"
+        };
+        for (auto word : words) {
+            unlikelyCandidates.append(word);
+        }
+    }
+    DEFINE_STATIC_LOCAL(Vector<String>, highlyLikelyCandidates, ());
+    if (highlyLikelyCandidates.isEmpty()) {
+        auto words = {
+            "and",
+            "article",
+            "body",
+            "column",
+            "main",
+            "shadow"
+        };
+        for (auto word : words) {
+            highlyLikelyCandidates.append(word);
+        }
+    }
+
+    if (!isVisible(element))
+        return false;
+    if (features.mozScore >= kMozScoreSaturation
+        && features.mozScoreAllSqrt >= kMozScoreAllSqrtSaturation
+        && features.mozScoreAllLinear >= kMozScoreAllLinearSaturation)
+        return false;
+    if (matchAttributes(element, unlikelyCandidates)
+        && !matchAttributes(element, highlyLikelyCandidates))
+        return false;
+    return true;
+}
+
+// underListItem denotes that at least one of the ancesters is <li> element.
+void collectFeatures(Element& root, WebDistillabilityFeatures& features, bool underListItem = false)
+{
+    for (Node& node : NodeTraversal::childrenOf(root)) {
+        if (!node.isElementNode()) {
+            continue;
+        }
+
+        features.elementCount++;
+        Element& element = toElement(node);
+        if (element.hasTagName(aTag)) {
+            features.anchorCount++;
+        } else if (element.hasTagName(formTag)) {
+            features.formCount++;
+        } else if (element.hasTagName(inputTag)) {
+            const HTMLInputElement& input = toHTMLInputElement(element);
+            if (input.type() == InputTypeNames::text) {
+                features.textInputCount++;
+            } else if (input.type() == InputTypeNames::password) {
+                features.passwordInputCount++;
+            }
+        } else if (element.hasTagName(pTag) || element.hasTagName(preTag)) {
+            if (element.hasTagName(pTag)) {
+                features.pCount++;
+            } else {
+                features.preCount++;
+            }
+            if (!underListItem && isGoodForScoring(features, element)) {
+                unsigned length = textContentLengthSaturated(element);
+                if (length >= kParagraphLengthThreshold) {
+                    features.mozScore += sqrt(length - kParagraphLengthThreshold);
+                    features.mozScore = std::min(features.mozScore, kMozScoreSaturation);
+                }
+                features.mozScoreAllSqrt += sqrt(length);
+                features.mozScoreAllSqrt = std::min(features.mozScoreAllSqrt, kMozScoreAllSqrtSaturation);
+
+                features.mozScoreAllLinear += length;
+                features.mozScoreAllLinear = std::min(features.mozScoreAllLinear, kMozScoreAllLinearSaturation);
+            }
+        } else if (element.hasTagName(liTag)) {
+            underListItem = true;
+        }
+        collectFeatures(element, features, underListItem);
+    }
+}
+
+bool hasOpenGraphArticle(const Element& head)
+{
+    DEFINE_STATIC_LOCAL(AtomicString, ogType, ("og:type"));
+    DEFINE_STATIC_LOCAL(AtomicString, propertyAttr, ("property"));
+    for (const Element* child = ElementTraversal::firstChild(head); child; child = ElementTraversal::nextSibling(*child)) {
+        if (!isHTMLMetaElement(*child))
+            continue;
+        const HTMLMetaElement& meta = toHTMLMetaElement(*child);
+
+        if (meta.name() == ogType || meta.getAttribute(propertyAttr) == ogType) {
+            if (equalIgnoringCase(meta.content(), "article")) {
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
+bool isMobileFriendly(Document& document)
+{
+    if (FrameHost* frameHost = document.frameHost())
+        return frameHost->visualViewport().shouldDisableDesktopWorkarounds();
+    return false;
+}
+
+} // namespace
+
+WebDistillabilityFeatures DocumentStatisticsCollector::collectStatistics(Document& document)
+{
+    TRACE_EVENT0("blink", "DocumentStatisticsCollector::collectStatistics");
+
+    WebDistillabilityFeatures features = WebDistillabilityFeatures();
+
+    if (!document.frame() || !document.frame()->isMainFrame())
+        return features;
+
+    ASSERT(document.hasFinishedParsing());
+
+    HTMLElement* body = document.body();
+    HTMLElement* head = document.head();
+
+    if (!body || !head)
+        return features;
+
+    if (isMobileFriendly(document)) {
+        features.isMobileFriendly = true;
+        // We only trigger Reader Mode on non-mobile-friendly pages for now.
+        return features;
+    }
+
+    double startTime = monotonicallyIncreasingTime();
+
+    // This should be cheap since collectStatistics is only called right after layout.
+    document.updateLayoutTreeIfNeeded();
+
+    // Traverse the DOM tree and collect statistics.
+    collectFeatures(*body, features);
+    features.openGraph = hasOpenGraphArticle(*head);
+
+    double elapsedTime = monotonicallyIncreasingTime() - startTime;
+    Platform::current()->histogramCustomCounts("WebCore.DistillabilityUs", static_cast<int>(1e6 * elapsedTime), 1, 1000000, 50);
+
+    return features;
+}
+
+}
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.h b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.h
new file mode 100644
index 0000000..2d725d8f
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.h
@@ -0,0 +1,22 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DocumentStatisticsCollector_h
+#define DocumentStatisticsCollector_h
+
+#include "core/CoreExport.h"
+
+namespace blink {
+
+class Document;
+struct WebDistillabilityFeatures;
+
+class CORE_EXPORT DocumentStatisticsCollector {
+public:
+    static WebDistillabilityFeatures collectStatistics(Document&);
+};
+
+}
+
+#endif
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
new file mode 100644
index 0000000..fcf1213
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
@@ -0,0 +1,156 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/dom/DocumentStatisticsCollector.h"
+
+#include "core/dom/Document.h"
+#include "core/dom/DocumentVisibilityObserver.h"
+#include "core/frame/FrameView.h"
+#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLLinkElement.h"
+#include "core/testing/DummyPageHolder.h"
+#include "public/platform/WebDistillability.h"
+#include "wtf/text/StringBuilder.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+namespace blink {
+
+// Saturate the length of a paragraph to save time.
+const unsigned kTextContentLengthSaturation = 1000;
+
+// Filter out short P elements. The threshold is set to around 2 English sentences.
+const unsigned kParagraphLengthThreshold = 140;
+
+class DocumentStatisticsCollectorTest : public ::testing::Test {
+protected:
+    void SetUp() override;
+
+#if ENABLE(OILPAN)
+    void TearDown() override
+    {
+        Heap::collectAllGarbage();
+    }
+#endif
+
+    Document& document() const { return m_dummyPageHolder->document(); }
+
+    void setHtmlInnerHTML(const String&);
+
+private:
+    OwnPtr<DummyPageHolder> m_dummyPageHolder;
+};
+
+void DocumentStatisticsCollectorTest::SetUp()
+{
+    m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
+}
+
+void DocumentStatisticsCollectorTest::setHtmlInnerHTML(const String& htmlContent)
+{
+    document().documentElement()->setInnerHTML((htmlContent), ASSERT_NO_EXCEPTION);
+}
+
+// This test checks open graph articles can be recognized.
+TEST_F(DocumentStatisticsCollectorTest, HasOpenGraphArticle)
+{
+    setHtmlInnerHTML(
+        "<head>"
+        // Note the case-insensitive matching of the word "article".
+        "    <meta property='og:type' content='arTiclE' />"
+        "</head>"
+    );
+    WebDistillabilityFeatures features = DocumentStatisticsCollector::collectStatistics(document());
+
+    EXPECT_TRUE(features.openGraph);
+}
+
+// This test checks non-existence of open graph articles can be recognized.
+TEST_F(DocumentStatisticsCollectorTest, NoOpenGraphArticle)
+{
+    setHtmlInnerHTML(
+        "<head>"
+        "    <meta property='og:type' content='movie' />"
+        "</head>"
+    );
+    WebDistillabilityFeatures features = DocumentStatisticsCollector::collectStatistics(document());
+
+    EXPECT_FALSE(features.openGraph);
+}
+
+// This test checks element counts are correct.
+TEST_F(DocumentStatisticsCollectorTest, CountElements)
+{
+    setHtmlInnerHTML(
+        "<form>"
+        "    <input type='text'>"
+        "    <input type='password'>"
+        "</form>"
+        "<pre></pre>"
+        "<p><a>    </a></p>"
+        "<ul><li><p><a>    </a></p></li></ul>"
+    );
+    WebDistillabilityFeatures features = DocumentStatisticsCollector::collectStatistics(document());
+
+    EXPECT_FALSE(features.openGraph);
+
+    EXPECT_EQ(10u, features.elementCount);
+    EXPECT_EQ(2u, features.anchorCount);
+    EXPECT_EQ(1u, features.formCount);
+    EXPECT_EQ(1u, features.textInputCount);
+    EXPECT_EQ(1u, features.passwordInputCount);
+    EXPECT_EQ(2u, features.pCount);
+    EXPECT_EQ(1u, features.preCount);
+}
+
+// This test checks score calculations are correct.
+TEST_F(DocumentStatisticsCollectorTest, CountScore)
+{
+    setHtmlInnerHTML(
+        "<p class='menu' id='article'>1</p>" // textContentLength = 1
+        "<ul><li><p>12</p></li></ul>" // textContentLength = 2, skipped because under li
+        "<p class='menu'>123</p>" // textContentLength = 3, skipped because unlikelyCandidates
+        "<p>"
+            "12345678901234567890123456789012345678901234567890"
+            "12345678901234567890123456789012345678901234567890"
+            "12345678901234567890123456789012345678901234"
+        "</p>" // textContentLength = 144
+        "<p style='display:none'>12345</p>" // textContentLength = 5, skipped because invisible
+        "<div style='display:none'><p>123456</p></div>" // textContentLength = 6, skipped because invisible
+        "<div style='visibility:hidden'><p>1234567</p></div>" // textContentLength = 7, skipped because invisible
+        "<p style='opacity:0'>12345678</p>" // textContentLength = 8, skipped because invisible
+        "<p><a href='#'>1234 </a>6 <b> 9</b></p>" // textContentLength = 9
+    );
+    WebDistillabilityFeatures features = DocumentStatisticsCollector::collectStatistics(document());
+
+    EXPECT_DOUBLE_EQ(features.mozScore, sqrt(144 - kParagraphLengthThreshold));
+    EXPECT_DOUBLE_EQ(features.mozScoreAllSqrt, 1 + sqrt(144) + sqrt(9));
+    EXPECT_DOUBLE_EQ(features.mozScoreAllLinear, 1 + 144 + 9);
+}
+
+// This test checks score calculations are correct.
+TEST_F(DocumentStatisticsCollectorTest, CountScoreSaturation)
+{
+    StringBuilder html;
+    for (int i = 0; i < 10; i++) {
+        html.append("<p>");
+        for (int j = 0; j < 1000; j++) {
+            html.append("0123456789");
+        }
+        html.append("</p>");
+    }
+    setHtmlInnerHTML(
+        html.toString()
+    );
+    WebDistillabilityFeatures features = DocumentStatisticsCollector::collectStatistics(document());
+
+    double error = 1e-5;
+    EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - kParagraphLengthThreshold), error);
+    EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation), error);
+    EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, error);
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/Selection.idl b/third_party/WebKit/Source/core/editing/Selection.idl
index a2c75d1..4456922 100644
--- a/third_party/WebKit/Source/core/editing/Selection.idl
+++ b/third_party/WebKit/Source/core/editing/Selection.idl
@@ -34,42 +34,42 @@
     ImplementedAs=DOMSelection,
     WillBeGarbageCollected,
 ] interface Selection {
-    readonly attribute Node? anchorNode;
-    readonly attribute long anchorOffset;
-    readonly attribute Node? focusNode;
-    readonly attribute long focusOffset;
-    readonly attribute boolean isCollapsed;
-    readonly attribute long rangeCount;
+    [MeasureAs=SelectionAnchorNode] readonly attribute Node? anchorNode;
+    [MeasureAs=SelectionAnchorOffset] readonly attribute long anchorOffset;
+    [MeasureAs=SelectionFocusNode] readonly attribute Node? focusNode;
+    [MeasureAs=SelectionFocusOffset] readonly attribute long focusOffset;
+    [MeasureAs=SelectionIsCollapsed] readonly attribute boolean isCollapsed;
+    [MeasureAs=SelectionRangeCount] readonly attribute long rangeCount;
     [MeasureAs=SelectionType] readonly attribute DOMString type;
-    [RaisesException] Range getRangeAt(long index);
-    void addRange(Range range);
+    [MeasureAs=SelectionGetRangeAt, RaisesException] Range getRangeAt(long index);
+    [MeasureAs=SelectionAddRange] void addRange(Range range);
     // TODO(yoichio): Implement removeRange. crbug.com/391673
     //void removeRange(Range range);
-    void removeAllRanges();
+    [MeasureAs=SelectionRemoveAllRanges] void removeAllRanges();
     [MeasureAs=SelectionEmpty] void empty();
     // TODO(yoichio): The node argument should not be nullable. crbug.com/391673
     // TODO(philipj): The offset argument should not have a default value.
-    [RaisesException] void collapse(Node? node, optional long offset = 0);
+    [MeasureAs=SelectionCollapse, RaisesException] void collapse(Node? node, optional long offset = 0);
     // TODO(yoichio): The node argument should not be nullable. crbug.com/391673
     // TODO(philipj): The offset argument should not have a default value.
     [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] void setPosition(Node? node, optional long offset = 0);
-    [RaisesException] void collapseToStart();
-    [RaisesException] void collapseToEnd();
+    [MeasureAs=SelectionCollapseToStart, RaisesException] void collapseToStart();
+    [MeasureAs=SelectionCollapseToEnd, RaisesException] void collapseToEnd();
     // TODO(philipj): The offset argument should not have a default value.
-    [RaisesException, TypeChecking=Interface] void extend(Node node, optional long offset = 0);
+    [MeasureAs=SelectionExtend, RaisesException, TypeChecking=Interface] void extend(Node node, optional long offset = 0);
     // TODO(philipj): The arguments should be anchorNode, anchorOffset,
     // focusNode and focusOffset, and none of them should be optional.
     [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent([Default=Undefined] optional Node baseNode,
                                                                                  [Default=Undefined] optional long baseOffset,
                                                                                  [Default=Undefined] optional Node extentNode,
                                                                                  [Default=Undefined] optional long extentOffset);
-    [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node);
-    [CustomElementCallbacks] void deleteFromDocument();
+    [MeasureAs=SelectionSelectAllChildren, RaisesException, TypeChecking=Interface] void selectAllChildren(Node node);
+    [MeasureAs=SelectionDeleteDromDocument, CustomElementCallbacks] void deleteFromDocument();
     [MeasureAs=SelectionContainsNode, TypeChecking=Interface] boolean containsNode(Node node, optional boolean allowPartialContainment = false);
     // TODO(philipj): The spec does not use [NotEnumerable]. See also:
     // https://codereview.chromium.org/345983004/
     // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179
-    [NotEnumerable] stringifier DOMString ();
+    [MeasureAs=SelectionDOMString, NotEnumerable] stringifier DOMString();
 
     // Non-standard APIs
 
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp
index 1abb7893..b5cbebb 100644
--- a/third_party/WebKit/Source/core/frame/Frame.cpp
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -85,6 +85,7 @@
     visitor->trace(m_treeNode);
     visitor->trace(m_host);
     visitor->trace(m_owner);
+    visitor->trace(m_client);
 }
 
 void Frame::detach(FrameDetachType type)
diff --git a/third_party/WebKit/Source/core/frame/Frame.h b/third_party/WebKit/Source/core/frame/Frame.h
index a063c1c..24909d3d 100644
--- a/third_party/WebKit/Source/core/frame/Frame.h
+++ b/third_party/WebKit/Source/core/frame/Frame.h
@@ -141,7 +141,7 @@
     RawPtrWillBeMember<FrameOwner> m_owner;
 
 private:
-    FrameClient* m_client;
+    RawPtrWillBeMember<FrameClient> m_client;
     // Needed to identify Frame Timing requests.
     int64_t m_frameID;
     bool m_isLoading;
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 252ee3e..8f76e2c 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -856,6 +856,22 @@
         MeterElementWithNoneAppearance = 994,
         MeterElementWithRatingAppearance = 995,
         MeterElementWithRelevancyAppearance = 996,
+        SelectionAnchorNode = 997,
+        SelectionAnchorOffset = 998,
+        SelectionFocusNode = 999,
+        SelectionFocusOffset = 1000,
+        SelectionIsCollapsed = 1001,
+        SelectionRangeCount = 1002,
+        SelectionGetRangeAt = 1003,
+        SelectionAddRange = 1004,
+        SelectionRemoveAllRanges = 1005,
+        SelectionCollapse = 1006,
+        SelectionCollapseToStart = 1007,
+        SelectionCollapseToEnd = 1008,
+        SelectionExtend = 1009,
+        SelectionSelectAllChildren = 1010,
+        SelectionDeleteDromDocument = 1011,
+        SelectionDOMString = 1012,
 
         // Add new features immediately above this line. Don't change assigned
         // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index f6994d9..8569b99 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -765,7 +765,7 @@
             setContinuation(nullptr);
             destroy();
         }
-    } else if (!beingDestroyed() && !oldChild->isFloatingOrOutOfFlowPositioned() && isLayoutBlockFlow()) {
+    } else if (!beingDestroyed() && !oldChild->isFloatingOrOutOfFlowPositioned() && isLayoutBlockFlow() && !oldChild->isAnonymousBlock()) {
         // If the child we're removing means that we can now treat all children as inline without the need for anonymous blocks, then do that.
         makeChildrenInlineIfPossible();
     }
diff --git a/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h
index 397d0b2..b4e81f2a 100644
--- a/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h
+++ b/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h
@@ -34,6 +34,7 @@
 #include "core/CoreExport.h"
 #include "core/dom/MessagePort.h"
 #include "core/workers/WorkerReportingProxy.h"
+#include "platform/heap/Handle.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 
@@ -78,6 +79,7 @@
 
 private:
     // These objects always outlive this proxy.
+    GC_PLUGIN_IGNORE("553613")
     ExecutionContext* m_executionContext;
     WorkerMessagingProxy* m_messagingProxy;
 };
diff --git a/third_party/WebKit/Source/devtools/devtools.gypi b/third_party/WebKit/Source/devtools/devtools.gypi
index 81790f9..92851c8 100644
--- a/third_party/WebKit/Source/devtools/devtools.gypi
+++ b/third_party/WebKit/Source/devtools/devtools.gypi
@@ -202,10 +202,14 @@
         ],
         'devtools_emulation_js_files': [
             'front_end/emulation/devicesSettingsTab.css',
+            'front_end/emulation/deviceModeToolbar.css',
+            'front_end/emulation/deviceModeView.css',
             'front_end/emulation/overrides.css',
             'front_end/emulation/sensors.css',
             'front_end/emulation/responsiveDesignView.css',
             'front_end/emulation/DeviceModeButton.js',
+            'front_end/emulation/DeviceModeModel.js',
+            'front_end/emulation/DeviceModeView.js',
             'front_end/emulation/DevicesSettingsTab.js',
             'front_end/emulation/EmulatedDevices.js',
             'front_end/emulation/InspectedPagePlaceholder.js',
@@ -797,6 +801,7 @@
             'front_end/Images/securityPropertyInsecure.svg',
             'front_end/Images/securityPropertySecure.svg',
             'front_end/Images/securityPropertyWarning.svg',
+            'front_end/Images/securityPropertyUnknown.svg',
             'front_end/Images/securityStateInsecure.svg',
             'front_end/Images/securityStateNeutral.svg',
             'front_end/Images/securityStateSecure.svg',
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
index 2948451..458a752 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
@@ -385,6 +385,42 @@
 
 /**
  * @constructor
+ * @param {number} left
+ * @param {number} top
+ * @param {number} width
+ * @param {number} height
+ */
+WebInspector.Rect = function(left, top, width, height)
+{
+    this.left = left;
+    this.top = top;
+    this.width = width;
+    this.height = height;
+}
+
+WebInspector.Rect.prototype = {
+    /**
+     * @param {?WebInspector.Rect} rect
+     * @return {boolean}
+     */
+    isEqual: function(rect)
+    {
+        return !!rect && this.left === rect.left && this.top === rect.top && this.width == rect.width && this.height == rect.height;
+    },
+
+    /**
+     * @param {number} scale
+     * @return {!WebInspector.Rect}
+     */
+    scale: function(scale)
+    {
+        return new WebInspector.Rect(this.left * scale, this.top * scale, this.width * scale, this.height * scale);
+    }
+}
+
+
+/**
+ * @constructor
  * @param {!Size=} minimum
  * @param {?Size=} preferred
  */
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
new file mode 100644
index 0000000..e08e9cf0
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
@@ -0,0 +1,405 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @param {function()} updateCallback
+ * @implements {WebInspector.TargetManager.Observer}
+ */
+WebInspector.DeviceModeModel = function(updateCallback)
+{
+    this._updateCallback = updateCallback;
+    this._screenRect = new WebInspector.Rect(0, 0, 1, 1);
+    this._visiblePageRect = new WebInspector.Rect(0, 0, 1, 1);
+    this._fitScale = 1;
+    this._availableSize = new Size(1, 1);
+    this._deviceMetricsThrottler = new WebInspector.Throttler(0);
+
+    this._fitSetting = WebInspector.settings.createSetting("deviceFitWindow", true);
+    this._fitSetting.addChangeListener(this._fitSettingChanged, this);
+    this._genericWidthSetting = WebInspector.settings.createSetting("deviceGenericWidth", 0);
+    this._genericWidthSetting.set(0);
+    this._genericWidthSetting.addChangeListener(this._genericWidthSettingChanged, this);
+
+    /** @type {!WebInspector.DeviceModeModel.Type} */
+    this._type = WebInspector.DeviceModeModel.Type.Desktop;
+    /** @type {?WebInspector.EmulatedDevice} */
+    this._device = null;
+    /** @type {?WebInspector.EmulatedDevice.Mode} */
+    this._mode = null;
+    /** @type {boolean} */
+    this._touchEnabled = false;
+    /** @type {string} */
+    this._touchConfiguration = "";
+    /** @type {string} */
+    this._screenOrientation = "";
+    /** @type {number} */
+    this._fixedFitScale = 0;
+
+    /** @type {?WebInspector.Target} */
+    this._target = null;
+    WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Page);
+}
+
+/** @enum {string} */
+WebInspector.DeviceModeModel.Type = {
+    Mobile: "Mobile",
+    Tablet: "Tablet",
+    Desktop: "Desktop",
+    Device: "Device"
+}
+
+WebInspector.DeviceModeModel.MaxDeviceSize = 10000;
+
+/**
+ * @param {string} value
+ * @return {string}
+ */
+WebInspector.DeviceModeModel.deviceSizeValidator = function(value)
+{
+    if (!value || (/^[\d]+$/.test(value) && value >= 0 && value <= WebInspector.OverridesSupport.MaxDeviceSize))
+        return "";
+    return WebInspector.UIString("Value must be non-negative integer");
+}
+
+WebInspector.DeviceModeModel._touchEventsScriptIdSymbol = Symbol("DeviceModeModel.touchEventsScriptIdSymbol");
+// TODO(paulirish): decide on these.
+WebInspector.DeviceModeModel._genericMobileUserAgent = "Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.114 Mobile Safari/537.36";
+WebInspector.DeviceModeModel._genericTabletUserAgent = "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2307.2 Safari/537.36";
+
+WebInspector.DeviceModeModel.prototype = {
+    /**
+     * @param {!Size} size
+     */
+    availableSizeChanged: function(size)
+    {
+        this._availableSize = size;
+        this._calculateAndEmulate(false);
+    },
+
+    /**
+     * @param {!WebInspector.DeviceModeModel.Type} type
+     * @param {?WebInspector.EmulatedDevice} device
+     */
+    emulate: function(type, device)
+    {
+        this._type = type;
+
+        if (type === WebInspector.DeviceModeModel.Type.Device) {
+            console.assert(device, "Must pass a device for device emulation");
+            this._device = device;
+            this._mode = device.modes[0];
+        } else {
+            this._device = null;
+            this._mode = null;
+            this._genericWidthSetting.removeChangeListener(this._genericWidthSettingChanged, this);
+            this._genericWidthSetting.set(type === WebInspector.DeviceModeModel.Type.Desktop ? 0 : (type === WebInspector.DeviceModeModel.Type.Mobile ? 480 : 768));
+            this._genericWidthSetting.addChangeListener(this._genericWidthSettingChanged, this);
+        }
+
+        this._calculateAndEmulate(true);
+    },
+
+    /**
+     * @return {?WebInspector.EmulatedDevice}
+     */
+    device: function()
+    {
+        return this._device;
+    },
+
+    /**
+     * @return {!WebInspector.DeviceModeModel.Type}
+     */
+    type: function()
+    {
+        return this._type;
+    },
+
+    /**
+     * @return {string}
+     */
+    screenImage: function()
+    {
+        return (this._device && this._mode) ? this._device.modeImage(this._mode) : "";
+    },
+
+    /**
+     * @return {!WebInspector.Rect}
+     */
+    screenRect: function()
+    {
+        return this._screenRect;
+    },
+
+    /**
+     * @return {!WebInspector.Rect}
+     */
+    visiblePageRect: function()
+    {
+        return this._visiblePageRect;
+    },
+
+    /**
+     * @return {number}
+     */
+    fitScale: function()
+    {
+        return this._fitScale;
+    },
+
+    /**
+     * @return {!Size}
+     */
+    appliedDeviceSize: function()
+    {
+        return new Size(Math.round(this._screenRect.width / this._fitScale), Math.round(this._screenRect.height / this._fitScale));
+    },
+
+    /**
+     * @return {!WebInspector.Setting}
+     */
+    fitSetting: function()
+    {
+        return this._fitSetting;
+    },
+
+    /**
+     * @return {!WebInspector.Setting}
+     */
+    genericWidthSetting: function()
+    {
+        return this._genericWidthSetting;
+    },
+
+    suspendFitScaleChanges: function()
+    {
+        ++this._fixedFitScale;
+    },
+
+    resumeFitScaleChanges: function()
+    {
+        if (!--this._fixedFitScale)
+            this._calculateAndEmulate(false);
+    },
+
+    /**
+     * @override
+     * @param {!WebInspector.Target} target
+     */
+    targetAdded: function(target)
+    {
+        if (!this._target)
+            this._target = target;
+    },
+
+    /**
+     * @override
+     * @param {!WebInspector.Target} target
+     */
+    targetRemoved: function(target)
+    {
+        if (this._target === target)
+            this._target = null;
+    },
+
+    _fitSettingChanged: function()
+    {
+        this._calculateAndEmulate(false);
+    },
+
+    _genericWidthSettingChanged: function()
+    {
+        this._calculateAndEmulate(false);
+    },
+
+    /**
+     * @param {boolean} resetScrollAndPageScale
+     */
+    _calculateAndEmulate: function(resetScrollAndPageScale)
+    {
+        if (this._type === WebInspector.DeviceModeModel.Type.Device) {
+            var orientation = this._device.orientationByName(this._mode.orientation);
+            var screenWidth = orientation.width;
+            var screenHeight = orientation.height;
+            var scale = 1;
+            // Deliberately ignore fixedFitScale.
+            if (this._fitSetting.get()) {
+                while (this._availableSize.width < screenWidth * scale || this._availableSize.height < screenHeight * scale)
+                    scale *= 0.8;
+            }
+            this._applyDeviceMetrics(new Size(screenWidth, screenHeight), this._mode.insets, scale, this._device.deviceScaleFactor, this._device.mobile(), resetScrollAndPageScale);
+            WebInspector.multitargetNetworkManager.setUserAgentOverride(this._device.userAgent);
+            this._applyTouch(this._device.touch(), this._device.mobile());
+            this._applyScreenOrientation(this._mode.orientation == WebInspector.EmulatedDevice.Horizontal ? "landscapePrimary" : "portraitPrimary");
+        } else {
+            // Zero means fill available size.
+            var screenWidth = this._genericWidthSetting.get() || this._availableSize.width;
+            var deviceScaleFactor = this._type === WebInspector.DeviceModeModel.Type.Desktop ? 0 : 2;
+            var mobile = this._type !== WebInspector.DeviceModeModel.Type.Desktop;
+
+            var scale = 1;
+            if (this._fitSetting.get()) {
+                if (this._fixedFitScale) {
+                    scale = this._fitScale;
+                } else {
+                    while (this._availableSize.width < screenWidth * scale)
+                        scale *= 0.8;
+                }
+            }
+            var screenHeight = Math.floor(this._availableSize.height / scale);
+            this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), scale, deviceScaleFactor, mobile, resetScrollAndPageScale);
+            WebInspector.multitargetNetworkManager.setUserAgentOverride(
+                this._type === WebInspector.DeviceModeModel.Type.Mobile ? WebInspector.DeviceModeModel._genericMobileUserAgent :
+                (this._type === WebInspector.DeviceModeModel.Type.Tablet ? WebInspector.DeviceModeModel._genericTabletUserAgent : ""));
+            this._applyTouch(this._type !== WebInspector.DeviceModeModel.Type.Desktop, mobile);
+            if (this._type === WebInspector.DeviceModeModel.Type.Desktop)
+                this._applyScreenOrientation("");
+            else
+                this._applyScreenOrientation(screenHeight >= screenWidth ? "portraitPrimary" : "landscapePrimary");
+        }
+        this._updateCallback();
+    },
+
+    /**
+     * @param {!Size} screenSize
+     * @param {!Insets} insets
+     * @param {number} scale
+     * @param {number} deviceScaleFactor
+     * @param {boolean} mobile
+     * @param {boolean} resetScrollAndPageScale
+     */
+    _applyDeviceMetrics: function(screenSize, insets, scale, deviceScaleFactor, mobile, resetScrollAndPageScale)
+    {
+        var pageWidth = screenSize.width - insets.left - insets.right;
+        var pageHeight = screenSize.height - insets.top - insets.bottom;
+        var positionX = insets.left;
+        var positionY = insets.top;
+
+        this._screenRect = new WebInspector.Rect(
+            Math.max(0, (this._availableSize.width - screenSize.width * scale) / 2),
+            Math.max(0, (this._availableSize.height - screenSize.height * scale) / 2),
+            screenSize.width * scale,
+            screenSize.height * scale);
+        this._visiblePageRect = new WebInspector.Rect(
+            positionX * scale,
+            positionY * scale,
+            Math.min(pageWidth * scale, this._availableSize.width - this._screenRect.left - positionX * scale),
+            Math.min(pageHeight * scale, this._availableSize.height - this._screenRect.top - positionY * scale));
+        this._fitScale = scale;
+
+        if (scale === 1 && this._availableSize.width >= screenSize.width && this._availableSize.height >= screenSize.height) {
+            // When we have enough space, no page size override is required. This will speed things up and remove lag.
+            pageWidth = 0;
+            pageHeight = 0;
+        }
+
+        this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this));
+
+        /**
+         * @this {WebInspector.DeviceModeModel}
+         * @return {!Promise.<?>}
+         */
+        function setDeviceMetricsOverride()
+        {
+            if (!this._target)
+                return Promise.resolve();
+
+            var clear = !pageWidth && !pageHeight && !mobile && !deviceScaleFactor && scale === 1;
+            var setDevicePromise = clear ?
+                this._target.emulationAgent().clearDeviceMetricsOverride(apiCallback.bind(this)) :
+                this._target.emulationAgent().setDeviceMetricsOverride(pageWidth, pageHeight, deviceScaleFactor, mobile, false, scale, 0, 0, screenSize.width, screenSize.height, positionX, positionY, apiCallback.bind(this));
+            var allPromises = [ setDevicePromise ];
+            if (resetScrollAndPageScale)
+                allPromises.push(this._target.emulationAgent().resetScrollAndPageScaleFactor());
+            return Promise.all(allPromises);
+        }
+
+        /**
+         * @param {?Protocol.Error} error
+         * @this {WebInspector.DeviceModeModel}
+         */
+        function apiCallback(error)
+        {
+            if (error) {
+                // TODO(dgozman): warning: "Screen emulation is not available on this page."
+                this._deviceMetricsOverrideAppliedForTest();
+                return;
+            }
+
+            // TODO(dgozman): warning when mobile changed: "You might need to reload the page for proper user agent spoofing and viewport rendering."
+            this._deviceMetricsOverrideAppliedForTest();
+        }
+
+    },
+
+    _deviceMetricsOverrideAppliedForTest: function()
+    {
+        // Used for sniffing in tests.
+    },
+
+    _applyTouch: function(touchEnabled, mobile)
+    {
+        var configuration = mobile ? "mobile" : "desktop";
+        if (!this._target || (this._touchEnabled === touchEnabled && this._touchConfiguration === configuration))
+            return;
+
+        var target = this._target;
+
+        /**
+         * @suppressGlobalPropertiesCheck
+         */
+        const injectedFunction = function() {
+            const touchEvents = ["ontouchstart", "ontouchend", "ontouchmove", "ontouchcancel"];
+            var recepients = [window.__proto__, document.__proto__];
+            for (var i = 0; i < touchEvents.length; ++i) {
+                for (var j = 0; j < recepients.length; ++j) {
+                    if (!(touchEvents[i] in recepients[j]))
+                        Object.defineProperty(recepients[j], touchEvents[i], { value: null, writable: true, configurable: true, enumerable: true });
+                }
+            }
+        };
+
+        var symbol = WebInspector.DeviceModeModel._touchEventsScriptIdSymbol;
+
+        if (typeof target[symbol] !== "undefined") {
+            target.pageAgent().removeScriptToEvaluateOnLoad(target[symbol]);
+            delete target[symbol];
+        }
+
+        if (touchEnabled)
+            target.pageAgent().addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")()", scriptAddedCallback);
+
+        /**
+         * @param {?Protocol.Error} error
+         * @param {string} scriptId
+         */
+        function scriptAddedCallback(error, scriptId)
+        {
+            if (error)
+                delete target[symbol];
+            else
+                target[symbol] = scriptId;
+        }
+
+        target.emulationAgent().setTouchEmulationEnabled(touchEnabled, configuration);
+        this._touchEnabled = touchEnabled;
+        this._touchConfiguration = configuration;
+    },
+
+    /**
+     * @param {string} orientation
+     */
+    _applyScreenOrientation: function(orientation)
+    {
+        if (!this._target || orientation === this._screenOrientation)
+            return;
+
+        this._screenOrientation = orientation;
+        if (!this._screenOrientation)
+            this._target.screenOrientationAgent().clearScreenOrientationOverride();
+        else
+            this._target.screenOrientationAgent().setScreenOrientationOverride(this._screenOrientation === "landscapePrimary" ? 90 : 0, /** @type {!ScreenOrientationAgent.OrientationType} */ (this._screenOrientation));
+    }
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
new file mode 100644
index 0000000..8242ccb2
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
@@ -0,0 +1,286 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @extends {WebInspector.VBox}
+ * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder
+ */
+WebInspector.DeviceModeView = function(inspectedPagePlaceholder)
+{
+    WebInspector.VBox.call(this, true);
+    this.setMinimumSize(150, 150);
+    this.element.classList.add("device-mode-view");
+    this.registerRequiredCSS("emulation/deviceModeView.css");
+
+    this._model = new WebInspector.DeviceModeModel(this._updateUI.bind(this));
+    // TODO(dgozman): media query inspector, warning, better full control, controlling mode, persist type/device, more fit options.
+
+    this._inspectedPagePlaceholder = inspectedPagePlaceholder;
+    this._createUI();
+    WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._updateUI, this);
+};
+
+WebInspector.DeviceModeView.prototype = {
+    _createUI: function()
+    {
+        this._createToolbar();
+
+        this._contentArea = this.contentElement.createChild("div", "device-mode-content-area");
+
+        this._screenArea = this._contentArea.createChild("div", "device-mode-screen-area");
+        this._screenImage = this._screenArea.createChild("img", "device-mode-screen-image hidden");
+        this._screenImage.addEventListener("load", this._onScreenImageLoaded.bind(this, true), false);
+        this._screenImage.addEventListener("error", this._onScreenImageLoaded.bind(this, false), false);
+
+        this._resizerElement = this._screenArea.createChild("div", "device-mode-resizer");
+        this._resizerElement.createChild("div", "");
+        this._createResizer(this._resizerElement);
+
+        this._pageArea = this._screenArea.createChild("div", "device-mode-page-area");
+        this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
+        this._inspectedPagePlaceholder.show(this._pageArea);
+    },
+
+    _createToolbar: function()
+    {
+        var toolbarContainer = this.contentElement.createChild("div", "device-mode-toolbar");
+        var toolbar = new WebInspector.Toolbar(toolbarContainer);
+
+        var deviceSelect = this._createDeviceSelect();
+        var deviceSelectItem = new WebInspector.ToolbarItem(this._wrapToolbarItem(deviceSelect));
+        toolbar.appendToolbarItem(deviceSelectItem);
+        toolbar.appendSeparator();
+
+        var genericWidthInput = createElementWithClass("input", "device-mode-size-input");
+        genericWidthInput.maxLength = 5;
+        genericWidthInput.placeholder = WebInspector.UIString("Full");
+        WebInspector.SettingsUI.bindSettingInputField(genericWidthInput, this._model.genericWidthSetting(), true, WebInspector.DeviceModeModel.deviceSizeValidator, true, true);
+        this._genericWidthItem = new WebInspector.ToolbarItem(this._wrapToolbarItem(genericWidthInput));
+        toolbar.appendToolbarItem(this._genericWidthItem);
+
+        this._deviceSizeInput = createElementWithClass("input", "device-mode-size-input");
+        this._deviceSizeInput.disabled = true;
+        this._deviceSizeInput.style.opacity = "0.7";
+        this._deviceSizeItem = new WebInspector.ToolbarItem(this._wrapToolbarItem(this._deviceSizeInput));
+        toolbar.appendToolbarItem(this._deviceSizeItem);
+        toolbar.appendSeparator();
+
+        var fitCheckbox = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Fit"), this._model.fitSetting(), true, WebInspector.UIString("Zoom to fit available space"));
+        var fitItem = new WebInspector.ToolbarItem(fitCheckbox);
+        toolbar.appendToolbarItem(fitItem);
+    },
+
+    /**
+     * @param {!Element} element
+     * @return {!Element}
+     */
+    _wrapToolbarItem: function(element)
+    {
+        var container = createElement("div");
+        var shadowRoot = WebInspector.createShadowRootWithCoreStyles(container);
+        shadowRoot.appendChild(WebInspector.Widget.createStyleElement("emulation/deviceModeToolbar.css"));
+        shadowRoot.appendChild(element);
+        return container;
+    },
+
+    /**
+     * @return {!Element}
+     */
+    _createDeviceSelect: function()
+    {
+        var select = createElementWithClass("select", "device-mode-device-select");
+        WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevicesList.Events.CustomDevicesUpdated, deviceListChanged, this);
+        WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevicesList.Events.StandardDevicesUpdated, deviceListChanged, this);
+        deviceListChanged.call(this);
+        select.addEventListener("change", optionSelected.bind(this), false);
+        return select;
+
+        /**
+         * @this {WebInspector.DeviceModeView}
+         */
+        function deviceListChanged()
+        {
+            select.removeChildren();
+
+            var genericGroup = select.createChild("optgroup");
+            genericGroup.label = WebInspector.UIString("Generic");
+            addOption.call(this, genericGroup, WebInspector.DeviceModeModel.Type.Mobile, null);
+            addOption.call(this, genericGroup, WebInspector.DeviceModeModel.Type.Tablet, null);
+            addOption.call(this, genericGroup, WebInspector.DeviceModeModel.Type.Desktop, null);
+
+            var deviceGroup = select.createChild("optgroup");
+            deviceGroup.label = WebInspector.UIString("Devices");
+            var devices = WebInspector.emulatedDevicesList.custom().concat(WebInspector.emulatedDevicesList.standard());
+            devices.sort(WebInspector.EmulatedDevice.compareByTitle);
+            for (var device of devices) {
+                if (device.show())
+                    addOption.call(this, deviceGroup, WebInspector.DeviceModeModel.Type.Device, device);
+            }
+        }
+
+        /**
+         * @param {!Element} group
+         * @param {!WebInspector.DeviceModeModel.Type} type
+         * @param {?WebInspector.EmulatedDevice} device
+         * @this {WebInspector.DeviceModeView}
+         */
+        function addOption(group, type, device)
+        {
+            var title = type === WebInspector.DeviceModeModel.Type.Device ? device.title : WebInspector.UIString(type);
+            var option = new Option(title, title);
+            option.device = device;
+            option.type = type;
+            group.appendChild(option);
+
+            if (type === this._model.type() && device === this._model.device())
+                select.selectedIndex = Array.prototype.slice.call(select.options).indexOf(option);
+        }
+
+        /**
+         * @this {WebInspector.DeviceModeView}
+         */
+        function optionSelected()
+        {
+            var option = select.options[select.selectedIndex];
+            this._model.emulate(option.type, option.device);
+            if (option.type !== WebInspector.DeviceModeModel.Type.Desktop)
+                WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.DeviceModeEnabled);
+        }
+    },
+
+    /**
+     * @param {!Element} element
+     * @return {!WebInspector.ResizerWidget}
+     */
+    _createResizer: function(element)
+    {
+        var resizer = new WebInspector.ResizerWidget();
+        resizer.addElement(element);
+        resizer.setCursor("ew-resize");
+        resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeStart, this._onResizeStart, this);
+        resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeUpdate, this._onResizeUpdate, this);
+        resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd, this._onResizeEnd, this);
+        return resizer;
+    },
+
+    /**
+     * @param {!WebInspector.Event} event
+     */
+    _onResizeStart: function(event)
+    {
+        this._slowPositionStart = null;
+        this._resizeStart = this._model.screenRect().width;
+        this._model.suspendFitScaleChanges();
+    },
+
+    /**
+     * @param {!WebInspector.Event} event
+     */
+    _onResizeUpdate: function(event)
+    {
+        if (event.data.shiftKey !== !!this._slowPositionStart)
+            this._slowPositionStart = event.data.shiftKey ? event.data.currentX : null;
+
+        var cssOffset = event.data.currentX - event.data.startX;
+        if (this._slowPositionStart)
+            cssOffset = (event.data.currentX - this._slowPositionStart) / 10 + this._slowPositionStart - event.data.startX;
+        var dipOffset = cssOffset * WebInspector.zoomManager.zoomFactor();
+
+        var newWidth = this._resizeStart + dipOffset * 2;
+        newWidth = Math.round(newWidth / this._model.fitScale());
+        newWidth = Math.max(Math.min(newWidth, WebInspector.DeviceModeModel.MaxDeviceSize), 1);
+        this._model.genericWidthSetting().set(newWidth);
+    },
+
+    /**
+     * @param {!WebInspector.Event} event
+     */
+    _onResizeEnd: function(event)
+    {
+        delete this._resizeStart;
+        this._model.resumeFitScaleChanges();
+    },
+
+    updatePageResizer: function()
+    {
+        // TODO(dgozman): remove once we switch over.
+    },
+
+    _updateUI: function()
+    {
+        if (!this.isShowing())
+            return;
+
+        var zoomFactor = WebInspector.zoomManager.zoomFactor();
+
+        var cssScreenRect = this._model.screenRect().scale(1 / zoomFactor);
+        var cssVisiblePageRect = this._model.visiblePageRect().scale(1 / zoomFactor);
+        var resizePagePlaceholder = false;
+
+        if (!cssScreenRect.isEqual(this._cachedCssScreenRect)) {
+            this._screenArea.style.left = cssScreenRect.left + "px";
+            this._screenArea.style.top = cssScreenRect.top + "px";
+            this._screenArea.style.width = cssScreenRect.width + "px";
+            this._screenArea.style.height = cssScreenRect.height + "px";
+            resizePagePlaceholder = true;
+        }
+
+        if (!cssVisiblePageRect.isEqual(this._cachedCssVisiblePageRect)) {
+            this._pageArea.style.left = cssVisiblePageRect.left + "px";
+            this._pageArea.style.top = cssVisiblePageRect.top + "px";
+            this._pageArea.style.width = cssVisiblePageRect.width + "px";
+            this._pageArea.style.height = cssVisiblePageRect.height + "px";
+            resizePagePlaceholder = true;
+        }
+
+        if (this._model.type() !== this._cachedModelType) {
+            var isDevice = this._model.type() === WebInspector.DeviceModeModel.Type.Device;
+            this._resizerElement.classList.toggle("hidden", isDevice);
+            this._genericWidthItem.setVisible(!isDevice);
+            this._deviceSizeItem.setVisible(isDevice);
+        }
+
+        if (this._model.type() === WebInspector.DeviceModeModel.Type.Device) {
+            var deviceSize = this._model.appliedDeviceSize();
+            this._deviceSizeInput.value = deviceSize.width + "x" + deviceSize.height;
+        }
+        this._loadScreenImage(this._model.screenImage());
+        if (resizePagePlaceholder)
+            this._inspectedPagePlaceholder.onResize();
+
+        this._cachedCssScreenRect = cssScreenRect;
+        this._cachedCssVisiblePageRect = cssVisiblePageRect;
+        this._cachedModelType = this._model.type();
+    },
+
+    /**
+     * @param {string} srcset
+     */
+    _loadScreenImage: function(srcset)
+    {
+        if (this._screenImage.getAttribute("srcset") === srcset)
+            return;
+        this._screenImage.setAttribute("srcset", srcset);
+        if (!srcset)
+            this._screenImage.classList.toggle("hidden", true);
+    },
+
+    /**
+     * @param {boolean} success
+     */
+    _onScreenImageLoaded: function(success)
+    {
+        this._screenImage.classList.toggle("hidden", !success);
+    },
+
+    onResize: function()
+    {
+        var zoomFactor = WebInspector.zoomManager.zoomFactor();
+        var rect = this._contentArea.getBoundingClientRect();
+        this._model.availableSizeChanged(new Size(Math.max(rect.width * zoomFactor, 1), Math.max(rect.height * zoomFactor, 1)));
+    },
+
+    __proto__: WebInspector.VBox.prototype
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/OverridesSupport.js b/third_party/WebKit/Source/devtools/front_end/emulation/OverridesSupport.js
index ee61c3a..0b5f589e 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/OverridesSupport.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/OverridesSupport.js
@@ -45,6 +45,8 @@
 
     this.settings = {};
     this.settings._emulationEnabled = WebInspector.settings.createSetting("emulationEnabled", false);
+    if (Runtime.experiments.isEnabled("deviceMode"))
+        this.settings._emulationEnabled.set(false);
 
     this.settings.userAgent = WebInspector.settings.createSetting("userAgent", "");
 
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css
new file mode 100644
index 0000000..734f8ff
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+.device-mode-size-input {
+    width: 80px !important;
+    text-align: center;
+    background: hsl(0, 0%, 97%);
+    border: 1px solid rgb(216, 216, 216);
+}
+
+.device-mode-size-input:hover,
+.device-mode-size-input:focus {
+    border: 1px solid rgb(202, 202, 202);
+}
+
+.device-mode-device-select {
+    background: none;
+    box-shadow: none;
+    border: none;
+    outline: none;
+    padding: 0 2px;
+    -webkit-appearance: menulist;
+    margin: 0;
+    width: 120px;
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css
new file mode 100644
index 0000000..dfb8491c6a
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+:host {
+    overflow: hidden;
+    align-items: stretch;
+    flex: auto;
+}
+
+.device-mode-toolbar {
+    flex: none;
+    background-color: #f3f3f3;
+    border-bottom: 1px solid #ccc;
+    display: flex;
+    flex-direction: row;
+    align-items: stretch;
+    justify-content: center;
+}
+
+.device-mode-content-area {
+    flex: auto;
+    position: relative;
+    overflow: hidden;
+}
+
+.device-mode-screen-area {
+    position: absolute;
+    left: 0;
+    right: 0;
+    width: 0;
+    height: 0;
+    outline: 1px solid hsl(0, 0%, 95%);
+    background-color: #171717;
+}
+
+.device-mode-screen-image {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+}
+
+.device-mode-resizer {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: -14px;
+    width: 14px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    background-color: hsla(0, 0%, 0%, 0.02);
+    transition: background-color 0.2s ease;
+}
+
+.device-mode-resizer:hover {
+    background-color: hsla(0, 0%, 0%, 0.1);
+}
+
+.device-mode-resizer > div {
+    content: url(Images/toolbarResizerHorizontal.png);
+    pointer-events: none;
+}
+
+.device-mode-page-area {
+    position: absolute;
+    left: 0;
+    right: 0;
+    width: 0;
+    height: 0;
+    display: flex;
+    background-color: rgb(255, 255, 255);
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/module.json b/third_party/WebKit/Source/devtools/front_end/emulation/module.json
index fcb1292..4e08aa30 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/module.json
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/module.json
@@ -4,6 +4,7 @@
             "type": "drawer-view",
             "name": "emulation",
             "title": "Emulation",
+            "experiment": "!deviceMode",
             "order": 10,
             "persistence": "closeable",
             "className": "WebInspector.OverridesView"
@@ -12,6 +13,7 @@
             "type": "@WebInspector.ToolbarItem.Provider",
             "className": "WebInspector.DeviceModeButtonProvider",
             "condition": "can_dock",
+            "experiment": "!deviceMode",
             "order": 1,
             "location": "main-toolbar-left"
         },
@@ -86,10 +88,14 @@
         "MediaQueryInspector.js",
         "ResponsiveDesignView.js",
         "OverridesView.js",
-        "SensorsView.js"
+        "SensorsView.js",
+        "DeviceModeModel.js",
+        "DeviceModeView.js"
     ],
     "resources": [
         "devicesSettingsTab.css",
+        "deviceModeToolbar.css",
+        "deviceModeView.css",
         "responsiveDesignView.css",
         "overrides.css",
         "sensors.css"
diff --git a/third_party/WebKit/Source/devtools/front_end/main/AdvancedApp.js b/third_party/WebKit/Source/devtools/front_end/main/AdvancedApp.js
index 72bcb82..84c098ac 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/AdvancedApp.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/AdvancedApp.js
@@ -28,7 +28,10 @@
 
         this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder();
         this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this), this);
-        this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._inspectedPagePlaceholder);
+        if (Runtime.experiments.isEnabled("deviceMode"))
+            this._responsiveDesignView = new WebInspector.DeviceModeView(this._inspectedPagePlaceholder);
+        else
+            this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._inspectedPagePlaceholder);
 
         WebInspector.dockController.addEventListener(WebInspector.DockController.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this);
         WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged, this._onDockSideChange, this);
@@ -85,13 +88,12 @@
 
     _updateResponsiveDesignView: function()
     {
-        if (this._isDocked()) {
+        if (this._isDocked())
             this._rootSplitWidget.setMainWidget(this._responsiveDesignView);
-            this._responsiveDesignView.updatePageResizer();
-        } else if (this._toolboxRootView) {
+        else if (this._toolboxRootView)
             this._responsiveDesignView.show(this._toolboxRootView.element);
+        if (!Runtime.experiments.isEnabled("deviceMode") && (this._isDocked() || this._toolboxRootView))
             this._responsiveDesignView.updatePageResizer();
-        }
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index f2109dc..b55bdd8 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -127,6 +127,7 @@
         Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI themes");
         Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox JavaScript frames on Timeline", true);
         Runtime.experiments.register("colorContrastRatio", "Contrast ratio line in color picker", true);
+        Runtime.experiments.register("deviceMode", "Device mode", true);
         Runtime.experiments.register("emptySourceMapAutoStepping", "Empty sourcemap auto-stepping");
         Runtime.experiments.register("fileSystemInspection", "FileSystem inspection");
         Runtime.experiments.register("gpuTimeline", "GPU data on timeline", true);
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js
index e7e69f3d..2bbd1515 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js
@@ -56,6 +56,7 @@
         this._autoUserAgent.type = "text";
         this._autoUserAgent.disabled = true;
         WebInspector.multitargetNetworkManager.addEventListener(WebInspector.MultitargetNetworkManager.Events.UserAgentChanged, this._userAgentChanged, this);
+        this._userAgentChanged();
 
         radio = createRadioLabel("custom-user-agent", WebInspector.UIString("Custom user agent"), false);
         this._customUserAgentSetting = WebInspector.settings.createSetting("customUserAgent", "");
@@ -73,12 +74,9 @@
         this._userAgentTypeChanged(this._autoUserAgentRadio);
     },
 
-    /**
-     * @param {!WebInspector.Event} event
-     */
-    _userAgentChanged: function(event)
+    _userAgentChanged: function()
     {
-        this._autoUserAgent.value = /** @type {string} */(event.data) || WebInspector.UIString("Default");
+        this._autoUserAgent.value = WebInspector.multitargetNetworkManager.userAgentOverride() || WebInspector.UIString("Default");
     },
 
     _customUserAgentChanged: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
index fd79f9a..0f9a165f 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
@@ -762,10 +762,20 @@
      */
     setUserAgentOverride: function(userAgent)
     {
+        if (this._userAgentOverride === userAgent)
+            return;
         this._userAgentOverride = userAgent;
         if (!this._customUserAgent)
             this._updateUserAgentOverride();
-        this.dispatchEventToListeners(WebInspector.MultitargetNetworkManager.Events.UserAgentChanged, this._userAgentOverride);
+        this.dispatchEventToListeners(WebInspector.MultitargetNetworkManager.Events.UserAgentChanged);
+    },
+
+    /**
+     * @return {string}
+     */
+    userAgentOverride: function()
+    {
+        return this._userAgentOverride;
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js
index d723f90c..ced4d4a0 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js
@@ -104,16 +104,30 @@
         inputElement.style.width = width;
     inputElement.placeholder = placeholder || "";
 
+    var errorMessageLabel;
+    if (validatorCallback)
+        errorMessageLabel = p.createChild("div", "field-error-message");
+    WebInspector.SettingsUI.bindSettingInputField(inputElement, setting, numeric, validatorCallback, instant, clearForZero, errorMessageLabel);
+    return p;
+}
+
+/**
+ * @param {!Element} inputElement
+ * @param {!WebInspector.Setting} setting
+ * @param {boolean} numeric
+ * @param {function(string):?string=} validatorCallback
+ * @param {boolean=} instant
+ * @param {boolean=} clearForZero
+ * @param {!Element=} errorMessageLabel
+ */
+WebInspector.SettingsUI.bindSettingInputField = function(inputElement, setting, numeric, validatorCallback, instant, clearForZero, errorMessageLabel)
+{
     if (validatorCallback || instant) {
         inputElement.addEventListener("change", onInput, false);
         inputElement.addEventListener("input", onInput, false);
     }
     inputElement.addEventListener("keydown", onKeyDown, false);
 
-    var errorMessageLabel;
-    if (validatorCallback)
-        errorMessageLabel = p.createChild("div", "field-error-message");
-
     function onInput()
     {
         if (validatorCallback)
@@ -164,7 +178,8 @@
         if (!error)
             error = "";
         inputElement.classList.toggle("error-input", !!error);
-        errorMessageLabel.textContent = error;
+        if (errorMessageLabel)
+            errorMessageLabel.textContent = error;
     }
 
     if (!instant)
@@ -192,8 +207,6 @@
 
     if (validatorCallback)
       validate();
-
-    return p;
 }
 
 /**
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
index 4a52ce6..0774e90 100644
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
@@ -95,6 +95,11 @@
 {
     ASSERT(options.hasFilters());
 
+    if (options.filters().isEmpty()) {
+        exceptionState.throwTypeError(
+            "'filters' member must be non-empty to find any devices.");
+    }
+
     Vector<WebBluetoothScanFilter> filters;
     for (const BluetoothScanFilter& filter : options.filters()) {
         WebBluetoothScanFilter canonicalizedFilter = WebBluetoothScanFilter();
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
index 6a8d2042..e4e7755 100644
--- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
+++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
@@ -57,11 +57,11 @@
 static bool throwExceptionIfClosedOrUpdating(bool isOpen, bool isUpdating, ExceptionState& exceptionState)
 {
     if (!isOpen) {
-        exceptionState.throwDOMException(InvalidStateError, "The MediaSource's readyState is not 'open'.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The MediaSource's readyState is not 'open'.");
         return true;
     }
     if (isUpdating) {
-        exceptionState.throwDOMException(InvalidStateError, "The 'updating' attribute is true on one or more of this MediaSource's SourceBuffers.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The 'updating' attribute is true on one or more of this MediaSource's SourceBuffers.");
         return true;
     }
 
@@ -113,6 +113,12 @@
 #endif
 }
 
+void MediaSource::logAndThrowDOMException(ExceptionState& exceptionState, const ExceptionCode& error, const String& message)
+{
+    WTF_LOG(Media, "throwDOMException: error=%d msg=%s", error, message.utf8().data());
+    exceptionState.throwDOMException(error, message);
+}
+
 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& exceptionState)
 {
     WTF_LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this);
@@ -121,21 +127,21 @@
     // 1. If type is an empty string then throw an InvalidAccessError exception
     // and abort these steps.
     if (type.isEmpty()) {
-        exceptionState.throwDOMException(InvalidAccessError, "The type provided is empty.");
+        logAndThrowDOMException(exceptionState, InvalidAccessError, "The type provided is empty.");
         return 0;
     }
 
     // 2. If type contains a MIME type that is not supported ..., then throw a
     // NotSupportedError exception and abort these steps.
     if (!isTypeSupported(type)) {
-        exceptionState.throwDOMException(NotSupportedError, "The type provided ('" + type + "') is unsupported.");
+        logAndThrowDOMException(exceptionState, NotSupportedError, "The type provided ('" + type + "') is unsupported.");
         return 0;
     }
 
     // 4. If the readyState attribute is not in the "open" state then throw an
     // InvalidStateError exception and abort these steps.
     if (!isOpen()) {
-        exceptionState.throwDOMException(InvalidStateError, "The MediaSource's readyState is not 'open'.");
+        logAndThrowDOMException(exceptionState, InvalidStateError, "The MediaSource's readyState is not 'open'.");
         return 0;
     }
 
@@ -169,7 +175,7 @@
     // 1. If sourceBuffer specifies an object that is not in sourceBuffers then
     // throw a NotFoundError exception and abort these steps.
     if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) {
-        exceptionState.throwDOMException(NotFoundError, "The SourceBuffer provided is not contained in this MediaSource.");
+        logAndThrowDOMException(exceptionState, NotFoundError, "The SourceBuffer provided is not contained in this MediaSource.");
         return;
     }
 
@@ -387,11 +393,11 @@
     // 1. If the value being set is negative or NaN then throw an InvalidAccessError
     // exception and abort these steps.
     if (std::isnan(duration)) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::notAFiniteNumber(duration, "duration"));
+        logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::notAFiniteNumber(duration, "duration"));
         return;
     }
     if (duration < 0.0) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexExceedsMinimumBound("duration", duration, 0.0));
+        logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::indexExceedsMinimumBound("duration", duration, 0.0));
         return;
     }
 
@@ -586,14 +592,14 @@
         // Step 2: If type contains a MIME type ... that is not supported with the types
         // specified for the other SourceBuffer objects in sourceBuffers, then throw
         // a NotSupportedError exception and abort these steps.
-        exceptionState.throwDOMException(NotSupportedError, "The type provided ('" + type + "') is not supported.");
+        logAndThrowDOMException(exceptionState, NotSupportedError, "The type provided ('" + type + "') is not supported.");
         return nullptr;
     case WebMediaSource::AddStatusReachedIdLimit:
         ASSERT(!webSourceBuffer);
         // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
         // Step 3: If the user agent can't handle any more SourceBuffer objects then throw
         // a QuotaExceededError exception and abort these steps.
-        exceptionState.throwDOMException(QuotaExceededError, "This MediaSource has reached the limit of SourceBuffer objects it can handle. No additional SourceBuffer objects may be added.");
+        logAndThrowDOMException(exceptionState, QuotaExceededError, "This MediaSource has reached the limit of SourceBuffer objects it can handle. No additional SourceBuffer objects may be added.");
         return nullptr;
     }
 
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.h b/third_party/WebKit/Source/modules/mediasource/MediaSource.h
index 10fbf6d..57484e8d 100644
--- a/third_party/WebKit/Source/modules/mediasource/MediaSource.h
+++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.h
@@ -62,6 +62,8 @@
     static MediaSource* create(ExecutionContext*);
     ~MediaSource() override;
 
+    static void logAndThrowDOMException(ExceptionState&, const ExceptionCode& error, const String& message);
+
     // MediaSource.idl methods
     SourceBufferList* sourceBuffers() { return m_sourceBuffers.get(); }
     SourceBufferList* activeSourceBuffers() { return m_activeSourceBuffers.get(); }
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
index a2fbb9d..7446575 100644
--- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
+++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -62,11 +62,11 @@
 static bool throwExceptionIfRemovedOrUpdating(bool isRemoved, bool isUpdating, ExceptionState& exceptionState)
 {
     if (isRemoved) {
-        exceptionState.throwDOMException(InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
         return true;
     }
     if (isUpdating) {
-        exceptionState.throwDOMException(InvalidStateError, "This SourceBuffer is still processing an 'appendBuffer', 'appendStream', or 'remove' operation.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "This SourceBuffer is still processing an 'appendBuffer', 'appendStream', or 'remove' operation.");
         return true;
     }
 
@@ -172,7 +172,7 @@
     if (newMode == sequenceKeyword())
         appendMode = WebSourceBuffer::AppendModeSequence;
     if (!m_webSourceBuffer->setMode(appendMode)) {
-        exceptionState.throwDOMException(InvalidStateError, "The mode may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The mode may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.");
         return;
     }
 
@@ -186,7 +186,7 @@
     // 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an
     //    InvalidStateError exception and abort these steps.
     if (isRemoved()) {
-        exceptionState.throwDOMException(InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
         return nullptr;
     }
 
@@ -218,7 +218,7 @@
     // 5. If the append state equals PARSING_MEDIA_SEGMENT, then throw an INVALID_STATE_ERR and abort these steps.
     // 6. If the mode attribute equals "sequence", then set the group start timestamp to new timestamp offset.
     if (!m_webSourceBuffer->setTimestampOffset(offset)) {
-        exceptionState.throwDOMException(InvalidStateError, "The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.");
         return;
     }
 
@@ -244,7 +244,7 @@
     // 3. If the new value is less than 0 or greater than or equal to appendWindowEnd then throw an InvalidAccessError
     //    exception and abort these steps.
     if (start < 0 || start >= m_appendWindowEnd) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexOutsideRange("value", start, 0.0, ExceptionMessages::ExclusiveBound, m_appendWindowEnd, ExceptionMessages::InclusiveBound));
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::indexOutsideRange("value", start, 0.0, ExceptionMessages::ExclusiveBound, m_appendWindowEnd, ExceptionMessages::InclusiveBound));
         return;
     }
 
@@ -271,13 +271,13 @@
 
     // 3. If the new value equals NaN, then throw an InvalidAccessError and abort these steps.
     if (std::isnan(end)) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::notAFiniteNumber(end));
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::notAFiniteNumber(end));
         return;
     }
     // 4. If the new value is less than or equal to appendWindowStart then throw an InvalidAccessError
     //    exception and abort these steps.
     if (end <= m_appendWindowStart) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexExceedsMinimumBound("value", end, m_appendWindowStart));
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::indexExceedsMinimumBound("value", end, m_appendWindowStart));
         return;
     }
 
@@ -327,11 +327,11 @@
     // 2. If the readyState attribute of the parent media source is not in the "open" state
     //    then throw an InvalidStateError exception and abort these steps.
     if (isRemoved()) {
-        exceptionState.throwDOMException(InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "This SourceBuffer has been removed from the parent media source.");
         return;
     }
     if (!m_source->isOpen()) {
-        exceptionState.throwDOMException(InvalidStateError, "The parent media source's readyState is not 'open'.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The parent media source's readyState is not 'open'.");
         return;
     }
 
@@ -357,13 +357,13 @@
     // 2. If start is negative or greater than duration, then throw an InvalidAccessError exception and abort these steps.
 
     if (start < 0 || (m_source && (std::isnan(m_source->duration()) || start > m_source->duration()))) {
-        exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexOutsideRange("start", start, 0.0, ExceptionMessages::ExclusiveBound, !m_source || std::isnan(m_source->duration()) ? 0 : m_source->duration(), ExceptionMessages::ExclusiveBound));
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMessages::indexOutsideRange("start", start, 0.0, ExceptionMessages::ExclusiveBound, !m_source || std::isnan(m_source->duration()) ? 0 : m_source->duration(), ExceptionMessages::ExclusiveBound));
         return;
     }
 
     // 3. If end is less than or equal to start or end equals NaN, then throw an InvalidAccessError exception and abort these steps.
     if (end <= start || std::isnan(end)) {
-        exceptionState.throwDOMException(InvalidAccessError, "The end value provided (" + String::number(end) + ") must be greater than the start value provided (" + String::number(start) + ").");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, "The end value provided (" + String::number(end) + ") must be greater than the start value provided (" + String::number(start) + ").");
         return;
     }
 
@@ -556,7 +556,7 @@
     ASSERT(m_source);
     ASSERT(m_source->mediaElement());
     if (m_source->mediaElement()->error()) {
-        exceptionState.throwDOMException(InvalidStateError, "The HTMLMediaElement.error attribute is not null.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The HTMLMediaElement.error attribute is not null.");
         TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::prepareAppend", this);
         return false;
     }
@@ -570,7 +570,7 @@
     if (!evictCodedFrames(newDataSize)) {
         // 6. If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ERR exception and abort these steps.
         WTF_LOG(Media, "SourceBuffer::prepareAppend %p -> throw QuotaExceededError", this);
-        exceptionState.throwDOMException(QuotaExceededError, "The SourceBuffer is full, and cannot free space to append additional buffers.");
+        MediaSource::logAndThrowDOMException(exceptionState, QuotaExceededError, "The SourceBuffer is full, and cannot free space to append additional buffers.");
         TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::prepareAppend", this);
         return false;
     }
@@ -705,7 +705,7 @@
     // http://w3c.github.io/media-source/#widl-SourceBuffer-appendStream-void-ReadableStream-stream-unsigned-long-long-maxSize
     // (0. If the stream has been neutered, then throw an InvalidAccessError exception and abort these steps.)
     if (stream->isNeutered()) {
-        exceptionState.throwDOMException(InvalidAccessError, "The stream provided has been neutered.");
+        MediaSource::logAndThrowDOMException(exceptionState, InvalidAccessError, "The stream provided has been neutered.");
         TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this);
         return;
     }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
index af55920..0f69d0e 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
@@ -594,21 +594,9 @@
 
                     // Curve events have duration, so don't just use next event time.
                     double duration = event.duration();
-                    double durationFrames = duration * sampleRate;
-                    // How much to step the curve index for each frame.  We want the curve index to
-                    // be exactly equal to the last index (numberOfCurvePoints - 1) after
-                    // durationFrames - 1 frames.  In this way, the last output value will equal the
-                    // last value in the curve array.
-                    double curvePointsPerFrame;
-
-                    // If the duration is less than a frame, we want to just output the last curve
-                    // value.  Do this by setting curvePointsPerFrame to be more than number of
-                    // points in the curve.  Then the curveVirtualIndex will always exceed the last
-                    // curve index, so that the last curve value will be used.
-                    if (durationFrames > 1)
-                        curvePointsPerFrame = (numberOfCurvePoints - 1) / (durationFrames - 1);
-                    else
-                        curvePointsPerFrame = numberOfCurvePoints + 1;
+                    // How much to step the curve index for each frame.  This is basically the term
+                    // (N - 1)/Td in the specification.
+                    double curvePointsPerFrame = (numberOfCurvePoints - 1) / duration / sampleRate;
 
                     if (!curve || !curveData || !numberOfCurvePoints || duration <= 0 || sampleRate <= 0) {
                         // Error condition - simply propagate previous value.
diff --git a/third_party/WebKit/Source/platform/audio/Biquad.cpp b/third_party/WebKit/Source/platform/audio/Biquad.cpp
index e614c7c..ae19ebc 100644
--- a/third_party/WebKit/Source/platform/audio/Biquad.cpp
+++ b/third_party/WebKit/Source/platform/audio/Biquad.cpp
@@ -524,27 +524,6 @@
     }
 }
 
-void Biquad::setZeroPolePairs(const std::complex<double>&zero, const std::complex<double>&pole)
-{
-    double b0 = 1;
-    double b1 = -2 * zero.real();
-
-    double zeroMag = abs(zero);
-    double b2 = zeroMag * zeroMag;
-
-    double a1 = -2 * pole.real();
-
-    double poleMag = abs(pole);
-    double a2 = poleMag * poleMag;
-    setNormalizedCoefficients(b0, b1, b2, 1, a1, a2);
-}
-
-void Biquad::setAllpassPole(const std::complex<double>&pole)
-{
-    std::complex<double> zero = std::complex<double>(1, 0) / pole;
-    setZeroPolePairs(zero, pole);
-}
-
 void Biquad::getFrequencyResponse(int nFrequencies,
                                   const float* frequency,
                                   float* magResponse,
diff --git a/third_party/WebKit/Source/platform/audio/Biquad.h b/third_party/WebKit/Source/platform/audio/Biquad.h
index 25f1895..8e59104 100644
--- a/third_party/WebKit/Source/platform/audio/Biquad.h
+++ b/third_party/WebKit/Source/platform/audio/Biquad.h
@@ -63,14 +63,6 @@
     void setAllpassParams(double frequency, double Q);
     void setNotchParams(double frequency, double Q);
 
-    // Set the biquad coefficients given a single zero (other zero will be conjugate)
-    // and a single pole (other pole will be conjugate)
-    void setZeroPolePairs(const std::complex<double>& zero, const std::complex<double>& pole);
-
-    // Set the biquad coefficients given a single pole (other pole will be conjugate)
-    // (The zeroes will be the inverse of the poles)
-    void setAllpassPole(const std::complex<double>&);
-
     // Resets filter state
     void reset();
 
diff --git a/third_party/WebKit/Source/web/WebDocument.cpp b/third_party/WebKit/Source/web/WebDocument.cpp
index bd7f10d0..a87588d 100644
--- a/third_party/WebKit/Source/web/WebDocument.cpp
+++ b/third_party/WebKit/Source/web/WebDocument.cpp
@@ -38,6 +38,7 @@
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/CSSSelectorWatch.h"
 #include "core/dom/Document.h"
+#include "core/dom/DocumentStatisticsCollector.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
 #include "core/dom/Fullscreen.h"
@@ -56,6 +57,7 @@
 #include "modules/accessibility/AXObject.h"
 #include "modules/accessibility/AXObjectCacheImpl.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/WebDistillability.h"
 #include "public/platform/WebURL.h"
 #include "public/web/WebAXObject.h"
 #include "public/web/WebDOMEvent.h"
@@ -321,6 +323,11 @@
     return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossoriginAttr), "use-credentials");
 }
 
+WebDistillabilityFeatures WebDocument::distillabilityFeatures()
+{
+    return DocumentStatisticsCollector::collectStatistics(*unwrap<Document>());
+}
+
 WebDocument::WebDocument(const PassRefPtrWillBeRawPtr<Document>& elem)
     : WebNode(elem)
 {
diff --git a/third_party/WebKit/public/platform/WebDistillability.h b/third_party/WebKit/public/platform/WebDistillability.h
new file mode 100644
index 0000000..51d348f8
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebDistillability.h
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebDistillability_h
+#define WebDistillability_h
+
+namespace blink {
+
+struct WebDistillabilityFeatures {
+    bool isMobileFriendly;
+    // The rest of the fields are only valid when isMobileFriendly==false.
+    bool openGraph;
+    unsigned elementCount;
+    unsigned anchorCount;
+    unsigned formCount;
+    unsigned textInputCount;
+    unsigned passwordInputCount;
+    unsigned pCount;
+    unsigned preCount;
+    // The following scores are derived from the triggering logic in Readability from Mozilla.
+    // https://github.com/mozilla/readability/blob/85101066386a0872526a6c4ae164c18fcd6cc1db/Readability.js#L1704
+    double mozScore;
+    double mozScoreAllSqrt;
+    double mozScoreAllLinear;
+};
+
+} // namespace blink
+
+#endif // WebDistillability_h
diff --git a/third_party/WebKit/public/web/WebDocument.h b/third_party/WebKit/public/web/WebDocument.h
index 8b415834..e22107f 100644
--- a/third_party/WebKit/public/web/WebDocument.h
+++ b/third_party/WebKit/public/web/WebDocument.h
@@ -59,6 +59,7 @@
 class WebElementCollection;
 class WebString;
 class WebURL;
+struct WebDistillabilityFeatures;
 
 // Provides readonly access to some properties of a DOM document.
 class WebDocument : public WebNode {
@@ -136,6 +137,7 @@
 
     BLINK_EXPORT WebURL manifestURL() const;
     BLINK_EXPORT bool manifestUseCredentials() const;
+    BLINK_EXPORT WebDistillabilityFeatures distillabilityFeatures();
 
 #if BLINK_IMPLEMENTATION
     WebDocument(const PassRefPtrWillBeRawPtr<Document>&);
diff --git a/third_party/libvpx_new/README.chromium b/third_party/libvpx_new/README.chromium
index 70b04b59..a51545d 100644
--- a/third_party/libvpx_new/README.chromium
+++ b/third_party/libvpx_new/README.chromium
@@ -5,9 +5,9 @@
 License File: source/libvpx/LICENSE
 Security Critical: yes
 
-Date: Friday November 6 2015
+Date: Wednesday November 11 2015
 Branch: master
-Commit: eba14ddbe7e7b69803dab770ba25ae2ba75c65e2
+Commit: 9ecb99abf094bf73a74468b100f3a139a4e372dc
 
 Description:
 Contains the sources used to compile libvpx binaries used by Google Chrome and
diff --git a/third_party/libvpx_new/source/config/vpx_version.h b/third_party/libvpx_new/source/config/vpx_version.h
index 7b83a66..63e8126 100644
--- a/third_party/libvpx_new/source/config/vpx_version.h
+++ b/third_party/libvpx_new/source/config/vpx_version.h
@@ -1,7 +1,7 @@
 #define VERSION_MAJOR  1
-#define VERSION_MINOR  4
+#define VERSION_MINOR  5
 #define VERSION_PATCH  0
-#define VERSION_EXTRA  "1655-geba14dd"
+#define VERSION_EXTRA  "91-g9ecb99a"
 #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.4.0-1655-geba14dd"
-#define VERSION_STRING      " v1.4.0-1655-geba14dd"
+#define VERSION_STRING_NOSP "v1.5.0-91-g9ecb99a"
+#define VERSION_STRING      " v1.5.0-91-g9ecb99a"
diff --git a/third_party/mojo/mojo_edk.gyp b/third_party/mojo/mojo_edk.gyp
index 71da5ba3..5f17552 100644
--- a/third_party/mojo/mojo_edk.gyp
+++ b/third_party/mojo/mojo_edk.gyp
@@ -14,13 +14,7 @@
       # latter includes mojo/edk/system/memory.h, the header from third_party
       # would incorrectly get chosen).
       '../..',
-      'src',
     ],
-    'direct_dependent_settings': {
-      'include_dirs': [
-        'src',
-      ],
-    },
   },
   'targets': [
     {
diff --git a/third_party/mojo/mojo_public.gyp b/third_party/mojo/mojo_public.gyp
index eaf0cb2..5d4b473 100644
--- a/third_party/mojo/mojo_public.gyp
+++ b/third_party/mojo/mojo_public.gyp
@@ -8,13 +8,8 @@
   ],
   'target_defaults' : {
     'include_dirs': [
-      'src',
+      '../..',
     ],
-    'direct_dependent_settings': {
-      'include_dirs': [
-        'src',
-      ],
-    },
   },
   'targets': [
     {
diff --git a/third_party/mojo/mojom_bindings_generator.gypi b/third_party/mojo/mojom_bindings_generator.gypi
index a39be933fc..c9bb77c 100644
--- a/third_party/mojo/mojom_bindings_generator.gypi
+++ b/third_party/mojo/mojom_bindings_generator.gypi
@@ -34,7 +34,6 @@
         'java_out_dir': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src',
         'mojom_import_args%': [
          '-I<(DEPTH)',
-         '-I<(DEPTH)/third_party/mojo/src'
         ],
         'stamp_filename': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/<(_target_name).stamp',
       },
@@ -66,16 +65,12 @@
   ],
   'include_dirs': [
     '<(DEPTH)',
-    '<(DEPTH)/third_party/mojo/src',
     '<(SHARED_INTERMEDIATE_DIR)',
-    '<(SHARED_INTERMEDIATE_DIR)/third_party/mojo/src',
   ],
   'direct_dependent_settings': {
     'include_dirs': [
       '<(DEPTH)',
-      '<(DEPTH)/third_party/mojo/src',
       '<(SHARED_INTERMEDIATE_DIR)',
-      '<(SHARED_INTERMEDIATE_DIR)/third_party/mojo/src',
     ],
     'variables': {
       'generated_src_dirs': [
diff --git a/third_party/mojo/mojom_bindings_generator_explicit.gypi b/third_party/mojo/mojom_bindings_generator_explicit.gypi
index 8df48aa5..4eec082 100644
--- a/third_party/mojo/mojom_bindings_generator_explicit.gypi
+++ b/third_party/mojo/mojom_bindings_generator_explicit.gypi
@@ -44,7 +44,6 @@
         'mojom_import_args%': [
          '-I<(DEPTH)',
          '-I<(DEPTH)/mojo/services',
-         '-I<(DEPTH)/third_party/mojo/src',
          '-I<(mojom_include_path)',
         ],
       },
@@ -90,9 +89,7 @@
     # Include paths needed to compile the generated sources into a library.
     'include_dirs': [
       '<(DEPTH)',
-      '<(DEPTH)/third_party/mojo/src',
       '<(SHARED_INTERMEDIATE_DIR)',
-      '<(SHARED_INTERMEDIATE_DIR)/third_party/mojo/src',
     ],
     # Make sure the generated header files are available for any static library
     # that depends on a static library that depends on this generator.
@@ -102,9 +99,7 @@
       # transitive dependancies when using the library.
       'include_dirs': [
         '<(DEPTH)',
-        '<(DEPTH)/third_party/mojo/src',
         '<(SHARED_INTERMEDIATE_DIR)',
-        '<(SHARED_INTERMEDIATE_DIR)/third_party/mojo/src',
       ],
       'variables': {
         'generated_src_dirs': [
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder.h b/third_party/mojo/src/mojo/edk/embedder/embedder.h
index 92b88965..758a905 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder.h
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder.h
@@ -11,12 +11,12 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/task_runner.h"
-#include "mojo/public/cpp/system/message_pipe.h"
 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_type.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_info.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
index 7e7c5f4..5ceff847 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
@@ -14,10 +14,6 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_io_thread.h"
 #include "base/test/test_timeouts.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
@@ -25,6 +21,10 @@
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h"
 #include "third_party/mojo/src/mojo/edk/test/scoped_ipc_support.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc b/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
index 22982ec5a..bc53093 100644
--- a/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "../../../../../../mojo/edk/embedder/embedder_internal.h"
+#include "../../../../../../mojo/edk/system/core.h"
 #include "base/command_line.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/message_pipe.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
 #include "third_party/mojo/src/mojo/edk/system/core.h"
-#include "../../../../../../mojo/edk/system/core.h"
-#include "../../../../../../mojo/edk/embedder/embedder_internal.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
 
 using mojo::embedder::internal::g_core;
 using mojo::system::MakeUserPointer;
diff --git a/third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h b/third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h
index beb59c8..9696b40 100644
--- a/third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h
+++ b/third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h
@@ -5,10 +5,10 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_MASTER_PROCESS_DELEGATE_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_MASTER_PROCESS_DELEGATE_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_info.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h b/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h
index fa32226..13c85f08 100644
--- a/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h
+++ b/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h
@@ -8,9 +8,9 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/process/launch.h"
 #include "build/build_config.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class CommandLine;
diff --git a/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc b/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
index 4927b4b8..c41bc43 100644
--- a/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
@@ -18,13 +18,13 @@
 #include "base/files/scoped_file.h"
 #include "base/logging.h"
 #include "build/build_config.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_utils_posix.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #if defined(OS_ANDROID)
 #include "base/android/path_utils.h"
diff --git a/third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h b/third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h
index da22cf5..c17af09b 100644
--- a/third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h
+++ b/third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h
@@ -9,9 +9,9 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/platform_support.h b/third_party/mojo/src/mojo/edk/embedder/platform_support.h
index fb8259b..fe99afa 100644
--- a/third_party/mojo/src/mojo/edk/embedder/platform_support.h
+++ b/third_party/mojo/src/mojo/edk/embedder/platform_support.h
@@ -7,9 +7,9 @@
 
 #include <stddef.h>
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/process_delegate.h b/third_party/mojo/src/mojo/edk/embedder/process_delegate.h
index e00591f..d782907 100644
--- a/third_party/mojo/src/mojo/edk/embedder/process_delegate.h
+++ b/third_party/mojo/src/mojo/edk/embedder/process_delegate.h
@@ -5,9 +5,9 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_type.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h b/third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h
index ed5ce61..b7e3141 100644
--- a/third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h
+++ b/third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h
@@ -6,9 +6,9 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
 
 #include "base/move.h"
-#include "mojo/public/c/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h b/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h
index 90b8dd1..3082472 100644
--- a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h
+++ b/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h
@@ -7,9 +7,9 @@
 
 #include <stddef.h>
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc b/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
index 8fc1cf41..88b0827b 100644
--- a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -8,8 +8,8 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h b/third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h
index 8974d2d..c9ec3b5 100644
--- a/third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h
+++ b/third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h
@@ -5,9 +5,9 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h b/third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h
index d8fd442..f14fa42b 100644
--- a/third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h
+++ b/third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h
@@ -5,9 +5,9 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_SLAVE_PROCESS_DELEGATE_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_EMBEDDER_SLAVE_PROCESS_DELEGATE_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace embedder {
diff --git a/third_party/mojo/src/mojo/edk/js/drain_data.cc b/third_party/mojo/src/mojo/edk/js/drain_data.cc
index 407c5d2..139d768f 100644
--- a/third_party/mojo/src/mojo/edk/js/drain_data.cc
+++ b/third_party/mojo/src/mojo/edk/js/drain_data.cc
@@ -9,8 +9,8 @@
 #include "gin/dictionary.h"
 #include "gin/per_context_data.h"
 #include "gin/per_isolate_data.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/drain_data.h b/third_party/mojo/src/mojo/edk/js/drain_data.h
index 9767f2dd..4d9f33a 100644
--- a/third_party/mojo/src/mojo/edk/js/drain_data.h
+++ b/third_party/mojo/src/mojo/edk/js/drain_data.h
@@ -7,8 +7,8 @@
 
 #include "base/memory/scoped_vector.h"
 #include "gin/runner.h"
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 #include "v8/include/v8.h"
 
 namespace mojo {
diff --git a/third_party/mojo/src/mojo/edk/js/handle.h b/third_party/mojo/src/mojo/edk/js/handle.h
index 00f258f..1b477fbb 100644
--- a/third_party/mojo/src/mojo/edk/js/handle.h
+++ b/third_party/mojo/src/mojo/edk/js/handle.h
@@ -9,7 +9,7 @@
 #include "gin/converter.h"
 #include "gin/handle.h"
 #include "gin/wrappable.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/handle_unittest.cc b/third_party/mojo/src/mojo/edk/js/handle_unittest.cc
index 7a10d615..349f842 100644
--- a/third_party/mojo/src/mojo/edk/js/handle_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/js/handle_unittest.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "base/macros.h"
-#include "mojo/public/cpp/system/core.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/js/handle.h"
 #include "third_party/mojo/src/mojo/edk/js/handle_close_observer.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/mojo_runner_delegate.h b/third_party/mojo/src/mojo/edk/js/mojo_runner_delegate.h
index 2890a10..9e5b57bd 100644
--- a/third_party/mojo/src/mojo/edk/js/mojo_runner_delegate.h
+++ b/third_party/mojo/src/mojo/edk/js/mojo_runner_delegate.h
@@ -7,7 +7,7 @@
 
 #include "base/macros.h"
 #include "gin/modules/module_runner_delegate.h"
-#include "mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/support.cc b/third_party/mojo/src/mojo/edk/js/support.cc
index e739eeb..401c5a2 100644
--- a/third_party/mojo/src/mojo/edk/js/support.cc
+++ b/third_party/mojo/src/mojo/edk/js/support.cc
@@ -12,9 +12,9 @@
 #include "gin/per_isolate_data.h"
 #include "gin/public/wrapper_info.h"
 #include "gin/wrappable.h"
-#include "mojo/public/cpp/system/core.h"
 #include "third_party/mojo/src/mojo/edk/js/handle.h"
 #include "third_party/mojo/src/mojo/edk/js/waiting_callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/test/run_js_tests.cc b/third_party/mojo/src/mojo/edk/js/test/run_js_tests.cc
index 3fab0ef2..7d111fa 100644
--- a/third_party/mojo/src/mojo/edk/js/test/run_js_tests.cc
+++ b/third_party/mojo/src/mojo/edk/js/test/run_js_tests.cc
@@ -8,10 +8,10 @@
 #include "gin/modules/module_registry.h"
 #include "gin/test/file_runner.h"
 #include "gin/test/gtest.h"
-#include "mojo/public/cpp/environment/environment.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/js/core.h"
 #include "third_party/mojo/src/mojo/edk/js/support.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/tests/js_to_cpp_tests.cc b/third_party/mojo/src/mojo/edk/js/tests/js_to_cpp_tests.cc
index 459e8a2..a709f00 100644
--- a/third_party/mojo/src/mojo/edk/js/tests/js_to_cpp_tests.cc
+++ b/third_party/mojo/src/mojo/edk/js/tests/js_to_cpp_tests.cc
@@ -11,13 +11,13 @@
 #include "base/strings/utf_string_conversions.h"
 #include "gin/array_buffer.h"
 #include "gin/public/isolate_holder.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/js/mojo_runner_delegate.h"
 #include "third_party/mojo/src/mojo/edk/js/tests/js_to_cpp.mojom.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/waiting_callback.cc b/third_party/mojo/src/mojo/edk/js/waiting_callback.cc
index 65833f3..2bd2af5 100644
--- a/third_party/mojo/src/mojo/edk/js/waiting_callback.cc
+++ b/third_party/mojo/src/mojo/edk/js/waiting_callback.cc
@@ -7,7 +7,7 @@
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
 #include "gin/per_context_data.h"
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/js/waiting_callback.h b/third_party/mojo/src/mojo/edk/js/waiting_callback.h
index 63f4d0ca..4014710 100644
--- a/third_party/mojo/src/mojo/edk/js/waiting_callback.h
+++ b/third_party/mojo/src/mojo/edk/js/waiting_callback.h
@@ -9,10 +9,10 @@
 #include "gin/handle.h"
 #include "gin/runner.h"
 #include "gin/wrappable.h"
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/system/core.h"
 #include "third_party/mojo/src/mojo/edk/js/handle.h"
 #include "third_party/mojo/src/mojo/edk/js/handle_close_observer.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace js {
diff --git a/third_party/mojo/src/mojo/edk/system/async_waiter.h b/third_party/mojo/src/mojo/edk/system/async_waiter.h
index 3dd96ac4..1c89466 100644
--- a/third_party/mojo/src/mojo/edk/system/async_waiter.h
+++ b/third_party/mojo/src/mojo/edk/system/async_waiter.h
@@ -6,10 +6,10 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
 
 #include "base/callback.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/awakable.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/awakable.h b/third_party/mojo/src/mojo/edk/system/awakable.h
index ae1376c9d..7a2da125 100644
--- a/third_party/mojo/src/mojo/edk/system/awakable.h
+++ b/third_party/mojo/src/mojo/edk/system/awakable.h
@@ -7,8 +7,8 @@
 
 #include <stdint.h>
 
-#include "mojo/public/c/system/types.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/awakable_list.cc b/third_party/mojo/src/mojo/edk/system/awakable_list.cc
index 0ce3deb5..f20e88a 100644
--- a/third_party/mojo/src/mojo/edk/system/awakable_list.cc
+++ b/third_party/mojo/src/mojo/edk/system/awakable_list.cc
@@ -51,7 +51,7 @@
 
 void AwakableList::Add(Awakable* awakable,
                        MojoHandleSignals signals,
-                       uint32_t context) {
+                       uintptr_t context) {
   awakables_.push_back(AwakeInfo(awakable, signals, context));
 }
 
diff --git a/third_party/mojo/src/mojo/edk/system/awakable_list.h b/third_party/mojo/src/mojo/edk/system/awakable_list.h
index 56dc5ae4..4768efe 100644
--- a/third_party/mojo/src/mojo/edk/system/awakable_list.h
+++ b/third_party/mojo/src/mojo/edk/system/awakable_list.h
@@ -9,9 +9,9 @@
 
 #include <vector>
 
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -33,17 +33,17 @@
 
   void AwakeForStateChange(const HandleSignalsState& state);
   void CancelAll();
-  void Add(Awakable* awakable, MojoHandleSignals signals, uint32_t context);
+  void Add(Awakable* awakable, MojoHandleSignals signals, uintptr_t context);
   void Remove(Awakable* awakable);
 
  private:
   struct AwakeInfo {
-    AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint32_t context)
+    AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uintptr_t context)
         : awakable(awakable), signals(signals), context(context) {}
 
     Awakable* awakable;
     MojoHandleSignals signals;
-    uint32_t context;
+    uintptr_t context;
   };
   using AwakeInfoList = std::vector<AwakeInfo>;
 
diff --git a/third_party/mojo/src/mojo/edk/system/awakable_list_unittest.cc b/third_party/mojo/src/mojo/edk/system/awakable_list_unittest.cc
index 8b99d671..9255fa9 100644
--- a/third_party/mojo/src/mojo/edk/system/awakable_list_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/awakable_list_unittest.cc
@@ -21,7 +21,7 @@
 
 TEST(AwakableListTest, BasicCancel) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Cancel immediately after thread start.
   {
@@ -62,7 +62,7 @@
 
 TEST(AwakableListTest, BasicAwakeSatisfied) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Awake immediately after thread start.
   {
@@ -112,7 +112,7 @@
 
 TEST(AwakableListTest, BasicAwakeUnsatisfiable) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Awake (for unsatisfiability) immediately after thread start.
   {
@@ -162,10 +162,10 @@
   MojoResult result2;
   MojoResult result3;
   MojoResult result4;
-  uint32_t context1;
-  uint32_t context2;
-  uint32_t context3;
-  uint32_t context4;
+  uintptr_t context1;
+  uintptr_t context2;
+  uintptr_t context3;
+  uintptr_t context4;
 
   // Cancel two awakables.
   {
diff --git a/third_party/mojo/src/mojo/edk/system/channel.h b/third_party/mojo/src/mojo/edk/system/channel.h
index 9feda95..0ad5036 100644
--- a/third_party/mojo/src/mojo/edk/system/channel.h
+++ b/third_party/mojo/src/mojo/edk/system/channel.h
@@ -13,8 +13,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h"
@@ -23,6 +21,8 @@
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc b/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
index e330b38..0cc3d56 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
@@ -6,9 +6,9 @@
 
 #include "base/logging.h"
 #include "base/threading/platform_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
index 6f5e06d..2764bc3 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
@@ -7,11 +7,11 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h b/third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h
index d250b28..58ce596c 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h
@@ -7,8 +7,8 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h b/third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h
index 6d767aa2..c9d89082 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h
@@ -12,8 +12,8 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/gtest_prod_util.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint_unittest.cc b/third_party/mojo/src/mojo/edk/system/channel_endpoint_unittest.cc
index 659b9b7..fb31dc3 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint_unittest.cc
@@ -6,11 +6,11 @@
 
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_timeouts.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_test_base.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager.h b/third_party/mojo/src/mojo/edk/system/channel_manager.h
index 360996f7..12590436 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager.h
@@ -11,10 +11,10 @@
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_id.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class TaskRunner;
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc b/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
index d1d018f..bf648a4 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
@@ -10,13 +10,13 @@
 #include "base/task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/simple_thread.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/channel_test_base.h b/third_party/mojo/src/mojo/edk/system/channel_test_base.h
index 47d84e02f..754c3f8 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_test_base.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_test_base.h
@@ -10,10 +10,10 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/test/test_io_thread.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager.h b/third_party/mojo/src/mojo/edk/system/connection_manager.h
index 7e569d95f..85fb1ef 100644
--- a/third_party/mojo/src/mojo/edk/system/connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/connection_manager.h
@@ -7,11 +7,11 @@
 
 #include <ostream>
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/connection_identifier.h"
 #include "third_party/mojo/src/mojo/edk/system/process_identifier.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
 #include "third_party/mojo/src/mojo/edk/system/thread_annotations.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc b/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
index fe5fdca..f3068998 100644
--- a/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
@@ -14,7 +14,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/threading/thread_checker.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
@@ -22,7 +22,7 @@
 #include "third_party/mojo/src/mojo/edk/system/master_connection_manager.h"
 #include "third_party/mojo/src/mojo/edk/system/slave_connection_manager.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/core.cc b/third_party/mojo/src/mojo/edk/system/core.cc
index 51fdfcbf..64e2f82 100644
--- a/third_party/mojo/src/mojo/edk/system/core.cc
+++ b/third_party/mojo/src/mojo/edk/system/core.cc
@@ -8,8 +8,6 @@
 
 #include "base/logging.h"
 #include "base/time/time.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/async_waiter.h"
@@ -24,6 +22,8 @@
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -585,10 +585,13 @@
   }
   uint32_t num_added = i;
 
-  if (rv == MOJO_RESULT_ALREADY_EXISTS)
+  if (rv == MOJO_RESULT_ALREADY_EXISTS) {
     rv = MOJO_RESULT_OK;  // The i-th one is already "triggered".
-  else if (rv == MOJO_RESULT_OK)
-    rv = waiter.Wait(deadline, result_index);
+  } else if (rv == MOJO_RESULT_OK) {
+    uintptr_t uintptr_result = *result_index;
+    rv = waiter.Wait(deadline, &uintptr_result);
+    *result_index = static_cast<uint32_t>(uintptr_result);
+  }
 
   // Make sure no other dispatchers try to wake |waiter| for the current
   // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
diff --git a/third_party/mojo/src/mojo/edk/system/core.h b/third_party/mojo/src/mojo/edk/system/core.h
index 2dc504b..7a1ca9f 100644
--- a/third_party/mojo/src/mojo/edk/system/core.h
+++ b/third_party/mojo/src/mojo/edk/system/core.h
@@ -10,16 +10,16 @@
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_table.h"
 #include "third_party/mojo/src/mojo/edk/system/mapping_table.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -73,7 +73,7 @@
   // API functions, referenced below.
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/functions.h":
+  // "third_party/mojo/src/mojo/public/c/system/functions.h":
   MojoTimeTicks GetTimeTicksNow();
   MojoResult Close(MojoHandle handle);
   MojoResult Wait(MojoHandle handle,
@@ -88,7 +88,7 @@
                       UserPointer<MojoHandleSignalsState> signals_states);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/message_pipe.h":
+  // "third_party/mojo/src/mojo/public/c/system/message_pipe.h":
   MojoResult CreateMessagePipe(
       UserPointer<const MojoCreateMessagePipeOptions> options,
       UserPointer<MojoHandle> message_pipe_handle0,
@@ -107,7 +107,7 @@
                          MojoReadMessageFlags flags);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/data_pipe.h":
+  // "third_party/mojo/src/mojo/public/c/system/data_pipe.h":
   MojoResult CreateDataPipe(
       UserPointer<const MojoCreateDataPipeOptions> options,
       UserPointer<MojoHandle> data_pipe_producer_handle,
@@ -134,7 +134,7 @@
                          uint32_t num_bytes_read);
 
   // These methods correspond to the API functions defined in
-  // "mojo/public/c/system/buffer.h":
+  // "third_party/mojo/src/mojo/public/c/system/buffer.h":
   MojoResult CreateSharedBuffer(
       UserPointer<const MojoCreateSharedBufferOptions> options,
       uint64_t num_bytes,
diff --git a/third_party/mojo/src/mojo/edk/system/core_test_base.cc b/third_party/mojo/src/mojo/edk/system/core_test_base.cc
index abe64b5..8d2bcc8c 100644
--- a/third_party/mojo/src/mojo/edk/system/core_test_base.cc
+++ b/third_party/mojo/src/mojo/edk/system/core_test_base.cc
@@ -8,11 +8,11 @@
 
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/configuration.h"
 #include "third_party/mojo/src/mojo/edk/system/core.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -129,7 +129,7 @@
 
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals /*signals*/,
-                                   uint32_t /*context*/,
+                                   uintptr_t /*context*/,
                                    HandleSignalsState* signals_state) override {
     info_->IncrementAddAwakableCallCount();
     mutex().AssertHeld();
diff --git a/third_party/mojo/src/mojo/edk/system/core_test_base.h b/third_party/mojo/src/mojo/edk/system/core_test_base.h
index 5798cb6d..6f6f6b76 100644
--- a/third_party/mojo/src/mojo/edk/system/core_test_base.h
+++ b/third_party/mojo/src/mojo/edk/system/core_test_base.h
@@ -5,11 +5,11 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_
 
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/core_unittest.cc b/third_party/mojo/src/mojo/edk/system/core_unittest.cc
index 979cfbd..786eb52 100644
--- a/third_party/mojo/src/mojo/edk/system/core_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/core_unittest.cc
@@ -9,10 +9,10 @@
 #include <limits>
 
 #include "base/bind.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/awakable.h"
 #include "third_party/mojo/src/mojo/edk/system/core_test_base.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe.h b/third_party/mojo/src/mojo/edk/system/data_pipe.h
index b49ab40..e43d27a 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe.h
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe.h
@@ -10,14 +10,14 @@
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_signals_state.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.cc
index 7d8172e..c31e462 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -130,7 +130,7 @@
 MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   mutex().AssertHeld();
   return data_pipe_->ConsumerAddAwakable(awakable, signals, context,
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.h b/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.h
index 9fc7cfc3..6ce5c2f 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -6,9 +6,9 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -58,7 +58,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
index 067feee9..90494609 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
@@ -7,14 +7,14 @@
 
 #include <stdint.h>
 
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/c/system/types.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/data_pipe.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_signals_state.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_impl_unittest.cc b/third_party/mojo/src/mojo/edk/system/data_pipe_impl_unittest.cc
index 4dcd2d70..63a5bd1 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_impl_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_impl_unittest.cc
@@ -15,7 +15,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/test/test_io_thread.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
@@ -28,7 +28,7 @@
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -131,7 +131,7 @@
   }
   MojoResult ProducerAddAwakable(Awakable* awakable,
                                  MojoHandleSignals signals,
-                                 uint32_t context,
+                                 uintptr_t context,
                                  HandleSignalsState* signals_state) {
     return dpp()->ProducerAddAwakable(awakable, signals, context,
                                       signals_state);
@@ -164,7 +164,7 @@
   }
   MojoResult ConsumerAddAwakable(Awakable* awakable,
                                  MojoHandleSignals signals,
-                                 uint32_t context,
+                                 uintptr_t context,
                                  HandleSignalsState* signals_state) {
     return dpc()->ConsumerAddAwakable(awakable, signals, context,
                                       signals_state);
@@ -275,7 +275,7 @@
                                     MOJO_WRITE_MESSAGE_FLAG_NONE));
       transport.End();
     }
-    uint32_t context = 0;
+    uintptr_t context = 0;
     ASSERT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
     EXPECT_EQ(987u, context);
     HandleSignalsState hss = HandleSignalsState();
@@ -604,7 +604,7 @@
 
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   int32_t elements[10] = {};
   uint32_t num_bytes = 0u;
@@ -756,7 +756,7 @@
   Waiter pwaiter;  // For producer.
   Waiter cwaiter;  // For consumer.
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   // Never readable.
   pwaiter.Init();
@@ -949,7 +949,7 @@
 
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   // Add a waiter.
   waiter.Init();
@@ -984,7 +984,7 @@
 
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   // Add a waiter.
   waiter.Init();
@@ -1020,7 +1020,7 @@
   Waiter waiter;
   Waiter waiter2;
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   // Never writable.
   waiter.Init();
@@ -1197,7 +1197,7 @@
 
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context;
+  uintptr_t context;
 
   // Add waiter: not yet readable.
   waiter.Init();
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.cc b/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 67d6ed3a..0495c979 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -103,7 +103,7 @@
 MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   mutex().AssertHeld();
   return data_pipe_->ProducerAddAwakable(awakable, signals, context,
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.h b/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.h
index aca9cb8..08767baa 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_producer_dispatcher.h
@@ -6,9 +6,9 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_DATA_PIPE_PRODUCER_DISPATCHER_H_
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -58,7 +58,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_unittest.cc b/third_party/mojo/src/mojo/edk/system/data_pipe_unittest.cc
index 4edc312..4ea35da 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_unittest.cc
@@ -9,9 +9,9 @@
 
 #include <limits>
 
-#include "mojo/public/cpp/system/macros.h"
-#include "third_party/mojo/src/mojo/edk/system/configuration.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/edk/system/configuration.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/dispatcher.cc b/third_party/mojo/src/mojo/edk/system/dispatcher.cc
index b4487579..2c114072 100644
--- a/third_party/mojo/src/mojo/edk/system/dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/dispatcher.cc
@@ -226,7 +226,7 @@
 
 MojoResult Dispatcher::AddAwakable(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) {
   MutexLocker locker(&mutex_);
   if (is_closed_) {
@@ -378,7 +378,7 @@
 MojoResult Dispatcher::AddAwakableImplNoLock(
     Awakable* /*awakable*/,
     MojoHandleSignals /*signals*/,
-    uint32_t /*context*/,
+    uintptr_t /*context*/,
     HandleSignalsState* signals_state) {
   mutex_.AssertHeld();
   DCHECK(!is_closed_);
diff --git a/third_party/mojo/src/mojo/edk/system/dispatcher.h b/third_party/mojo/src/mojo/edk/system/dispatcher.h
index 33c957e..2f11ddc 100644
--- a/third_party/mojo/src/mojo/edk/system/dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/dispatcher.h
@@ -13,16 +13,16 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_signals_state.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -145,7 +145,7 @@
   //    that |signals| will ever be satisfied.
   MojoResult AddAwakable(Awakable* awakable,
                          MojoHandleSignals signals,
-                         uint32_t context,
+                         uintptr_t context,
                          HandleSignalsState* signals_state);
   // Removes an awakable from this dispatcher. (It is valid to call this
   // multiple times for the same |awakable| on the same object, so long as
@@ -278,7 +278,7 @@
       MOJO_SHARED_LOCKS_REQUIRED(mutex_);
   virtual MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                            MojoHandleSignals signals,
-                                           uint32_t context,
+                                           uintptr_t context,
                                            HandleSignalsState* signals_state)
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
   virtual void RemoveAwakableImplNoLock(Awakable* awakable,
diff --git a/third_party/mojo/src/mojo/edk/system/dispatcher_unittest.cc b/third_party/mojo/src/mojo/edk/system/dispatcher_unittest.cc
index a9a413ba..5fb6b3c 100644
--- a/third_party/mojo/src/mojo/edk/system/dispatcher_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/dispatcher_unittest.cc
@@ -8,11 +8,11 @@
 #include "base/memory/scoped_vector.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/simple_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/endpoint_relayer.h b/third_party/mojo/src/mojo/edk/system/endpoint_relayer.h
index acff700..ed789da 100644
--- a/third_party/mojo/src/mojo/edk/system/endpoint_relayer.h
+++ b/third_party/mojo/src/mojo/edk/system/endpoint_relayer.h
@@ -7,10 +7,10 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/endpoint_relayer_unittest.cc b/third_party/mojo/src/mojo/edk/system/endpoint_relayer_unittest.cc
index 29096e1..eb96eec 100644
--- a/third_party/mojo/src/mojo/edk/system/endpoint_relayer_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/endpoint_relayer_unittest.cc
@@ -7,12 +7,12 @@
 #include "base/logging.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_timeouts.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_test_base.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/handle_signals_state.h b/third_party/mojo/src/mojo/edk/system/handle_signals_state.h
index bec6e74..501d9031 100644
--- a/third_party/mojo/src/mojo/edk/system/handle_signals_state.h
+++ b/third_party/mojo/src/mojo/edk/system/handle_signals_state.h
@@ -5,8 +5,8 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
 
-#include "mojo/public/c/system/types.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/handle_table.h b/third_party/mojo/src/mojo/edk/system/handle_table.h
index 65b81eb..d0a5c04 100644
--- a/third_party/mojo/src/mojo/edk/system/handle_table.h
+++ b/third_party/mojo/src/mojo/edk/system/handle_table.h
@@ -10,9 +10,9 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/incoming_endpoint.h b/third_party/mojo/src/mojo/edk/system/incoming_endpoint.h
index 18f76ea..f0c6106 100644
--- a/third_party/mojo/src/mojo/edk/system/incoming_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/incoming_endpoint.h
@@ -8,11 +8,11 @@
 #include <stddef.h>
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 struct MojoCreateDataPipeOptions;
 
diff --git a/third_party/mojo/src/mojo/edk/system/ipc_support.h b/third_party/mojo/src/mojo/edk/system/ipc_support.h
index e0ff29e..02301db 100644
--- a/third_party/mojo/src/mojo/edk/system/ipc_support.h
+++ b/third_party/mojo/src/mojo/edk/system/ipc_support.h
@@ -10,7 +10,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/task_runner.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_type.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_info.h"
@@ -18,6 +17,7 @@
 #include "third_party/mojo/src/mojo/edk/system/connection_identifier.h"
 #include "third_party/mojo/src/mojo/edk/system/process_identifier.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc b/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
index 2d292bf9..6796a854 100644
--- a/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
@@ -15,7 +15,6 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_io_thread.h"
 #include "base/test/test_timeouts.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
@@ -31,6 +30,7 @@
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
 #include "third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
index c144204..0921e77 100644
--- a/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
+++ b/third_party/mojo/src/mojo/edk/system/local_data_pipe_impl.h
@@ -7,9 +7,9 @@
 
 #include "base/memory/aligned_memory.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/data_pipe_impl.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.cc b/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.cc
index dceb33c..ea2a6cf 100644
--- a/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.cc
+++ b/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.cc
@@ -150,7 +150,7 @@
 MojoResult LocalMessagePipeEndpoint::AddAwakable(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   DCHECK(is_open_);
 
diff --git a/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.h b/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.h
index 31d859f..16903e4 100644
--- a/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/local_message_pipe_endpoint.h
@@ -5,12 +5,12 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/awakable_list.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_signals_state.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -41,7 +41,7 @@
   HandleSignalsState GetHandleSignalsState() const override;
   MojoResult AddAwakable(Awakable* awakable,
                          MojoHandleSignals signals,
-                         uint32_t context,
+                         uintptr_t context,
                          HandleSignalsState* signals_state) override;
   void RemoveAwakable(Awakable* awakable,
                       HandleSignalsState* signals_state) override;
diff --git a/third_party/mojo/src/mojo/edk/system/mapping_table.h b/third_party/mojo/src/mojo/edk/system/mapping_table.h
index cc74aca..3c522a0 100644
--- a/third_party/mojo/src/mojo/edk/system/mapping_table.h
+++ b/third_party/mojo/src/mojo/edk/system/mapping_table.h
@@ -11,9 +11,9 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc b/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
index 8223571..5afae484 100644
--- a/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
+++ b/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
@@ -10,7 +10,6 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/synchronization/waitable_event.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
@@ -19,6 +18,7 @@
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
 #include "third_party/mojo/src/mojo/edk/system/transport_data.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/master_connection_manager.h b/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
index 9192bbd..f78165de 100644
--- a/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
@@ -10,11 +10,11 @@
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
 #include "base/threading/thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/connection_manager.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class TaskRunner;
diff --git a/third_party/mojo/src/mojo/edk/system/memory.h b/third_party/mojo/src/mojo/edk/system/memory.h
index 3e9f79aa..b09eb80 100644
--- a/third_party/mojo/src/mojo/edk/system/memory.h
+++ b/third_party/mojo/src/mojo/edk/system/memory.h
@@ -10,9 +10,9 @@
 #include <string.h>  // For |memcpy()|.
 
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/memory_unittest.cc b/third_party/mojo/src/mojo/edk/system/memory_unittest.cc
index 90133e1..8b2e58f 100644
--- a/third_party/mojo/src/mojo/edk/system/memory_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/memory_unittest.cc
@@ -9,8 +9,8 @@
 
 #include <limits>
 
-#include "mojo/public/c/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit.h b/third_party/mojo/src/mojo/edk/system/message_in_transit.h
index 7383d21..87f57dd 100644
--- a/third_party/mojo/src/mojo/edk/system/message_in_transit.h
+++ b/third_party/mojo/src/mojo/edk/system/message_in_transit.h
@@ -13,11 +13,11 @@
 
 #include "base/memory/aligned_memory.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_id.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h b/third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h
index c497341..c9f9733c 100644
--- a/third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h
+++ b/third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h
@@ -8,9 +8,9 @@
 #include <deque>
 
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe.cc b/third_party/mojo/src/mojo/edk/system/message_pipe.cc
index 9ffdc65..21b1040 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe.cc
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe.cc
@@ -184,7 +184,7 @@
 MojoResult MessagePipe::AddAwakable(unsigned port,
                                     Awakable* awakable,
                                     MojoHandleSignals signals,
-                                    uint32_t context,
+                                    uintptr_t context,
                                     HandleSignalsState* signals_state) {
   DCHECK(port == 0 || port == 1);
 
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe.h b/third_party/mojo/src/mojo/edk/system/message_pipe.h
index b74fda74..977e9c7 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe.h
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe.h
@@ -13,9 +13,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
@@ -24,6 +21,9 @@
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -100,7 +100,7 @@
   MojoResult AddAwakable(unsigned port,
                          Awakable* awakable,
                          MojoHandleSignals signals,
-                         uint32_t context,
+                         uintptr_t context,
                          HandleSignalsState* signals_state);
   void RemoveAwakable(unsigned port,
                       Awakable* awakable,
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.cc b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.cc
index 98031d5..3a1d64e0 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.cc
@@ -178,7 +178,7 @@
 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   mutex().AssertHeld();
   return message_pipe_->AddAwakable(port_, awakable, signals, context,
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h
index b64609f..974f546 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h
@@ -6,10 +6,10 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -94,7 +94,7 @@
   HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher_unittest.cc b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher_unittest.cc
index 090e2084..e1e6ba86 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher_unittest.cc
@@ -17,12 +17,12 @@
 #include "base/memory/scoped_vector.h"
 #include "base/rand_util.h"
 #include "base/threading/simple_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/system/message_pipe.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter_test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -51,7 +51,7 @@
       d1->Init(mp, i ^ 1);  // 1, 0.
     }
     Waiter w;
-    uint32_t context = 0;
+    uintptr_t context = 0;
     HandleSignalsState hss;
 
     // Try adding a writable waiter when already writable.
@@ -353,7 +353,7 @@
   MojoDeadline elapsed;
   bool did_wait;
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   HandleSignalsState hss;
 
   // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa.
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.cc b/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.cc
index 47543ec..8b1ef38 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.cc
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.cc
@@ -29,7 +29,7 @@
 
 MojoResult MessagePipeEndpoint::AddAwakable(Awakable* /*awakable*/,
                                             MojoHandleSignals /*signals*/,
-                                            uint32_t /*context*/,
+                                            uintptr_t /*context*/,
                                             HandleSignalsState* signals_state) {
   NOTREACHED();
   if (signals_state)
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h b/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h
index 4eac70c..d82af5d7 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h
@@ -11,13 +11,13 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -67,7 +67,7 @@
   virtual HandleSignalsState GetHandleSignalsState() const;
   virtual MojoResult AddAwakable(Awakable* awakable,
                                  MojoHandleSignals signals,
-                                 uint32_t context,
+                                 uintptr_t context,
                                  HandleSignalsState* signals_state);
   virtual void RemoveAwakable(Awakable* awakable,
                               HandleSignalsState* signals_state);
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_test_utils.h b/third_party/mojo/src/mojo/edk/system/message_pipe_test_utils.h
index 3ee386c..be65e027 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_test_utils.h
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_test_utils.h
@@ -6,11 +6,11 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
 
 #include "base/test/test_io_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/message_pipe_unittest.cc b/third_party/mojo/src/mojo/edk/system/message_pipe_unittest.cc
index 2d31816..effbb5f 100644
--- a/third_party/mojo/src/mojo/edk/system/message_pipe_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/message_pipe_unittest.cc
@@ -461,7 +461,7 @@
   const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
 
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
 
   // Write to wake up waiter waiting for read.
   {
diff --git a/third_party/mojo/src/mojo/edk/system/mutex.h b/third_party/mojo/src/mojo/edk/system/mutex.h
index 67cda57e..8f43c49 100644
--- a/third_party/mojo/src/mojo/edk/system/mutex.h
+++ b/third_party/mojo/src/mojo/edk/system/mutex.h
@@ -14,9 +14,9 @@
 
 #include "base/synchronization/lock_impl.h"
 #include "base/threading/platform_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
 #include "third_party/mojo/src/mojo/edk/system/thread_annotations.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/mutex_unittest.cc b/third_party/mojo/src/mojo/edk/system/mutex_unittest.cc
index bcd745a..cf38400 100644
--- a/third_party/mojo/src/mojo/edk/system/mutex_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/mutex_unittest.cc
@@ -7,9 +7,9 @@
 #include <stdlib.h>
 
 #include "base/threading/platform_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/options_validation.h b/third_party/mojo/src/mojo/edk/system/options_validation.h
index a325b10d2..c2ede83 100644
--- a/third_party/mojo/src/mojo/edk/system/options_validation.h
+++ b/third_party/mojo/src/mojo/edk/system/options_validation.h
@@ -17,10 +17,10 @@
 #include <algorithm>
 
 #include "base/logging.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/options_validation_unittest.cc b/third_party/mojo/src/mojo/edk/system/options_validation_unittest.cc
index dab6597..11632d4 100644
--- a/third_party/mojo/src/mojo/edk/system/options_validation_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/options_validation_unittest.cc
@@ -7,8 +7,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "mojo/public/c/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.h b/third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.h
index 0dde78ca..0a9eec81 100644
--- a/third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.h
@@ -5,10 +5,10 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/simple_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/proxy_message_pipe_endpoint.h b/third_party/mojo/src/mojo/edk/system/proxy_message_pipe_endpoint.h
index 9e649fa..732c86dd 100644
--- a/third_party/mojo/src/mojo/edk/system/proxy_message_pipe_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/proxy_message_pipe_endpoint.h
@@ -6,10 +6,10 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/raw_channel.h b/third_party/mojo/src/mojo/edk/system/raw_channel.h
index 35f7a3e..4c8b6ff 100644
--- a/third_party/mojo/src/mojo/edk/system/raw_channel.h
+++ b/third_party/mojo/src/mojo/edk/system/raw_channel.h
@@ -10,12 +10,12 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class MessageLoopForIO;
diff --git a/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc b/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
index c2be79f..32d1fce 100644
--- a/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
+++ b/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
@@ -18,11 +18,11 @@
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_utils_posix.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/transport_data.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/raw_channel_unittest.cc b/third_party/mojo/src/mojo/edk/system/raw_channel_unittest.cc
index 831d3848..a416fea 100644
--- a/third_party/mojo/src/mojo/edk/system/raw_channel_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/raw_channel_unittest.cc
@@ -23,7 +23,6 @@
 #include "base/test/test_io_thread.h"
 #include "base/threading/simple_thread.h"
 #include "build/build_config.h"  // TODO(vtl): Remove this.
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
@@ -33,6 +32,7 @@
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/transport_data.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/raw_channel_win.cc b/third_party/mojo/src/mojo/edk/system/raw_channel_win.cc
index b25453f..5ff956b 100644
--- a/third_party/mojo/src/mojo/edk/system/raw_channel_win.cc
+++ b/third_party/mojo/src/mojo/edk/system/raw_channel_win.cc
@@ -15,8 +15,8 @@
 #include "base/process/process.h"
 #include "base/synchronization/lock.h"
 #include "base/win/windows_version.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/remote_consumer_data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/remote_consumer_data_pipe_impl.h
index c87f232..c1c6306 100644
--- a/third_party/mojo/src/mojo/edk/system/remote_consumer_data_pipe_impl.h
+++ b/third_party/mojo/src/mojo/edk/system/remote_consumer_data_pipe_impl.h
@@ -8,10 +8,10 @@
 #include "base/memory/aligned_memory.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/data_pipe_impl.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/remote_data_pipe_impl_unittest.cc b/third_party/mojo/src/mojo/edk/system/remote_data_pipe_impl_unittest.cc
index 2a5902e..9abe6a4 100644
--- a/third_party/mojo/src/mojo/edk/system/remote_data_pipe_impl_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/remote_data_pipe_impl_unittest.cc
@@ -12,7 +12,6 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/test/test_io_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
@@ -26,6 +25,7 @@
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -130,7 +130,7 @@
   uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer));
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Write on MP 0 (port 0). Wait and receive on MP 1 (port 0). (Add the waiter
   // first, to avoid any handling the case where it's already readable.)
@@ -164,7 +164,7 @@
   uint32_t read_num_dispatchers = 10;  // Maximum to get.
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
   // This is the consumer dispatcher we'll send.
@@ -282,7 +282,7 @@
   uint32_t read_num_dispatchers = 10;  // Maximum to get.
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
   // This is the consumer dispatcher we'll send.
@@ -392,7 +392,7 @@
   uint32_t read_num_dispatchers = 10;  // Maximum to get.
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
   // This is the consumer dispatcher we'll send.
diff --git a/third_party/mojo/src/mojo/edk/system/remote_message_pipe_unittest.cc b/third_party/mojo/src/mojo/edk/system/remote_message_pipe_unittest.cc
index 12684b0f..b04cb2c 100644
--- a/third_party/mojo/src/mojo/edk/system/remote_message_pipe_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/remote_message_pipe_unittest.cc
@@ -18,7 +18,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/test/test_io_thread.h"
 #include "build/build_config.h"              // TODO(vtl): Remove this.
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
@@ -36,6 +35,7 @@
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
 #include "third_party/mojo/src/mojo/edk/test/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -174,7 +174,7 @@
   uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Connect message pipes. MP 0, port 1 will be attached to channel 0 and
   // connected to MP 1, port 0, which will be attached to channel 1. This leaves
@@ -273,7 +273,7 @@
 TEST_F(RemoteMessagePipeTest, PeerClosed) {
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Connect message pipes. MP 0, port 1 will be attached to channel 0 and
   // connected to MP 1, port 0, which will be attached to channel 1. This leaves
@@ -313,7 +313,7 @@
   uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Connect message pipes as in the |Basic| test.
 
@@ -484,7 +484,7 @@
   uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Connect message pipes. MP 0, port 1 will be attached to channel 0 and
   // connected to MP 1, port 0, which will be attached to channel 1. This leaves
@@ -546,7 +546,7 @@
   uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // Connect message pipes. MP 0, port 1 will be attached to channel 0 and
   // connected to MP 1, port 0, which will be attached to channel 1. This leaves
@@ -606,7 +606,7 @@
   static const char kHello[] = "hello";
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<ChannelEndpoint> ep0;
   scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy(&ep0));
@@ -757,7 +757,7 @@
   static const char kWorld[] = "world!";
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   // We'll try to pass this dispatcher.
   scoped_refptr<MessagePipeDispatcher> dispatcher =
@@ -903,7 +903,7 @@
   static const char kHello[] = "hello";
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<ChannelEndpoint> ep0;
   scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy(&ep0));
@@ -1030,7 +1030,7 @@
   static const char kHello[] = "hello";
   static const char kWorld[] = "world";
   Waiter waiter;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   scoped_refptr<ChannelEndpoint> ep0;
@@ -1172,7 +1172,7 @@
   static const char kWorld[] = "world";
   Waiter waiter;
   HandleSignalsState hss;
-  uint32_t context = 0;
+  uintptr_t context = 0;
 
   scoped_refptr<ChannelEndpoint> ep0;
   scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy(&ep0));
diff --git a/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.h
index de90cb2..5d7b062d 100644
--- a/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.h
+++ b/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.h
@@ -8,10 +8,10 @@
 #include "base/memory/aligned_memory.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/data_pipe_impl.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.cc b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.cc
index 75c85cfa..60707ff 100644
--- a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -8,12 +8,12 @@
 
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/c/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
 #include "third_party/mojo/src/mojo/edk/system/configuration.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/options_validation.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h
index 3e6d4f2..5abdad7 100644
--- a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h
@@ -5,11 +5,11 @@
 #ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
 #include "third_party/mojo/src/mojo/edk/system/memory.h"
 #include "third_party/mojo/src/mojo/edk/system/simple_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
index b96393c..0b7912d 100644
--- a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
@@ -7,11 +7,11 @@
 #include <limits>
 
 #include "base/memory/ref_counted.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/simple_dispatcher.cc b/third_party/mojo/src/mojo/edk/system/simple_dispatcher.cc
index f8baae7..3934860 100644
--- a/third_party/mojo/src/mojo/edk/system/simple_dispatcher.cc
+++ b/third_party/mojo/src/mojo/edk/system/simple_dispatcher.cc
@@ -28,7 +28,7 @@
 MojoResult SimpleDispatcher::AddAwakableImplNoLock(
     Awakable* awakable,
     MojoHandleSignals signals,
-    uint32_t context,
+    uintptr_t context,
     HandleSignalsState* signals_state) {
   mutex().AssertHeld();
 
diff --git a/third_party/mojo/src/mojo/edk/system/simple_dispatcher.h b/third_party/mojo/src/mojo/edk/system/simple_dispatcher.h
index 542527da..5efdf95 100644
--- a/third_party/mojo/src/mojo/edk/system/simple_dispatcher.h
+++ b/third_party/mojo/src/mojo/edk/system/simple_dispatcher.h
@@ -7,10 +7,10 @@
 
 #include <list>
 
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/awakable_list.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -32,7 +32,7 @@
   void CancelAllAwakablesNoLock() override;
   MojoResult AddAwakableImplNoLock(Awakable* awakable,
                                    MojoHandleSignals signals,
-                                   uint32_t context,
+                                   uintptr_t context,
                                    HandleSignalsState* signals_state) override;
   void RemoveAwakableImplNoLock(Awakable* awakable,
                                 HandleSignalsState* signals_state) override;
diff --git a/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc b/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc
index 14cb5d87..d607637e 100644
--- a/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/simple_dispatcher_unittest.cc
@@ -13,11 +13,11 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_vector.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter_test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -94,7 +94,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a readable waiter when already readable.
@@ -196,7 +196,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a writable waiter when it can never be writable.
@@ -269,7 +269,7 @@
 
   scoped_refptr<MockSimpleDispatcher> d;
   Waiter w;
-  uint32_t context = 0;
+  uintptr_t context = 0;
   HandleSignalsState hss;
 
   // Try adding a writable waiter when the dispatcher has been closed.
@@ -332,7 +332,7 @@
   test::Stopwatch stopwatch;
   bool did_wait;
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   HandleSignalsState hss;
 
   // Wait for readable (already readable).
@@ -460,7 +460,7 @@
 
   bool did_wait[kNumWaiters];
   MojoResult result[kNumWaiters];
-  uint32_t context[kNumWaiters];
+  uintptr_t context[kNumWaiters];
   HandleSignalsState hss[kNumWaiters];
 
   // All wait for readable and becomes readable after some time.
diff --git a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
index 72b34655..8764a7f1 100644
--- a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
@@ -9,13 +9,13 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/system/connection_manager.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class TaskRunner;
diff --git a/third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h b/third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h
index 7ec9d0f..f47609f 100644
--- a/third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h
+++ b/third_party/mojo/src/mojo/edk/system/test_channel_endpoint_client.h
@@ -7,11 +7,11 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_endpoint_client.h"
 #include "third_party/mojo/src/mojo/edk/system/message_in_transit_queue.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace base {
 class WaitableEvent;
diff --git a/third_party/mojo/src/mojo/edk/system/test_utils.h b/third_party/mojo/src/mojo/edk/system/test_utils.h
index c821dc1..2eb44d1 100644
--- a/third_party/mojo/src/mojo/edk/system/test_utils.h
+++ b/third_party/mojo/src/mojo/edk/system/test_utils.h
@@ -6,8 +6,8 @@
 #define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_TEST_UTILS_H_
 
 #include "base/time/time.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/thread_annotations_unittest.cc b/third_party/mojo/src/mojo/edk/system/thread_annotations_unittest.cc
index 7b0a4e5..63cc878 100644
--- a/third_party/mojo/src/mojo/edk/system/thread_annotations_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/thread_annotations_unittest.cc
@@ -12,9 +12,9 @@
 
 #include "third_party/mojo/src/mojo/edk/system/thread_annotations.h"
 
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 // Uncomment these to enable particular compilation failure tests.
 // #define NC_GUARDED_BY
diff --git a/third_party/mojo/src/mojo/edk/system/transport_data.h b/third_party/mojo/src/mojo/edk/system/transport_data.h
index ea94139..f9ed731 100644
--- a/third_party/mojo/src/mojo/edk/system/transport_data.h
+++ b/third_party/mojo/src/mojo/edk/system/transport_data.h
@@ -12,11 +12,11 @@
 #include "base/memory/aligned_memory.h"
 #include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_vector.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/unique_identifier.h b/third_party/mojo/src/mojo/edk/system/unique_identifier.h
index 0991c38..b8df347 100644
--- a/third_party/mojo/src/mojo/edk/system/unique_identifier.h
+++ b/third_party/mojo/src/mojo/edk/system/unique_identifier.h
@@ -11,8 +11,8 @@
 #include <string>
 
 #include "base/containers/hash_tables.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/unique_identifier_unittest.cc b/third_party/mojo/src/mojo/edk/system/unique_identifier_unittest.cc
index 76f5db5..669f7b67 100644
--- a/third_party/mojo/src/mojo/edk/system/unique_identifier_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/unique_identifier_unittest.cc
@@ -8,9 +8,9 @@
 #include <string>
 
 #include "base/containers/hash_tables.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
diff --git a/third_party/mojo/src/mojo/edk/system/waiter.cc b/third_party/mojo/src/mojo/edk/system/waiter.cc
index f5d5cbb..f1b904e 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter.cc
+++ b/third_party/mojo/src/mojo/edk/system/waiter.cc
@@ -19,7 +19,7 @@
 #endif
       awoken_(false),
       awake_result_(MOJO_RESULT_INTERNAL),
-      awake_context_(static_cast<uint32_t>(-1)) {
+      awake_context_(static_cast<uintptr_t>(-1)) {
 }
 
 Waiter::~Waiter() {
@@ -36,7 +36,7 @@
 }
 
 // TODO(vtl): Fast-path the |deadline == 0| case?
-MojoResult Waiter::Wait(MojoDeadline deadline, uint32_t* context) {
+MojoResult Waiter::Wait(MojoDeadline deadline, uintptr_t* context) {
   base::AutoLock locker(lock_);
 
 #ifndef NDEBUG
@@ -49,7 +49,7 @@
   if (awoken_) {
     DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
     if (context)
-      *context = static_cast<uint32_t>(awake_context_);
+      *context = awake_context_;
     return awake_result_;
   }
 
@@ -78,7 +78,7 @@
 
   DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
   if (context)
-    *context = static_cast<uint32_t>(awake_context_);
+    *context = awake_context_;
   return awake_result_;
 }
 
diff --git a/third_party/mojo/src/mojo/edk/system/waiter.h b/third_party/mojo/src/mojo/edk/system/waiter.h
index 9f9cc9c..f09d7bd 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter.h
+++ b/third_party/mojo/src/mojo/edk/system/waiter.h
@@ -9,10 +9,10 @@
 
 #include "base/synchronization/condition_variable.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/awakable.h"
 #include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -54,7 +54,7 @@
   //     |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by
   //     the corresponding handle (e.g., if the other end of a message or data
   //     pipe is closed).
-  MojoResult Wait(MojoDeadline deadline, uint32_t* context);
+  MojoResult Wait(MojoDeadline deadline, uintptr_t* context);
 
   // Wake the waiter up with the given result and context (or no-op if it's been
   // woken up already).
diff --git a/third_party/mojo/src/mojo/edk/system/waiter_test_utils.cc b/third_party/mojo/src/mojo/edk/system/waiter_test_utils.cc
index 001cf80..d420216 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter_test_utils.cc
+++ b/third_party/mojo/src/mojo/edk/system/waiter_test_utils.cc
@@ -8,7 +8,7 @@
 namespace system {
 namespace test {
 
-SimpleWaiterThread::SimpleWaiterThread(MojoResult* result, uint32_t* context)
+SimpleWaiterThread::SimpleWaiterThread(MojoResult* result, uintptr_t* context)
     : base::SimpleThread("waiter_thread"), result_(result), context_(context) {
   waiter_.Init();
   *result_ = 5420734;    // Totally invalid result.
@@ -26,10 +26,10 @@
 WaiterThread::WaiterThread(scoped_refptr<Dispatcher> dispatcher,
                            MojoHandleSignals handle_signals,
                            MojoDeadline deadline,
-                           uint32_t context,
+                           uintptr_t context,
                            bool* did_wait_out,
                            MojoResult* result_out,
-                           uint32_t* context_out,
+                           uintptr_t* context_out,
                            HandleSignalsState* signals_state_out)
     : base::SimpleThread("waiter_thread"),
       dispatcher_(dispatcher),
diff --git a/third_party/mojo/src/mojo/edk/system/waiter_test_utils.h b/third_party/mojo/src/mojo/edk/system/waiter_test_utils.h
index 967fb1bb..a9e0f45f 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter_test_utils.h
+++ b/third_party/mojo/src/mojo/edk/system/waiter_test_utils.h
@@ -9,11 +9,11 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/threading/simple_thread.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_signals_state.h"
 #include "third_party/mojo/src/mojo/edk/system/waiter.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -47,7 +47,7 @@
  public:
   // For the duration of the lifetime of this object, |*result| belongs to it
   // (in the sense that it will write to it whenever it wants).
-  SimpleWaiterThread(MojoResult* result, uint32_t* context);
+  SimpleWaiterThread(MojoResult* result, uintptr_t* context);
   ~SimpleWaiterThread() override;  // Joins the thread.
 
   Waiter* waiter() { return &waiter_; }
@@ -56,7 +56,7 @@
   void Run() override;
 
   MojoResult* const result_;
-  uint32_t* const context_;
+  uintptr_t* const context_;
   Waiter waiter_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleWaiterThread);
@@ -73,10 +73,10 @@
   WaiterThread(scoped_refptr<Dispatcher> dispatcher,
                MojoHandleSignals handle_signals,
                MojoDeadline deadline,
-               uint32_t context,
+               uintptr_t context,
                bool* did_wait_out,
                MojoResult* result_out,
-               uint32_t* context_out,
+               uintptr_t* context_out,
                HandleSignalsState* signals_state_out);
   ~WaiterThread() override;
 
@@ -89,7 +89,7 @@
   const uint32_t context_;
   bool* const did_wait_out_;
   MojoResult* const result_out_;
-  uint32_t* const context_out_;
+  uintptr_t* const context_out_;
   HandleSignalsState* const signals_state_out_;
 
   Waiter waiter_;
diff --git a/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc b/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc
index 8d6e99d..15fb5e6d 100644
--- a/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/waiter_unittest.cc
@@ -12,10 +12,10 @@
 #include <stdint.h>
 
 #include "base/threading/simple_thread.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/system/mutex.h"
 #include "third_party/mojo/src/mojo/edk/system/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace system {
@@ -30,14 +30,14 @@
         deadline_(deadline),
         done_(false),
         result_(MOJO_RESULT_UNKNOWN),
-        context_(static_cast<uint32_t>(-1)) {
+        context_(static_cast<uintptr_t>(-1)) {
     waiter_.Init();
   }
 
   ~WaitingThread() override { Join(); }
 
   void WaitUntilDone(MojoResult* result,
-                     uint32_t* context,
+                     uintptr_t* context,
                      MojoDeadline* elapsed) {
     for (;;) {
       {
@@ -60,7 +60,7 @@
   void Run() override {
     test::Stopwatch stopwatch;
     MojoResult result;
-    uint32_t context = static_cast<uint32_t>(-1);
+    uintptr_t context = static_cast<uintptr_t>(-1);
     MojoDeadline elapsed;
 
     stopwatch.Start();
@@ -82,7 +82,7 @@
   Mutex mutex_;
   bool done_ MOJO_GUARDED_BY(mutex_);
   MojoResult result_ MOJO_GUARDED_BY(mutex_);
-  uint32_t context_ MOJO_GUARDED_BY(mutex_);
+  uintptr_t context_ MOJO_GUARDED_BY(mutex_);
   MojoDeadline elapsed_ MOJO_GUARDED_BY(mutex_);
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(WaitingThread);
@@ -90,7 +90,7 @@
 
 TEST(WaiterTest, Basic) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   MojoDeadline elapsed;
 
   // Finite deadline.
@@ -149,7 +149,7 @@
     thread.Start();
     thread.WaitUntilDone(&result, &context, &elapsed);
     EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result);
-    EXPECT_EQ(static_cast<uint32_t>(-1), context);
+    EXPECT_EQ(static_cast<uintptr_t>(-1), context);
     EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
     EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
   }
@@ -210,7 +210,7 @@
   MojoDeadline elapsed;
 
   Waiter waiter;
-  uint32_t context = 123;
+  uintptr_t context = 123;
 
   waiter.Init();
   stopwatch.Start();
@@ -241,7 +241,7 @@
 // The first |Awake()| should always win.
 TEST(WaiterTest, MultipleAwakes) {
   MojoResult result;
-  uint32_t context;
+  uintptr_t context;
   MojoDeadline elapsed;
 
   {
diff --git a/third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h b/third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h
index c11d79b9..c075860f 100644
--- a/third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h
+++ b/third_party/mojo/src/mojo/edk/test/multiprocess_test_helper.h
@@ -10,9 +10,9 @@
 #include "base/process/process.h"
 #include "base/test/multiprocess_test.h"
 #include "base/test/test_timeouts.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/multiprocess_func_list.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc b/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
index 41b5ab26..7fef1f6 100644
--- a/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
+++ b/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 #include "base/test/perf_test_suite.h"
-#include "mojo/public/tests/test_support_private.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/test/test_support_impl.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 int main(int argc, char** argv) {
   mojo::embedder::Init();
diff --git a/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc b/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
index 278cfef..4b7d8f0 100644
--- a/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
+++ b/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
@@ -7,10 +7,10 @@
 #include "base/bind.h"
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
-#include "mojo/public/tests/test_support_private.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/test/test_support_impl.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 int main(int argc, char** argv) {
 #if !defined(OS_ANDROID)
diff --git a/third_party/mojo/src/mojo/edk/test/scoped_ipc_support.h b/third_party/mojo/src/mojo/edk/test/scoped_ipc_support.h
index d30e76d..0df54204 100644
--- a/third_party/mojo/src/mojo/edk/test/scoped_ipc_support.h
+++ b/third_party/mojo/src/mojo/edk/test/scoped_ipc_support.h
@@ -9,12 +9,12 @@
 #include "base/memory/ref_counted.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/task_runner.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_type.h"
 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/edk/test/test_support_impl.h b/third_party/mojo/src/mojo/edk/test/test_support_impl.h
index 3ab51709..ecd48173 100644
--- a/third_party/mojo/src/mojo/edk/test/test_support_impl.h
+++ b/third_party/mojo/src/mojo/edk/test/test_support_impl.h
@@ -7,8 +7,8 @@
 
 #include <stdio.h>
 
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/tests/test_support_private.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/build/config/BUILD.gn b/third_party/mojo/src/mojo/public/build/config/BUILD.gn
deleted file mode 100644
index c104b8b..0000000
--- a/third_party/mojo/src/mojo/public/build/config/BUILD.gn
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("../../mojo_sdk.gni")
-
-config("mojo_sdk") {
-  include_dirs = [
-    # Include paths in the Mojo public SDK are specified relative to the
-    # directory holding the SDK.
-    mojo_root,
-
-    # The same goes for files generated from mojoms.
-    root_gen_dir + mojo_root,
-  ]
-}
diff --git a/third_party/mojo/src/mojo/public/c/environment/async_waiter.h b/third_party/mojo/src/mojo/public/c/environment/async_waiter.h
index b5a1f752..fd53891 100644
--- a/third_party/mojo/src/mojo/public/c/environment/async_waiter.h
+++ b/third_party/mojo/src/mojo/public/c/environment/async_waiter.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
-#define MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
 
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 typedef uintptr_t MojoAsyncWaitID;
 
@@ -62,4 +62,4 @@
   void (*CancelWait)(MojoAsyncWaitID wait_id);
 };
 
-#endif  // MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_
diff --git a/third_party/mojo/src/mojo/public/c/environment/logger.h b/third_party/mojo/src/mojo/public/c/environment/logger.h
index 2a9b617..05dd6ef 100644
--- a/third_party/mojo/src/mojo/public/c/environment/logger.h
+++ b/third_party/mojo/src/mojo/public/c/environment/logger.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
-#define MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
 
 #include <stdint.h>
 
@@ -58,4 +58,4 @@
   void (*SetMinimumLogLevel)(MojoLogLevel minimum_log_level);
 };
 
-#endif  // MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h b/third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h
index 61bf358..2b3568b6 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
-#define MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
 
 // Note: This header should be compilable as C.
 
-#include <stdint.h>
 #include <GLES2/gl2.h>
+#include <stdint.h>
 
-#include "mojo/public/c/gles2/gles2_export.h"
-#include "mojo/public/c/gles2/gles2_types.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_export.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 extern "C" typedef struct _ClientBuffer* ClientBuffer;
 
@@ -22,11 +22,11 @@
 
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
   MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
-#include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
 #undef VISIT_GL_CALL
 
 #ifdef __cplusplus
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_CHROMIUM_EXTENSION_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2.h b/third_party/mojo/src/mojo/public/c/gles2/gles2.h
index 1259bbc7..29f008a 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/gles2.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_GLES2_GLES2_H_
-#define MOJO_PUBLIC_C_GLES2_GLES2_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_H_
 
 // Note: This header should be compilable as C.
 
-#include <stdint.h>
 #include <GLES2/gl2.h>
+#include <stdint.h>
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/c/gles2/gles2_export.h"
-#include "mojo/public/c/gles2/gles2_types.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_export.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,11 +40,11 @@
 
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
   MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
-#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_autogen.h"
 #undef VISIT_GL_CALL
 
 #ifdef __cplusplus
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_GLES2_GLES2_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_export.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_export.h
index 60667b1..a91e525 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/gles2_export.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_export.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
-#define MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
 
 #if defined(COMPONENT_BUILD) && defined(MOJO_USE_GLES2_IMPL)
 #if defined(WIN32)
@@ -30,4 +30,4 @@
 
 #endif  // defined(COMPONENT_BUILD) && defined(MOJO_USE_GLES2_IMPL)
 
-#endif  // MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_EXPORT_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_types.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_types.h
index 75be18b..79e94af 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/gles2_types.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_types.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
-#define MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
 
 // Note: This header should be compilable as C.
 
 #include <stdint.h>
 
-#include "mojo/public/c/gles2/gles2_export.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_export.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -23,4 +23,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GLES2_GLES2_TYPES_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h b/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h
index ee062de..026c9c7e 100644
--- a/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h
+++ b/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h
@@ -124,7 +124,7 @@
 
 #undef KHRONOS_APICALL
 #if defined(GLES2_USE_MOJO)
-#include "mojo/public/c/gles2/gles2_export.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_export.h"
 #define KHRONOS_APICALL MOJO_GLES2_EXPORT
 #else
 #include "gpu/command_buffer/client/gles2_c_lib_export.h"
diff --git a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h
index 2633976..873838d 100644
--- a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h
+++ b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h
@@ -4,13 +4,13 @@
 
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_GPU_MGL_MGL_H_
-#define MOJO_PUBLIC_C_GPU_MGL_MGL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_H_
 
 #include <stdint.h>
 
-#include "mojo/public/c/gpu/MGL/mgl_types.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,4 +59,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_GPU_MGL_MGL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h
index f795214..fa7f103 100644
--- a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h
+++ b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h
@@ -4,12 +4,12 @@
 
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
-#define MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
 
 #include <stdint.h>
 
-#include "mojo/public/c/gpu/MGL/mgl_types.h"
+#include "third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -26,4 +26,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/buffer.h b/third_party/mojo/src/mojo/public/c/system/buffer.h
index 45d2c2d7..619b3382 100644
--- a/third_party/mojo/src/mojo/public/c/system/buffer.h
+++ b/third_party/mojo/src/mojo/public/c/system/buffer.h
@@ -9,12 +9,12 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
-#define MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
 
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/system_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 // |MojoCreateSharedBufferOptions|: Used to specify creation parameters for a
 // shared buffer to |MojoCreateSharedBuffer()|.
@@ -183,4 +183,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_BUFFER_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/core.h b/third_party/mojo/src/mojo/public/c/system/core.h
index 0e78786..e908afa 100644
--- a/third_party/mojo/src/mojo/public/c/system/core.h
+++ b/third_party/mojo/src/mojo/public/c/system/core.h
@@ -6,16 +6,16 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_CORE_H_
-#define MOJO_PUBLIC_C_SYSTEM_CORE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_CORE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_CORE_H_
 
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/system_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_CORE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_CORE_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/data_pipe.h b/third_party/mojo/src/mojo/public/c/system/data_pipe.h
index 54cfea8..eb54f81 100644
--- a/third_party/mojo/src/mojo/public/c/system/data_pipe.h
+++ b/third_party/mojo/src/mojo/public/c/system/data_pipe.h
@@ -6,12 +6,12 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
-#define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
 
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/system_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 // |MojoCreateDataPipeOptions|: Used to specify creation parameters for a data
 // pipe to |MojoCreateDataPipe()|.
@@ -363,4 +363,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/functions.h b/third_party/mojo/src/mojo/public/c/system/functions.h
index 8b576c1..9a8ae5e 100644
--- a/third_party/mojo/src/mojo/public/c/system/functions.h
+++ b/third_party/mojo/src/mojo/public/c/system/functions.h
@@ -6,11 +6,11 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
-#define MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
 
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/system_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -131,4 +131,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/macros.h b/third_party/mojo/src/mojo/public/c/system/macros.h
index 7f28e18..17470c6 100644
--- a/third_party/mojo/src/mojo/public/c/system/macros.h
+++ b/third_party/mojo/src/mojo/public/c/system/macros.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_MACROS_H_
-#define MOJO_PUBLIC_C_SYSTEM_MACROS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MACROS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MACROS_H_
 
 #include <stddef.h>
 
@@ -76,4 +76,4 @@
 #error "Please define MOJO_ALIGNAS() for your compiler."
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_MACROS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MACROS_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/main.h b/third_party/mojo/src/mojo/public/c/system/main.h
index 65d0837..c73cf3a 100644
--- a/third_party/mojo/src/mojo/public/c/system/main.h
+++ b/third_party/mojo/src/mojo/public/c/system/main.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_MAIN_H_
-#define MOJO_PUBLIC_C_SYSTEM_MAIN_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MAIN_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MAIN_H_
 
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 // Implement MojoMain directly as the entry point for an application.
 //
@@ -32,4 +32,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_MAIN_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MAIN_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/message_pipe.h b/third_party/mojo/src/mojo/public/c/system/message_pipe.h
index d42c3fc..f8701504 100644
--- a/third_party/mojo/src/mojo/public/c/system/message_pipe.h
+++ b/third_party/mojo/src/mojo/public/c/system/message_pipe.h
@@ -6,12 +6,12 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
-#define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
 
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/system_export.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 // |MojoCreateMessagePipeOptions|: Used to specify creation parameters for a
 // message pipe to |MojoCreateMessagePipe()|.
@@ -174,4 +174,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/system_export.h b/third_party/mojo/src/mojo/public/c/system/system_export.h
index bc3b459..bce06462 100644
--- a/third_party/mojo/src/mojo/public/c/system/system_export.h
+++ b/third_party/mojo/src/mojo/public/c/system/system_export.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
-#define MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
 
 #if defined(COMPONENT_BUILD) && defined(MOJO_USE_SYSTEM_IMPL)
 #if defined(WIN32)
@@ -30,4 +30,4 @@
 
 #endif  // defined(COMPONENT_BUILD) && defined(MOJO_USE_SYSTEM_IMPL)
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_SYSTEM_EXPORT_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/tests/core_perftest.cc b/third_party/mojo/src/mojo/public/c/system/tests/core_perftest.cc
index 3ee3015..1b706fe 100644
--- a/third_party/mojo/src/mojo/public/c/system/tests/core_perftest.cc
+++ b/third_party/mojo/src/mojo/public/c/system/tests/core_perftest.cc
@@ -4,21 +4,21 @@
 
 // This tests the performance of the C API.
 
-#include "mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
 
 #include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/test_support/test_support.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
 
 // TODO(vtl): (here and below) crbug.com/342893
 #if !defined(WIN32)
 #include <time.h>
-#include "mojo/public/cpp/utility/thread.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/thread.h"
 #endif  // !defined(WIN32)
 
 namespace {
diff --git a/third_party/mojo/src/mojo/public/c/system/tests/core_unittest.cc b/third_party/mojo/src/mojo/public/c/system/tests/core_unittest.cc
index de59a70f..2168e7f 100644
--- a/third_party/mojo/src/mojo/public/c/system/tests/core_unittest.cc
+++ b/third_party/mojo/src/mojo/public/c/system/tests/core_unittest.cc
@@ -4,7 +4,7 @@
 
 // This file tests the C API.
 
-#include "mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
 
 #include <string.h>
 
diff --git a/third_party/mojo/src/mojo/public/c/system/tests/core_unittest_pure_c.c b/third_party/mojo/src/mojo/public/c/system/tests/core_unittest_pure_c.c
index d5978a9..22d3146 100644
--- a/third_party/mojo/src/mojo/public/c/system/tests/core_unittest_pure_c.c
+++ b/third_party/mojo/src/mojo/public/c/system/tests/core_unittest_pure_c.c
@@ -11,9 +11,9 @@
 
 // Include all the header files that are meant to be compilable as C. Start with
 // core.h, since it's the most important one.
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 // The joys of the C preprocessor....
 #define STRINGIFY(x) #x
diff --git a/third_party/mojo/src/mojo/public/c/system/tests/macros_unittest.cc b/third_party/mojo/src/mojo/public/c/system/tests/macros_unittest.cc
index b22e124..3565e85e 100644
--- a/third_party/mojo/src/mojo/public/c/system/tests/macros_unittest.cc
+++ b/third_party/mojo/src/mojo/public/c/system/tests/macros_unittest.cc
@@ -8,7 +8,7 @@
 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
 // and write some "negative" tests.
 
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 #include <assert.h>
 #include <stdint.h>
diff --git a/third_party/mojo/src/mojo/public/c/system/types.h b/third_party/mojo/src/mojo/public/c/system/types.h
index 4574d74..2f0b134f 100644
--- a/third_party/mojo/src/mojo/public/c/system/types.h
+++ b/third_party/mojo/src/mojo/public/c/system/types.h
@@ -7,12 +7,12 @@
 //
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_
-#define MOJO_PUBLIC_C_SYSTEM_TYPES_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_TYPES_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_TYPES_H_
 
 #include <stdint.h>
 
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 // TODO(vtl): Notes: Use of undefined flags will lead to undefined behavior
 // (typically they'll be ignored), not necessarily an error.
@@ -182,4 +182,4 @@
 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8,
                    "MojoHandleSignalsState has wrong size");
 
-#endif  // MOJO_PUBLIC_C_SYSTEM_TYPES_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_SYSTEM_TYPES_H_
diff --git a/third_party/mojo/src/mojo/public/c/test_support/BUILD.gn b/third_party/mojo/src/mojo/public/c/test_support/BUILD.gn
index 4f7fce26..3b11a604 100644
--- a/third_party/mojo/src/mojo/public/c/test_support/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/c/test_support/BUILD.gn
@@ -8,8 +8,6 @@
 
   defines = [ "MOJO_TEST_SUPPORT_IMPLEMENTATION" ]
 
-  public_configs = [ "../../build/config:mojo_sdk" ]
-
   sources = [
     "test_support.h",
     "test_support_export.h",
diff --git a/third_party/mojo/src/mojo/public/c/test_support/test_support.h b/third_party/mojo/src/mojo/public/c/test_support/test_support.h
index 73a2eefa..2f8c28ce 100644
--- a/third_party/mojo/src/mojo/public/c/test_support/test_support.h
+++ b/third_party/mojo/src/mojo/public/c/test_support/test_support.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
-#define MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
 
 // Note: This header should be compilable as C.
 
 #include <stdio.h>
 
-#include "mojo/public/c/test_support/test_support_export.h"
+#include "third_party/mojo/src/mojo/public/c/test_support/test_support_export.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,4 +52,4 @@
 }  // extern "C"
 #endif
 
-#endif  // MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_
diff --git a/third_party/mojo/src/mojo/public/c/test_support/test_support_export.h b/third_party/mojo/src/mojo/public/c/test_support/test_support_export.h
index e22a9e30..7200fec 100644
--- a/third_party/mojo/src/mojo/public/c/test_support/test_support_export.h
+++ b/third_party/mojo/src/mojo/public/c/test_support/test_support_export.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
-#define MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
 
 #if defined(WIN32)
 
@@ -23,4 +23,4 @@
 
 #endif  // defined(WIN32)
 
-#endif  // MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_EXPORT_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/BUILD.gn b/third_party/mojo/src/mojo/public/cpp/bindings/BUILD.gn
index b8600632..89679f2e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/BUILD.gn
@@ -65,13 +65,16 @@
     "type_converter.h",
   ]
 
-  deps = [
+  public_deps = [
     ":callback",
   ]
 
+  mojo_sdk_public_deps = [
+    "mojo/public/cpp/system",
+  ]
+
   mojo_sdk_deps = [
     "mojo/public/cpp/environment",
-    "mojo/public/cpp/system",
     "mojo/public/interfaces/bindings:bindings_cpp_sources",
   ]
 }
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/array.h b/third_party/mojo/src/mojo/public/cpp/bindings/array.h
index f7d3921..f9b779a 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/array.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/array.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
 
 #include <string.h>
 
@@ -12,11 +12,11 @@
 #include <string>
 #include <vector>
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-#include "mojo/public/cpp/bindings/lib/value_traits.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
 
 namespace mojo {
 
@@ -246,4 +246,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_ptr_info.h b/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_ptr_info.h
index 55f9c4a..780fe0e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_ptr_info.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_ptr_info.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -29,4 +29,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_INFO_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_request.h b/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_request.h
index 9882b890..4cd037e2 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_request.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_request.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -28,4 +28,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/binding.h b/third_party/mojo/src/mojo/public/cpp/bindings/binding.h
index de9159f..3bee7c2e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/binding.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/binding.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
@@ -236,4 +236,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/callback.h b/third_party/mojo/src/mojo/public/cpp/bindings/callback.h
index beec1a10..25b9e8e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/callback.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/callback.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
 
-#include "mojo/public/cpp/bindings/lib/callback_internal.h"
-#include "mojo/public/cpp/bindings/lib/shared_ptr.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/callback_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 
 namespace mojo {
 
@@ -112,4 +112,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
index dc44667..8cfd646 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
 
 #include <algorithm>
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/bindings/lib/interface_ptr_internal.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -194,4 +194,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h
index 4f61915f..bb96a50b 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
 
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
 namespace mojo {
 
@@ -55,4 +55,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h b/third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h
index c139306e..0bd42f7 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
 
-#include "mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
 
 namespace mojo {
 
@@ -115,4 +115,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.cc
index 61e4b0d..a92911e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
 
 #include <sstream>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h
index 41ca174d..152ae59 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h
@@ -2,22 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
 
 #include <new>
 #include <vector>
 
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/bindings/lib/buffer.h"
-#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-#include "mojo/public/cpp/bindings/lib/validate_params.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 template <typename T>
@@ -531,4 +531,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h
index 9d0e7bb4..854dd74 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
 
 #include <string.h>  // For |memcpy()|.
 
 #include <vector>
 
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/map_serialization.h"
-#include "mojo/public/cpp/bindings/lib/string_serialization.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
 
 namespace mojo {
 
@@ -335,4 +335,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h
index 436f580..4221239 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
 
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-#include "mojo/public/cpp/bindings/struct_ptr.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace internal {
@@ -131,4 +131,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.cc
index 791afe2..12730605 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h
index 5e2f9a7..8fa95d3 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
 
 #include <vector>
 
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace internal {
@@ -88,4 +88,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.cc
index 5b96b2d0..2e4e926 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h
index f0520be8..2ad9bc1 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -60,4 +60,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BOUNDS_CHECKER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h
index c3b570e..99197f4e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
 
 #include <stddef.h>
 
@@ -21,4 +21,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_BUFFER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/callback_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/callback_internal.h
index 9df5b40a7..a48445a 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/callback_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/callback_internal.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
 
-#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 
 namespace mojo {
 class String;
@@ -50,4 +50,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.cc
index 5bd94eb..74a1e7d 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/connector.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h"
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h
index 185a984..e62345c 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 class ErrorHandler;
@@ -139,4 +139,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
index 5113bb020..c3305a4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h"
 
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h
index 4a2fed5e..9de4fd75 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -39,4 +39,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
index ad729c5..0049bfb 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h"
 
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h
index 5b0f018..229ef4c 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -35,4 +35,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.cc
index d32eb78..4194f69 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
 
 #include <algorithm>
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h
index bd7f9f5..65c2d63 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
 
 #include <vector>
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/bindings/message_filter.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -61,4 +61,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FILTER_CHAIN_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
index c81fc6e..44d0c86 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
 
 #include <stdlib.h>
 
 #include <algorithm>
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
index 83eaf97..f0c7efd 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
 
-#include "mojo/public/cpp/bindings/lib/buffer.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -75,4 +75,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
index 1c2cad8..b0872fb9 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
 
 #include <algorithm>  // For |std::swap()|.
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 struct MojoAsyncWaiter;
 
@@ -171,4 +171,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h
index 8315dbc..a8d7f501 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/validate_params.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/bindings/lib/validation_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h"
 
 namespace mojo {
 namespace internal {
@@ -138,4 +138,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h
index 84f927c..e5bafc1 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
 
 #include <map>
 
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 
 namespace mojo {
 namespace internal {
@@ -217,4 +217,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h
index 6014b36b..4052ae8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
-#include "mojo/public/cpp/bindings/lib/map_internal.h"
-#include "mojo/public/cpp/bindings/lib/string_serialization.h"
-#include "mojo/public/cpp/bindings/map.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/map.h"
 
 namespace mojo {
 
@@ -179,4 +179,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
index 6b563e7..26884e4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
 
 #include <stdlib.h>
 
 #include <algorithm>
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
index 25f1862..a96f93f 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
index 86ae71db..9178eb9 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/bindings/lib/message_internal.h"
-#include "mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
 
 namespace mojo {
 class Message;
@@ -65,4 +65,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_filter.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_filter.cc
index b09f40d..f1cb7d27 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_filter.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_filter.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/message_filter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.cc
index 940b15c..990bbb1 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h"
 
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/bindings/lib/validation_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h
index bccef1f7..71a2c003 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/bindings/message_filter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h"
 
 namespace mojo {
 namespace internal {
@@ -21,4 +21,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_HEADER_VALIDATOR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h
index 97b9619..744a2bb 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
 
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
 
 namespace mojo {
 namespace internal {
@@ -47,4 +47,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/no_interface.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/no_interface.cc
index 9e0945c..703bc8c3 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/no_interface.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/no_interface.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/no_interface.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.cc
index fff72b4..b28d2cef 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
index 1697610..97ce239 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
 
 #include <map>
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/lib/connector.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/shared_data.h"
-#include "mojo/public/cpp/bindings/lib/thread_checker.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
@@ -138,4 +138,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h
index 2676224c..1490fc5 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
 
 #include <assert.h>
 
-#include "mojo/public/cpp/bindings/lib/thread_checker.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -80,4 +80,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_DATA_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_ptr.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_ptr.h
index 37c8735..3a55a59 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_ptr.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_ptr.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
 
-#include "mojo/public/cpp/bindings/lib/shared_data.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/shared_data.h"
 
 namespace mojo {
 namespace internal {
@@ -54,4 +54,4 @@
 }  // namespace mojo
 }  // namespace internal
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.cc
index e29d6f8..e217acd 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/string_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h"
 
 #include <string.h>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h
index 01187423..5ad904a 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 namespace mojo {
 
@@ -18,4 +18,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h
index 9a5788c..7eb68d4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
 
 namespace mojo {
 namespace internal {
@@ -127,4 +127,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_TEMPLATE_UTIL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h
index da45d0a..30af5941 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #if !defined(_WIN32)
-#include "mojo/public/cpp/bindings/lib/thread_checker_posix.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h"
 #endif
 
 namespace mojo {
@@ -34,4 +34,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.cc
index c8a16e2..1a31973 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/thread_checker_posix.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h"
 
 #include <assert.h>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h
index 4701b889..ea1de5a 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
 
 #include <pthread.h>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -28,4 +28,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_POSIX_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/union_accessor.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/union_accessor.h
index 821aede5..54ad2f8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/union_accessor.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/union_accessor.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
 
 namespace mojo {
 namespace internal {
@@ -30,4 +30,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_UNION_ACCESSOR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h
index 274a0123..9871985 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -46,4 +46,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.cc
index ee58ed9a..11fecbba 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h
index 1d15bc9..27084fa8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -119,4 +119,4 @@
       << ValidationErrorToString(error) << " at the receiving side ("    \
       << description << ").";
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.cc
index 2268a15..f81df0f 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/validation_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h"
 
 #include <limits>
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/message_internal.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h
index 6853f457..b1f61571 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
 
 namespace mojo {
 namespace internal {
@@ -50,4 +50,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h
index d3b295b2..a1339cf 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
 
-#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/template_util.h"
 
 namespace mojo {
 
@@ -105,4 +105,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/map.h b/third_party/mojo/src/mojo/public/cpp/bindings/map.h
index 0f08d83..c5a77f8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/map.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/map.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
 
 #include <map>
 
-#include "mojo/public/cpp/bindings/lib/map_internal.h"
-#include "mojo/public/cpp/bindings/lib/value_traits.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h"
 
 namespace mojo {
 
@@ -293,4 +293,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/message.h b/third_party/mojo/src/mojo/public/cpp/bindings/message.h
index 7e34606..979a7b9 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/message.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/message.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
 
 #include <vector>
 
-#include "mojo/public/cpp/bindings/lib/message_internal.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 
@@ -156,4 +156,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h b/third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h
index 12885b0..ac46e3e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_FILTER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_FILTER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_FILTER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_FILTER_H_
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -36,4 +36,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_FILTER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_FILTER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h b/third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h
index d8915cdf..aac7471 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/bindings/message_filter.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
@@ -49,4 +49,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/string.h b/third_party/mojo/src/mojo/public/cpp/bindings/string.h
index e0ed4ba..cb9343d6 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/string.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/string.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
 
 #include <string>
 
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 
@@ -172,4 +172,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRING_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h b/third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h
index 860260e..8089fddf 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h
@@ -2,20 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
 
 #include <assert.h>
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
@@ -124,4 +124,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h b/third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h
index b324e93a..f1199e6 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
 
 #include <new>
 
-#include "mojo/public/cpp/bindings/type_converter.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -203,4 +203,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
index 8befe81..bccd49e3 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/array_serialization.h"
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/bindings/tests/container_test_util.h"
-#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc
index 83d74f9..79b5f1c64 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc
@@ -5,13 +5,13 @@
 #include "base/message_loop/message_loop.h"
 #include "build/build_config.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/cpp/test_support/test_support.h"
-#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
 
 ///////////////////////////////////////////////////////////////////////////////
 //
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_unittest.cc
index 1462b33..b6b73d4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -7,12 +7,12 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/bindings_perftest.cc
index 7440acce1..5eb79846 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/bindings_perftest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/bindings_perftest.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/test_support/test_support.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/cpp/utility/run_loop.h"
-#include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/ping_service.mojom.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/bounds_checker_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/bounds_checker_unittest.cc
index c1ec7b3..000d39ce 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/bounds_checker_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/bounds_checker_unittest.cc
@@ -4,10 +4,10 @@
 
 #include <limits>
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/system/core.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
index 317a2a5..9858e5d0 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
@@ -4,9 +4,9 @@
 
 #include <limits>
 
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/callback_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/callback_unittest.cc
index 158b21e..a2ad106 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/callback_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/callback_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/map.h"
-#include "mojo/public/cpp/bindings/string.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/map.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
index febc72e..158c8c8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
@@ -7,11 +7,11 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/lib/connector.h"
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/tests/message_queue.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/constant_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/constant_unittest.cc
index f6394f3a..ec6ccfcc 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/constant_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/constant_unittest.cc
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/interfaces/bindings/tests/test_constants.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_constants.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.cc
index e8377c4..7bbe1d7 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/tests/container_test_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h b/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h
index 1e29d22..5155cb9 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -49,4 +49,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/equals_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/equals_unittest.cc
index 5306f1f..7b24493 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/equals_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/equals_unittest.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/lib/value_traits.h"
-#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
index 8487d0a..b7e78b4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_factory.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index 508787a..1cabeb9 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -4,13 +4,13 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/scoping.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/scoping.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
index 5b049a87..078eebdc 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/lib/array_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/bindings/lib/validate_params.h"
-#include "mojo/public/cpp/bindings/map.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/bindings/tests/container_test_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/map.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/container_test_util.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
index 71cb4905..b1ef19c 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/tests/message_queue.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h"
 
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h
index c47ca99..4070baf 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_QUEUE_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_QUEUE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_MESSAGE_QUEUE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_MESSAGE_QUEUE_H_
 
 #include <queue>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class Message;
@@ -40,4 +40,4 @@
 }  // namespace test
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_QUEUE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_MESSAGE_QUEUE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/request_response_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/request_response_unittest.cc
index 1e85d4a3..f9130e8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/request_response_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/request_response_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_import.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
index c9c9f018..df659c2 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
@@ -7,11 +7,11 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/bindings/tests/message_queue.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/sample_service_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
index 58878a7..041d4821 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
@@ -6,8 +6,8 @@
 #include <ostream>
 #include <string>
 
-#include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
index 15da0516..5dc0769 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
@@ -5,15 +5,15 @@
 // Serialization warnings are only recorded in debug build.
 #ifndef NDEBUG
 
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/array_serialization.h"
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/string_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/string_unittest.cc
index f6bc424..3a5d2df8 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/string_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/string_unittest.cc
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/string.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
index 24173e5..c7d9f43 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
@@ -4,10 +4,10 @@
 
 #include <string.h>
 
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
index 704110a5..ef9ea717 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
index e6fddb7..46254d6e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
@@ -6,17 +6,17 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/lib/array_internal.h"
-#include "mojo/public/cpp/bindings/lib/array_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
-#include "mojo/public/interfaces/bindings/tests/test_unions.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_unions.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
index 9d2607d..7cf0a93 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
 
 #include <assert.h>
 #include <stdio.h>
@@ -13,7 +13,7 @@
 #include <set>
 #include <utility>
 
-#include "mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h
index d5f8c81..33662fe3 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
 
 #include <stdint.h>
 
@@ -117,4 +117,4 @@
 }  // namespace test
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
index fc536c2..69213a5 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -10,20 +10,20 @@
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/c/system/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/lib/connector.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/test_support/test_support.h"
-#include "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/connector.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_apptest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_apptest.cc
index 18cbea9..97cfd81 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_apptest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_apptest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/application_test_base.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/interfaces/bindings/tests/versioning_test_client.mojom.h"
+#include "mojo/application/public/cpp/application_impl.h"
+#include "mojo/application/public/cpp/application_test_base.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/versioning_test_client.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_test_service.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_test_service.cc
index e5d63a4a..48e1b4a 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_test_service.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/versioning_test_service.cc
@@ -4,14 +4,14 @@
 
 #include <map>
 
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_connection.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_runner.h"
-#include "mojo/public/cpp/application/interface_factory.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/interfaces/bindings/tests/versioning_test_service.mojom.h"
+#include "mojo/application/public/cpp/application_connection.h"
+#include "mojo/application/public/cpp/application_delegate.h"
+#include "mojo/application/public/cpp/application_runner.h"
+#include "mojo/application/public/cpp/interface_factory.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/tests/versioning_test_service.mojom.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h b/third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h
index ff94cda..431a4da 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
 
 namespace mojo {
 
@@ -89,4 +89,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_TYPE_CONVERTER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h b/third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h
index 83b7c8a..d48bbcf 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
 
 namespace mojo {
 
@@ -37,4 +37,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/environment.h b/third_party/mojo/src/mojo/public/cpp/environment/environment.h
index 3a54428..c6ecbf7a 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/environment.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/environment.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 struct MojoAsyncWaiter;
 struct MojoLogger;
@@ -50,4 +50,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/async_waiter.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/async_waiter.cc
index 599a649..f4acd048 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/async_waiter.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/async_waiter.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.cc
index 4a588a99..3261c14 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/lib/default_async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h"
 
 #include <assert.h>
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/utility/run_loop.h"
-#include "mojo/public/cpp/utility/run_loop_handler.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h
index 49ce233..936a057 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
 
 struct MojoAsyncWaiter;
 
@@ -15,4 +15,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.cc
index ba787d1..67a67c54 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/lib/default_logger.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h"
 
 #include <stdio.h>
 #include <stdlib.h>  // For |abort()|.
 
 #include <algorithm>
 
-#include "mojo/public/c/environment/logger.h"
+#include "third_party/mojo/src/mojo/public/c/environment/logger.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h
index 4db32336..70aa9f7 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
 
 struct MojoLogger;
 
@@ -15,4 +15,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
index a99f1c7..e63220bd 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/lib/default_task_tracker.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h"
 
-#include "mojo/public/cpp/environment/task_tracker.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
index 7a0c0647..2e0123d 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
 
 namespace mojo {
 
@@ -16,4 +16,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/environment.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/environment.cc
index 8c7c9306..d80b395 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/environment.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/environment.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 #include <assert.h>
 
-#include "mojo/public/c/environment/logger.h"
-#include "mojo/public/cpp/environment/lib/default_async_waiter.h"
-#include "mojo/public/cpp/environment/lib/default_logger.h"
-#include "mojo/public/cpp/environment/lib/default_task_tracker.h"
-#include "mojo/public/cpp/utility/run_loop.h"
+#include "third_party/mojo/src/mojo/public/c/environment/logger.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_logger.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/logging.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/logging.cc
index 57f1892..86b0594 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/logging.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/logging.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
 
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.cc
index 9e253d5..d132b09e 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/environment/lib/scoped_task_tracking.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h"
 
-#include "mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h b/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h
index 1b0411e..370e96722 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_
 
-#include "mojo/public/cpp/environment/task_tracker.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -31,4 +31,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_SCOPED_TASK_TRACKING_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/logging.h b/third_party/mojo/src/mojo/public/cpp/environment/logging.h
index bfc5c13f..97796f3 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/logging.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/logging.h
@@ -9,14 +9,14 @@
 // implementation (in environment/lib) is meant to be used by any implementation
 // of the environment.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
 
 #include <sstream>
 
-#include "mojo/public/c/environment/logger.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/environment/logger.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #define MOJO_LOG_STREAM(level)                                             \
   ::mojo::internal::LogMessage(MOJO_LOG_LEVEL_##level, __FILE__, __LINE__) \
@@ -87,4 +87,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h b/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
index d6d3020d..9d399b3 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
-#define MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
 
 #include <stdint.h>
 
@@ -27,4 +27,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/tests/async_wait_unittest.cc b/third_party/mojo/src/mojo/public/cpp/environment/tests/async_wait_unittest.cc
index 83c5ca0..5230412 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/tests/async_wait_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/tests/async_wait_unittest.cc
@@ -4,13 +4,13 @@
 
 #include <string>
 
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/cpp/utility/run_loop.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/tests/async_waiter_unittest.cc b/third_party/mojo/src/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
index 1c1c2bf..7435612 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/tests/async_waiter_unittest.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/environment/async_waiter.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/cpp/utility/run_loop.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/async_waiter.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/tests/logger_unittest.cc b/third_party/mojo/src/mojo/public/cpp/environment/tests/logger_unittest.cc
index 8ca5538..ca0371e 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/tests/logger_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/tests/logger_unittest.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/c/environment/logger.h"
-#include "mojo/public/cpp/environment/environment.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/c/environment/logger.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/tests/logging_unittest.cc b/third_party/mojo/src/mojo/public/cpp/environment/tests/logging_unittest.cc
index 489888c5..b62f77b 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/tests/logging_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/tests/logging_unittest.cc
@@ -7,10 +7,10 @@
 #include <sstream>
 #include <string>
 
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/system/buffer.h b/third_party/mojo/src/mojo/public/cpp/system/buffer.h
index 9458c0a..2b5bb503 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/buffer.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/buffer.h
@@ -6,17 +6,17 @@
 // replacing the prefix of "Mojo" with a "mojo" namespace, and using more
 // strongly-typed representations of |MojoHandle|s.
 //
-// Please see "mojo/public/c/system/buffer.h" for complete documentation of the
+// Please see "third_party/mojo/src/mojo/public/c/system/buffer.h" for complete documentation of the
 // API.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
 
 #include <assert.h>
 
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -129,4 +129,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/core.h b/third_party/mojo/src/mojo/public/cpp/system/core.h
index b08a5a6a..1b9888b 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/core.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/core.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
 
-#include "mojo/public/cpp/system/buffer.h"
-#include "mojo/public/cpp/system/data_pipe.h"
-#include "mojo/public/cpp/system/functions.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/functions.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h b/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h
index c451cff..3b2599f1 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h
@@ -6,17 +6,17 @@
 // replacing the prefix of "Mojo" with a "mojo" namespace, and using more
 // strongly-typed representations of |MojoHandle|s.
 //
-// Please see "mojo/public/c/system/data_pipe.h" for complete documentation of
+// Please see "third_party/mojo/src/mojo/public/c/system/data_pipe.h" for complete documentation of
 // the API.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
 
 #include <assert.h>
 
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -159,4 +159,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/functions.h b/third_party/mojo/src/mojo/public/cpp/system/functions.h
index 9cfe3167..87ea2c8 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/functions.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/functions.h
@@ -5,13 +5,13 @@
 // This file provides a C++ wrapping around the standalone functions of the Mojo
 // C API, replacing the prefix of "Mojo" with a "mojo" namespace.
 //
-// Please see "mojo/public/c/system/functions.h" for complete documentation of
+// Please see "third_party/mojo/src/mojo/public/c/system/functions.h" for complete documentation of
 // the API.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
 
-#include "mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
 
 namespace mojo {
 
@@ -29,4 +29,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_FUNCTIONS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/handle.h b/third_party/mojo/src/mojo/public/cpp/system/handle.h
index 45624bc..9065dc04 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/handle.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/handle.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
 
 #include <assert.h>
 #include <limits>
 
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/types.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/functions.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -48,7 +48,7 @@
 // Wrapper functions:
 //
 // We provide simple wrappers for the |Mojo...()| functions (in
-// mojo/public/c/system/core.h -- see that file for details on individual
+// third_party/mojo/src/mojo/public/c/system/core.h -- see that file for details on individual
 // functions).
 //
 // The general guideline is functions that imply ownership transfer of a handle
@@ -287,4 +287,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/macros.h b/third_party/mojo/src/mojo/public/cpp/system/macros.h
index 7f0fcd7..3fc51cf 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/macros.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/macros.h
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 // Define a set of C++ specific macros.
-// Mojo C++ API users can assume that mojo/public/cpp/system/macros.h
-// includes mojo/public/c/system/macros.h.
+// Mojo C++ API users can assume that third_party/mojo/src/mojo/public/cpp/system/macros.h
+// includes third_party/mojo/src/mojo/public/c/system/macros.h.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
 
-#include "mojo/public/c/system/macros.h"  // Symbols exposed.
+#include "third_party/mojo/src/mojo/public/c/system/macros.h"  // Symbols exposed.
 
 // A macro to disallow the copy constructor and operator= functions.
 #define MOJO_DISALLOW_COPY_AND_ASSIGN(TypeName) \
@@ -78,4 +78,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/message_pipe.h b/third_party/mojo/src/mojo/public/cpp/system/message_pipe.h
index e7a1e35..3cb24fbf 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/message_pipe.h
+++ b/third_party/mojo/src/mojo/public/cpp/system/message_pipe.h
@@ -6,17 +6,17 @@
 // replacing the prefix of "Mojo" with a "mojo" namespace, and using more
 // strongly-typed representations of |MojoHandle|s.
 //
-// Please see "mojo/public/c/system/message_pipe.h" for complete documentation
+// Please see "third_party/mojo/src/mojo/public/c/system/message_pipe.h" for complete documentation
 // of the API.
 
-#ifndef MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
-#define MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
 
 #include <assert.h>
 
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -116,4 +116,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_PIPE_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/system/tests/core_unittest.cc b/third_party/mojo/src/mojo/public/cpp/system/tests/core_unittest.cc
index 4dcad43..63bfb05 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/tests/core_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/system/tests/core_unittest.cc
@@ -6,14 +6,14 @@
 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets
 // compiled into a different binary from the C API tests.
 
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 #include <stddef.h>
 
 #include <map>
 
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/system/tests/macros_unittest.cc b/third_party/mojo/src/mojo/public/cpp/system/tests/macros_unittest.cc
index 72a9b24..088e944 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/tests/macros_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/system/tests/macros_unittest.cc
@@ -10,7 +10,7 @@
 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
 // and write some "negative" tests.
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 #include <assert.h>
 #include <stdint.h>
diff --git a/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_support.cc b/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_support.cc
index 0b6035b..fbb7e61 100644
--- a/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_support.cc
+++ b/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_support.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
 
 #include <stdlib.h>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_utils.cc b/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_utils.cc
index 210c6b1..17bbc6a 100644
--- a/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_utils.cc
+++ b/third_party/mojo/src/mojo/public/cpp/test_support/lib/test_utils.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
 
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_support.h"
 
 namespace mojo {
 namespace test {
diff --git a/third_party/mojo/src/mojo/public/cpp/test_support/test_support.h b/third_party/mojo/src/mojo/public/cpp/test_support/test_support.h
index 9a536e6..c797991 100644
--- a/third_party/mojo/src/mojo/public/cpp/test_support/test_support.h
+++ b/third_party/mojo/src/mojo/public/cpp/test_support/test_support.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
-#define MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
 
 #include <string>
 #include <vector>
 
-#include "mojo/public/c/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/c/test_support/test_support.h"
 
 namespace mojo {
 namespace test {
@@ -32,4 +32,4 @@
 }  // namespace test
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_SUPPORT_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h b/third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h
index 6fd5a9e..7a4f8ae 100644
--- a/third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h
+++ b/third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
-#define MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
 
 #include <string>
 
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 namespace test {
@@ -37,4 +37,4 @@
 }  // namespace test
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_TEST_SUPPORT_TEST_UTILS_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/mutex.cc b/third_party/mojo/src/mojo/public/cpp/utility/lib/mutex.cc
index 23370e1..c4680c16 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/mutex.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/mutex.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/mutex.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/mutex.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/run_loop.cc b/third_party/mojo/src/mojo/public/cpp/utility/lib/run_loop.cc
index 7faf748..872e4a1 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/run_loop.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/run_loop.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/run_loop.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
 
 #include <assert.h>
 
 #include <algorithm>
 #include <vector>
 
-#include "mojo/public/cpp/utility/lib/thread_local.h"
-#include "mojo/public/cpp/utility/run_loop_handler.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread.cc b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread.cc
index 40f0bdd..007d473 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/thread.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/thread.h"
 
 #include <assert.h>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h
index f5461eea..3f6a1d1 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
-#define MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
 
 #ifndef _WIN32
 #include <pthread.h>
 #endif
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace internal {
@@ -51,4 +51,4 @@
 }  // namespace internal
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_LIB_THREAD_LOCAL_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_posix.cc b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_posix.cc
index ea7343e..2286f38 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_posix.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_posix.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/lib/thread_local.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h"
 
 #include <assert.h>
 
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_win.cc b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_win.cc
index 98841f72..baa88cb 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_win.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local_win.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/lib/thread_local.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/lib/thread_local.h"
 
-#include <assert.h>
 #include <windows.h>
+#include <assert.h>
 
 namespace mojo {
 namespace internal {
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/mutex.h b/third_party/mojo/src/mojo/public/cpp/utility/mutex.h
index 4dc4aeec..a9dae45 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/mutex.h
+++ b/third_party/mojo/src/mojo/public/cpp/utility/mutex.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
-#define MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
 
 #ifdef _WIN32
 #error "Not implemented: See crbug.com/342893."
@@ -11,7 +11,7 @@
 
 #include <pthread.h>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -67,4 +67,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/run_loop.h b/third_party/mojo/src/mojo/public/cpp/utility/run_loop.h
index 4673eaa..79e5c6dd 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/run_loop.h
+++ b/third_party/mojo/src/mojo/public/cpp/utility/run_loop.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
-#define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
 
 #include <map>
 #include <queue>
 
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
@@ -153,4 +153,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h b/third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h
index 69838d5..d68af74 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h
+++ b/third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
-#define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
 
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
 
 namespace mojo {
 
@@ -22,4 +22,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_HANDLER_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/tests/mutex_unittest.cc b/third_party/mojo/src/mojo/public/cpp/utility/tests/mutex_unittest.cc
index 78e95c53..69d5df6 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/tests/mutex_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/tests/mutex_unittest.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/mutex.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/mutex.h"
 
 #include <stdlib.h>  // For |rand()|.
 #include <time.h>  // For |nanosleep()| (defined by POSIX).
 
 #include <vector>
 
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/public/cpp/utility/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/thread.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/tests/run_loop_unittest.cc b/third_party/mojo/src/mojo/public/cpp/utility/tests/run_loop_unittest.cc
index 4ab4876..5e3bf80 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/tests/run_loop_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/tests/run_loop_unittest.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/run_loop.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop.h"
 
 #include <string>
 
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/cpp/utility/run_loop_handler.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
+#include "third_party/mojo/src/mojo/public/cpp/test_support/test_utils.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/run_loop_handler.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/tests/thread_unittest.cc b/third_party/mojo/src/mojo/public/cpp/utility/tests/thread_unittest.cc
index 57c4ad9b..e9dea6b 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/tests/thread_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/utility/tests/thread_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/cpp/utility/thread.h"
+#include "third_party/mojo/src/mojo/public/cpp/utility/thread.h"
 
-#include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/thread.h b/third_party/mojo/src/mojo/public/cpp/utility/thread.h
index b7d10ee..d010819 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/thread.h
+++ b/third_party/mojo/src/mojo/public/cpp/utility/thread.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
-#define MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
 
 #ifdef _WIN32
 #error "Not implemented: See crbug.com/342893."
@@ -12,7 +12,7 @@
 #include <pthread.h>
 #include <stddef.h>
 
-#include "mojo/public/cpp/system/macros.h"
+#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -59,4 +59,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_UTILITY_THREAD_H_
diff --git a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom
index b62df5b..6b297fb 100644
--- a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom
+++ b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/test_structs.mojom
@@ -5,7 +5,7 @@
 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"]
 module mojo.test;
 
-import "mojo/public/interfaces/bindings/tests/rect.mojom";
+import "third_party/mojo/src/mojo/public/interfaces/bindings/tests/rect.mojom";
 
 struct NamedRegion {
   string? name;
diff --git a/third_party/mojo/src/mojo/public/js/constants.cc b/third_party/mojo/src/mojo/public/js/constants.cc
index d29f5cb..ab680ef1 100644
--- a/third_party/mojo/src/mojo/public/js/constants.cc
+++ b/third_party/mojo/src/mojo/public/js/constants.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/js/constants.h"
+#include "third_party/mojo/src/mojo/public/js/constants.h"
 
 namespace mojo {
 
diff --git a/third_party/mojo/src/mojo/public/mojo_sdk.gni b/third_party/mojo/src/mojo/public/mojo_sdk.gni
index 598b5b4..408c14a1 100644
--- a/third_party/mojo/src/mojo/public/mojo_sdk.gni
+++ b/third_party/mojo/src/mojo/public/mojo_sdk.gni
@@ -74,8 +74,7 @@
       libs = invoker.libs
     }
 
-    public_configs =
-        [ rebase_path("mojo/public/build/config:mojo_sdk", ".", mojo_root) ]
+    public_configs = []
     if (defined(invoker.public_configs)) {
       public_configs += invoker.public_configs
     }
diff --git a/third_party/mojo/src/mojo/public/platform/nacl/libmojo.cc b/third_party/mojo/src/mojo/public/platform/nacl/libmojo.cc
index de0b495..e4d9f00 100644
--- a/third_party/mojo/src/mojo/public/platform/nacl/libmojo.cc
+++ b/third_party/mojo/src/mojo/public/platform/nacl/libmojo.cc
@@ -5,12 +5,12 @@
 // WARNING this file was generated by generate_nacl_bindings.py
 // Do not edit by hand.
 
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/nacl/mojo_irt.h"
 #include "native_client/src/public/chrome_main.h"
 #include "native_client/src/public/imc_syscalls.h"
 #include "native_client/src/public/imc_types.h"
 #include "native_client/src/untrusted/irt/irt.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/platform/nacl/mojo_irt.h"
 
 // The value for this FD must not conflict with uses inside Chromium. However,
 // mojo/nacl doesn't depend on any Chromium headers, so we can't use a #define
diff --git a/third_party/mojo/src/mojo/public/platform/nacl/mojo_initial_handle.h b/third_party/mojo/src/mojo/public/platform/nacl/mojo_initial_handle.h
index 2d7bc4f..886f3d7b 100644
--- a/third_party/mojo/src/mojo/public/platform/nacl/mojo_initial_handle.h
+++ b/third_party/mojo/src/mojo/public/platform/nacl/mojo_initial_handle.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NACL_MOJO_INTIIAL_HANDLE_H_
-#define MOJO_PUBLIC_PLATFORM_NACL_MOJO_INTIIAL_HANDLE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_INITIAL_HANDLE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_INITIAL_HANDLE_H_
 
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 // Provides a MojoHandle that allows untrusted code to communicate with Mojo
 // interfaces outside the sandbox or in other processes.
 MojoResult _MojoGetInitialHandle(MojoHandle* out_handle);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NACL_MOJO_INTIIAL_HANDLE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_INITIAL_HANDLE_H_
diff --git a/third_party/mojo/src/mojo/public/platform/nacl/mojo_irt.h b/third_party/mojo/src/mojo/public/platform/nacl/mojo_irt.h
index db3a180f..61aa443 100644
--- a/third_party/mojo/src/mojo/public/platform/nacl/mojo_irt.h
+++ b/third_party/mojo/src/mojo/public/platform/nacl/mojo_irt.h
@@ -5,13 +5,13 @@
 // WARNING this file was generated by generate_nacl_bindings.py
 // Do not edit by hand.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
-#define MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
 
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/c/system/types.h"
+#include "third_party/mojo/src/mojo/public/c/system/buffer.h"
+#include "third_party/mojo/src/mojo/public/c/system/data_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/message_pipe.h"
+#include "third_party/mojo/src/mojo/public/c/system/types.h"
 
 #define NACL_IRT_MOJO_v0_1 "nacl-irt-mojo-0.1"
 
@@ -97,4 +97,4 @@
 }
 #endif
 
-#endif  // MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_
diff --git a/third_party/mojo/src/mojo/public/platform/nacl/mojo_main_thunk.cc b/third_party/mojo/src/mojo/public/platform/nacl/mojo_main_thunk.cc
index 7cb5b52..a9d574c 100644
--- a/third_party/mojo/src/mojo/public/platform/nacl/mojo_main_thunk.cc
+++ b/third_party/mojo/src/mojo/public/platform/nacl/mojo_main_thunk.cc
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/platform/nacl/mojo_initial_handle.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
+#include "third_party/mojo/src/mojo/public/platform/nacl/mojo_initial_handle.h"
 
 int main() {
   MojoHandle handle;
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.cc
index 0296d79f..8caddb9 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.cc
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 extern "C" {
 static MojoGLES2ImplChromiumExtensionThunks g_impl_chromium_extension_thunks = {0};
@@ -16,7 +16,7 @@
     assert(g_impl_chromium_extension_thunks.Function);             \
     return g_impl_chromium_extension_thunks.Function ARGUMENTS;    \
   }
-#include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
 #undef VISIT_GL_CALL
 
 extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplChromiumExtensionThunks(
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h
index adac8ea..5bfa0ba 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_extension_thunks.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/gles2/chromium_extension.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h"
 
 // Specifies the API for the GLES2 CHROMIUM extension.
 #pragma pack(push, 8)
@@ -16,7 +16,7 @@
 
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
   ReturnType(GL_APIENTRY *Function) PARAMETERS;
-#include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
 #undef VISIT_GL_CALL
 };
 #pragma pack(pop)
@@ -28,7 +28,7 @@
   MojoGLES2ImplChromiumExtensionThunks gles2_impl_chromium_extension_thunks = {
       sizeof(MojoGLES2ImplChromiumExtensionThunks),
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
-#include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h"
 #undef VISIT_GL_CALL
   };
 
@@ -41,4 +41,4 @@
 typedef size_t (*MojoSetGLES2ImplChromiumExtensionThunksFn)(
     const MojoGLES2ImplChromiumExtensionThunks* thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_EXTENSION_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.cc
index 1acf5a4..a117042 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.cc
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/gles2_impl_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 extern "C" {
 static MojoGLES2ImplThunks g_impl_thunks = {0};
@@ -16,7 +16,7 @@
     assert(g_impl_thunks.Function);                                \
     return g_impl_thunks.Function ARGUMENTS;                       \
   }
-#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_autogen.h"
 #undef VISIT_GL_CALL
 
 extern "C" THUNK_EXPORT size_t
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h
index 47765f2..0d6f99a6 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_thunks.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 // Like MojoGLES2ControlThunks, but specifies the frozen GLES2 API. Separated
 // out as MojoGLES2ControlThunks may be modified and added to, but this
@@ -18,7 +18,7 @@
 
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
   ReturnType(GL_APIENTRY *Function) PARAMETERS;
-#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_autogen.h"
 #undef VISIT_GL_CALL
 };
 #pragma pack(pop)
@@ -29,7 +29,7 @@
   MojoGLES2ImplThunks gles2_impl_thunks = {
       sizeof(MojoGLES2ImplThunks),
 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
-#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_autogen.h"
 #undef VISIT_GL_CALL
   };
 
@@ -46,4 +46,4 @@
 typedef size_t (*MojoSetGLES2ImplThunksFn)(
     const MojoGLES2ImplThunks* gles2_impl_thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
index b51de76..86f8ed7 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/gles2_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 extern "C" {
 
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
index c9d30f5..995c8c9 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/gles2/gles2.h"
+#include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
 
 // Structure used to bind the interface which manipulates GLES2 surfaces to a
 // DSO to theose of the embedder.
@@ -64,4 +64,4 @@
 typedef size_t (*MojoSetGLES2ControlThunksFn)(
     const MojoGLES2ControlThunks* gles2_control_thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c
index c41b583b6..5b72fcd8 100644
--- a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/mgl_onscreen_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 static struct MGLOnscreenThunks g_onscreen_thunks = {0};
 
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h
index 40dcb807..74068df 100644
--- a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
+#include "third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h"
 
 // Structure used to bind the interface which manipulates MGL contexts to a
 // DSO to theose of the embedder.
@@ -43,4 +43,4 @@
 typedef size_t (*MojoSetMGLOnscreenThunksFn)(
     const struct MGLOnscreenThunks* mgl_thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c
index 2e8e9d8..dccabe2e 100644
--- a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/mgl_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 static struct MGLThunks g_thunks = {0};
 
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h
index 8a56474..48fb75d3 100644
--- a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/gpu/MGL/mgl.h"
+#include "third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h"
 
 // Structure used to bind the interface which manipulates MGL contexts to a
 // DSO to theose of the embedder.
@@ -53,4 +53,4 @@
 // The contents of |mgl_thunks| are copied.
 typedef size_t (*MojoSetMGLThunksFn)(const struct MGLThunks* mgl_thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/system_thunks.cc
index ed3227f0..c1ec839 100644
--- a/third_party/mojo/src/mojo/public/platform/native/system_thunks.cc
+++ b/third_party/mojo/src/mojo/public/platform/native/system_thunks.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/platform/native/system_thunks.h"
+#include "third_party/mojo/src/mojo/public/platform/native/system_thunks.h"
 
 #include <assert.h>
 
-#include "mojo/public/platform/native/thunk_export.h"
+#include "third_party/mojo/src/mojo/public/platform/native/thunk_export.h"
 
 extern "C" {
 
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_thunks.h b/third_party/mojo/src/mojo/public/platform/native/system_thunks.h
index bb6ca964..fcb4ddd 100644
--- a/third_party/mojo/src/mojo/public/platform/native/system_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/system_thunks.h
@@ -4,12 +4,12 @@
 
 // Note: This header should be compilable as C.
 
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
 
 #include <stddef.h>
 
-#include "mojo/public/c/system/core.h"
+#include "third_party/mojo/src/mojo/public/c/system/core.h"
 
 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of
 // the embedder when loading a DSO that is dependent on mojo_system.
@@ -143,4 +143,4 @@
 typedef size_t (*MojoSetSystemThunksFn)(
     const struct MojoSystemThunks* system_thunks);
 
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/thunk_export.h b/third_party/mojo/src/mojo/public/platform/native/thunk_export.h
index d118fc5..9946c00 100644
--- a/third_party/mojo/src/mojo/public/platform/native/thunk_export.h
+++ b/third_party/mojo/src/mojo/public/platform/native/thunk_export.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_PLATFORM_THUNK_EXPORT_H_
-#define MOJO_PUBLIC_PLATFORM_THUNK_EXPORT_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_THUNK_EXPORT_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_THUNK_EXPORT_H_
 
 // Call this function by looking inside the resulting shared object and
 // grabbing the symbol manually.
@@ -15,4 +15,4 @@
 #define THUNK_EXPORT __attribute__((visibility("default")))
 #endif
 
-#endif // MOJO_PUBLIC_PLATFORM_THUNK_EXPORT_H_
+#endif // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_PLATFORM_NATIVE_THUNK_EXPORT_H_
diff --git a/third_party/mojo/src/mojo/public/tests/test_support_private.cc b/third_party/mojo/src/mojo/public/tests/test_support_private.cc
index 0081984..7035eb7 100644
--- a/third_party/mojo/src/mojo/public/tests/test_support_private.cc
+++ b/third_party/mojo/src/mojo/public/tests/test_support_private.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/public/tests/test_support_private.h"
+#include "third_party/mojo/src/mojo/public/tests/test_support_private.h"
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/third_party/mojo/src/mojo/public/tests/test_support_private.h b/third_party/mojo/src/mojo/public/tests/test_support_private.h
index d72e158..6a8d138 100644
--- a/third_party/mojo/src/mojo/public/tests/test_support_private.h
+++ b/third_party/mojo/src/mojo/public/tests/test_support_private.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
-#define MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
+#ifndef THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
+#define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
 
 #include <stdio.h>
 
-#include "mojo/public/c/test_support/test_support.h"
+#include "third_party/mojo/src/mojo/public/c/test_support/test_support.h"
 
 namespace mojo {
 namespace test {
@@ -34,4 +34,4 @@
 }  // namespace test
 }  // namespace mojo
 
-#endif  // MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
+#endif  // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_TESTS_TEST_SUPPORT_PRIVATE_H_
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
index 2d748fc9..59d9420a 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
@@ -8,11 +8,11 @@
 #ifndef {{header_guard}}
 #define {{header_guard}}
 
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/bindings/lib/buffer.h"
-#include "mojo/public/cpp/bindings/lib/union_accessor.h"
-#include "mojo/public/cpp/bindings/lib/value_traits.h"
-#include "mojo/public/cpp/bindings/struct_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/buffer.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/union_accessor.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/value_traits.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h"
 
 {%- for import in imports %}
 #include "{{import.module.path}}-internal.h"
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
index dddb6ab..04e8a17 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -17,19 +17,19 @@
 #include <math.h>
 
 #include "base/trace_event/trace_event.h"
-#include "mojo/public/cpp/bindings/lib/array_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
-#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
-#include "mojo/public/cpp/bindings/lib/map_serialization.h"
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/lib/string_serialization.h"
-#include "mojo/public/cpp/bindings/lib/validate_params.h"
-#include "mojo/public/cpp/bindings/lib/validation_errors.h"
-#include "mojo/public/cpp/bindings/lib/validation_util.h"
-#include "mojo/public/cpp/environment/lib/scoped_task_tracking.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/array_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bounds_checker.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_data_internal.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/map_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validate_params.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/lib/scoped_task_tracking.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
+#include "third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
 
 {%- for namespace in namespaces_as_array %}
 namespace {{namespace}} {
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
index b6ba1a3..05d018a 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -10,19 +10,19 @@
 
 #include <stdint.h>
 
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
-#include "mojo/public/cpp/bindings/associated_interface_request.h"
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
-#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
-#include "mojo/public/cpp/bindings/map.h"
-#include "mojo/public/cpp/bindings/message_filter.h"
-#include "mojo/public/cpp/bindings/no_interface.h"
-#include "mojo/public/cpp/bindings/string.h"
-#include "mojo/public/cpp/bindings/struct_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_ptr_info.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/associated_interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/map.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/message_filter.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/no_interface.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/struct_ptr.h"
 #include "{{module.path}}-internal.h"
 {%- for import in imports %}
 #include "{{import.module.path}}.h"
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni b/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
index 59f10666..9ef3198 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
+++ b/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
@@ -193,9 +193,6 @@
       data = process_file_template(invoker.sources, generator_js_outputs)
     }
 
-    public_configs =
-        rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
-
     public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root)
     if (defined(invoker.sources)) {
       public_deps += [ ":${cpp_sources_target_name}" ]
@@ -256,8 +253,6 @@
         testonly = invoker.testonly
       }
       sources = process_file_template(invoker.sources, generator_cpp_outputs)
-      public_configs =
-          rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
       deps = [
         ":$generator_target_name",
         "//base",
diff --git a/tools/gn/function_get_target_outputs_unittest.cc b/tools/gn/function_get_target_outputs_unittest.cc
index cd19d99..c947709 100644
--- a/tools/gn/function_get_target_outputs_unittest.cc
+++ b/tools/gn/function_get_target_outputs_unittest.cc
@@ -12,8 +12,6 @@
 class GetTargetOutputsTest : public testing::Test {
  public:
   GetTargetOutputsTest() {
-    // Want consistent target names so explicitly set platform.
-    setup_.settings()->set_target_os(Settings::LINUX);
     setup_.scope()->set_item_collector(&items_);
   }
 
diff --git a/tools/gn/ninja_action_target_writer_unittest.cc b/tools/gn/ninja_action_target_writer_unittest.cc
index a7dd21b4..38a175b 100644
--- a/tools/gn/ninja_action_target_writer_unittest.cc
+++ b/tools/gn/ninja_action_target_writer_unittest.cc
@@ -54,7 +54,6 @@
   target.SetToolchain(setup.toolchain());
   ASSERT_TRUE(target.OnResolved(&err));
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
@@ -96,7 +95,6 @@
   target.SetToolchain(setup.toolchain());
   ASSERT_TRUE(target.OnResolved(&err));
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
@@ -140,7 +138,6 @@
   target.SetToolchain(setup.toolchain());
   ASSERT_TRUE(target.OnResolved(&err));
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
@@ -206,7 +203,6 @@
   target.SetToolchain(setup.toolchain());
   ASSERT_TRUE(target.OnResolved(&err));
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
@@ -275,7 +271,6 @@
 
   target.inputs().push_back(SourceFile("//foo/included.txt"));
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
@@ -335,7 +330,6 @@
   target.action_values().outputs() = SubstitutionList::MakeForTest(
       "//out/Debug/{{source_name_part}}.out");
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
       "/usr/bin/python")));
 
diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc
index 64bf042..98c6f1d4 100644
--- a/tools/gn/ninja_binary_target_writer.cc
+++ b/tools/gn/ninja_binary_target_writer.cc
@@ -860,10 +860,9 @@
   const OrderedSet<std::string> all_libs = target_->all_libs();
   const std::string framework_ending(".framework");
   for (size_t i = 0; i < all_libs.size(); i++) {
-    if (settings_->IsMac() &&
-        base::EndsWith(all_libs[i], framework_ending,
+    if (base::EndsWith(all_libs[i], framework_ending,
                        base::CompareCase::INSENSITIVE_ASCII)) {
-      // Special-case libraries ending in ".framework" on Mac. Add the
+      // Special-case libraries ending in ".framework" to support Mac: Add the
       // -framework switch and don't add the extension to the output.
       out_ << " -framework ";
       EscapeStringToStream(out_,
diff --git a/tools/gn/ninja_binary_target_writer_unittest.cc b/tools/gn/ninja_binary_target_writer_unittest.cc
index 3de68e8..0765ba6 100644
--- a/tools/gn/ninja_binary_target_writer_unittest.cc
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc
@@ -15,7 +15,6 @@
   Err err;
 
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
-  setup.settings()->set_target_os(Settings::WIN);
 
   Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
   target.set_output_type(Target::SOURCE_SET);
@@ -152,7 +151,6 @@
   Err err;
 
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
-  setup.settings()->set_target_os(Settings::LINUX);
 
   // An action for our library to depend on.
   Target action(setup.settings(), Label(SourceDir("//foo/"), "action"));
@@ -208,7 +206,6 @@
   Err err;
 
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
-  setup.settings()->set_target_os(Settings::LINUX);
 
   // This test is the same as ProductExtension, except that
   // we call set_output_extension("") and ensure that we still get the default.
@@ -250,7 +247,6 @@
 TEST(NinjaBinaryTargetWriter, SourceSetDataDeps) {
   TestWithScope setup;
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
-  setup.settings()->set_target_os(Settings::LINUX);
 
   Err err;
 
@@ -332,7 +328,6 @@
 TEST(NinjaBinaryTargetWriter, SharedLibraryModuleDefinitionFile) {
   TestWithScope setup;
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
-  setup.settings()->set_target_os(Settings::WIN);
 
   Target shared_lib(setup.settings(), Label(SourceDir("//foo/"), "bar"));
   shared_lib.set_output_type(Target::SHARED_LIBRARY);
diff --git a/tools/gn/ninja_copy_target_writer_unittest.cc b/tools/gn/ninja_copy_target_writer_unittest.cc
index 12496bf..e6ec222 100644
--- a/tools/gn/ninja_copy_target_writer_unittest.cc
+++ b/tools/gn/ninja_copy_target_writer_unittest.cc
@@ -15,7 +15,6 @@
   TestWithScope setup;
   Err err;
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
   Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
   target.set_output_type(Target::COPY_FILES);
@@ -47,7 +46,6 @@
   TestWithScope setup;
   Err err;
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
   Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
   target.set_output_type(Target::COPY_FILES);
@@ -76,7 +74,6 @@
   TestWithScope setup;
   Err err;
 
-  setup.settings()->set_target_os(Settings::LINUX);
   setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
 
   Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
diff --git a/tools/gn/settings.cc b/tools/gn/settings.cc
index a5f90d6f..034e601 100644
--- a/tools/gn/settings.cc
+++ b/tools/gn/settings.cc
@@ -29,20 +29,6 @@
   // one-off data without doing generation.
   if (!toolchain_output_dir_.is_null())
     toolchain_gen_dir_ = SourceDir(toolchain_output_dir_.value() + "gen/");
-
-#if defined(OS_WIN)
-  target_os_ = WIN;
-#elif defined(OS_MACOSX)
-  target_os_ = MAC;
-#elif defined(OS_LINUX)
-  target_os_ = LINUX;
-#elif defined(OS_ANDROID)
-  // Currently we don't have an "Android" target OS, it looks just like Linux
-  // from our perspective.
-  target_os_ = LINUX;
-#else
-  #error implement me
-#endif
 }
 
 Settings::~Settings() {
diff --git a/tools/gn/settings.h b/tools/gn/settings.h
index e66a13f6..e07ee2e 100644
--- a/tools/gn/settings.h
+++ b/tools/gn/settings.h
@@ -26,13 +26,6 @@
 // the file with the toolchain declaration in it.
 class Settings {
  public:
-  enum TargetOS {
-    UNKNOWN,
-    LINUX,
-    MAC,
-    WIN
-  };
-
   // Constructs a toolchain settings.
   //
   // The output_subdir_name is the name we should use for the subdirectory in
@@ -60,13 +53,6 @@
     return toolchain_label_ == default_toolchain_label_;
   }
 
-  bool IsMac() const { return target_os_ == MAC; }
-  bool IsLinux() const { return target_os_ == LINUX; }
-  bool IsWin() const { return target_os_ == WIN; }
-
-  TargetOS target_os() const { return target_os_; }
-  void set_target_os(TargetOS t) { target_os_ = t; }
-
   const OutputFile& toolchain_output_subdir() const {
     return toolchain_output_subdir_;
   }
@@ -106,8 +92,6 @@
   Label toolchain_label_;
   Label default_toolchain_label_;
 
-  TargetOS target_os_;
-
   mutable ImportManager import_manager_;
 
   // The subdirectory inside the build output for this toolchain. For the
diff --git a/tools/gn/variables.cc b/tools/gn/variables.cc
index 5a9b840..aa4de36 100644
--- a/tools/gn/variables.cc
+++ b/tools/gn/variables.cc
@@ -880,9 +880,12 @@
     "  When constructing the linker command, the \"lib_prefix\" attribute of\n"
     "  the linker tool in the current toolchain will be prepended to each\n"
     "  library. So your BUILD file should not specify the switch prefix\n"
-    "  (like \"-l\"). On Mac, libraries ending in \".framework\" will be\n"
-    "  special-cased: the switch \"-framework\" will be prepended instead of\n"
-    "  the lib_prefix, and the \".framework\" suffix will be trimmed.\n"
+    "  (like \"-l\").\n"
+    "\n"
+    "  Libraries ending in \".framework\" will be special-cased: the switch\n"
+    "  \"-framework\" will be prepended instead of the lib_prefix, and the\n"
+    "  \".framework\" suffix will be trimmed. This is to support the way Mac\n"
+    "  links framework dependencies.\n"
     COMMON_LIB_INHERITANCE_HELP
     COMMON_ORDERING_HELP
     "\n"
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl
index 259a0161..c112242 100644
--- a/tools/mb/mb_config.pyl
+++ b/tools/mb/mb_config.pyl
@@ -36,6 +36,7 @@
     'gn_debug_bot_minimal_symbols_x86': ['gn', 'debug_bot_minimal_symbols', 'x86'],
     'gn_debug_static_bot': ['gn', 'debug_static_bot'],
     'gn_linux_upload': ['gn_linux_upload', 'official', 'goma'],
+    'gn_official': ['gn', 'official'],
     'gn_official_goma': ['gn', 'official', 'goma'],
     'gn_release_bot': ['gn', 'release_bot'],
     'gn_release_bot_minimal_symbols': ['gn', 'release_bot_minimal_symbols'],
@@ -44,7 +45,6 @@
     'gn_release_trybot_x86': ['gn', 'release_trybot', 'x86'],
     'gyp_debug_bot': ['gyp', 'debug_bot'],
     'gyp_debug_bot_x86': ['gyp', 'debug_bot', 'x86'],
-    'gyp_official': ['gyp', 'official'],
     'gyp_official_goma': ['gyp', 'official', 'goma'],
     'gyp_official_goma_chromeos': ['gyp', 'official', 'goma', 'chromeos'],
     'gyp_official_goma_x86': ['gyp', 'official', 'goma', 'x86'],
@@ -348,7 +348,7 @@
   # TODO(crbug.com/481692): Add in remaining bots on the waterfalls.
   'masters': {
     'chrome': {
-      'precise64': 'gyp_official',
+      'precise64': 'gn_official',
     },
     'chromium': {
       'Win': 'noswarming_gyp_release_bot',
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 7ba8957..ec96f5e5 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -2367,6 +2367,14 @@
   </summary>
 </histogram>
 
+<histogram name="Autofill.PayloadCompressionRatio" units="%">
+  <owner>mathp@chromium.org</owner>
+  <summary>
+    Compression ratio of the query and upload payload that are sent to the
+    Autofill server. The payload is compressed using gzip.
+  </summary>
+</histogram>
+
 <histogram name="Autofill.ProfileActionOnFormSubmitted"
     enum="AutofillProfileAction">
   <owner>sebsg@chromium.org</owner>
@@ -4114,7 +4122,7 @@
 </histogram>
 
 <histogram name="ChromeOS.GAIA.WebViewFlow" enum="BooleanGAIAWebViewFlow">
-  <owner>ginkage@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Whether a user signed in using the new WebView-based GAIA flow. This value
     is sent after the GAIA screen has completed user authentication.
@@ -13062,7 +13070,7 @@
 </histogram>
 
 <histogram name="Extensions.SandboxUnpackHashCheck" enum="BooleanValidHashSum">
-  <owner>ginkage@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Whether a CRX file hash sum was the same as in an updater manifest.
   </summary>
@@ -17357,12 +17365,13 @@
 </histogram>
 
 <histogram name="Login.FailureReason" enum="LoginFailureReason">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>Chrome OS login failure reason.</summary>
 </histogram>
 
 <histogram name="Login.LeastUsedAccountDays" units="days">
-  <owner>antrim@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
+  <owner>omrilio@chromium.org</owner>
   <summary>
     Chrome OS histogram that keeps track of the days since the least frequently
     used account signed in. Reported on every boot and once a day after that.
@@ -17389,7 +17398,7 @@
 </histogram>
 
 <histogram name="Login.PromptToCompleteLoginTime" units="milliseconds">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Time from first display of the login prompt until the user completes signing
     in.
@@ -17397,7 +17406,7 @@
 </histogram>
 
 <histogram name="Login.ReauthReason" enum="LoginReauthReasons">
-  <owner>ginkage@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Tracks the reason why a user was sent through the GAIA re-auth flow.
   </summary>
@@ -17410,7 +17419,7 @@
 </histogram>
 
 <histogram name="Login.SuccessReason" enum="LoginSuccessReason">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>Chrome OS login success reason.</summary>
 </histogram>
 
@@ -17432,7 +17441,7 @@
 
 <histogram name="Login.UsersActiveWeekly" units="users">
   <owner>alemate@chromium.org</owner>
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Chrome OS histogram that keeps track of number of users who have logged in
     in the last 7 days. Reported on every boot and once a day after that.
@@ -17441,7 +17450,7 @@
 
 <histogram name="Login.UsersActiveWeekly.Percent" units="%">
   <owner>alemate@chromium.org</owner>
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Chrome OS histogram that keeps track of percentage of local users who have
     logged in in the last 7 days. Reported on every boot and once a day after
@@ -17459,7 +17468,7 @@
 
 <histogram name="ManagedUsers.ChromeOS.PasswordChange"
     enum="ManagedUserPasswordChange">
-  <owner>antrim@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Chrome OS histogram that keeps track of supervised user password change
     result.
@@ -26071,6 +26080,9 @@
 
 <histogram name="Net.SSL_Connection_Latency_Google_No_Revocation_Checking"
     units="milliseconds">
+  <obsolete>
+    Removed in 2011.
+  </obsolete>
   <owner>agl@chromium.org</owner>
   <summary>
     Time from when the Connect() starts until it completes for google.com and
@@ -26081,6 +26093,9 @@
 
 <histogram name="Net.SSL_Connection_Latency_Google_Revocation_Checking"
     units="milliseconds">
+  <obsolete>
+    Removed in 2011.
+  </obsolete>
   <owner>agl@chromium.org</owner>
   <summary>
     Time from when the Connect() starts until it completes for google.com and
@@ -26198,11 +26213,17 @@
 </histogram>
 
 <histogram name="Net.SSLHostInfoDNSLookup" units="milliseconds">
+  <obsolete>
+    Removed in 2011.
+  </obsolete>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>Time to complete a DNS lookup for a DNS CAA record.</summary>
 </histogram>
 
 <histogram name="Net.SSLHostInfoDNSLookupDelayMs" units="milliseconds">
+  <obsolete>
+    Removed in 2011.
+  </obsolete>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>
     Time that we would have wasted had we waited for a CAA lookup in order to
@@ -26211,6 +26232,9 @@
 </histogram>
 
 <histogram name="Net.SSLHostInfoVerificationTimeMs" units="milliseconds">
+  <obsolete>
+    Removed in 2012.
+  </obsolete>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>Time to complete a speculative certificate verification.</summary>
 </histogram>
@@ -26224,8 +26248,19 @@
   </summary>
 </histogram>
 
+<histogram name="Net.SSLServerKeyExchangeHash" enum="SSLHashAlgorithm">
+  <owner>davidben@chromium.org</owner>
+  <summary>
+    For each SSL connection with a full handshake using a DHE- or ECDHE-based
+    key exchange, the hash function used in the ServerKeyExchange signature.
+  </summary>
+</histogram>
+
 <histogram name="Net.SSLSessionVersionMatch" enum="BooleanMatched">
   <owner>davidben@chromium.org</owner>
+  <obsolete>
+    Removed on 2015-11-10.
+  </obsolete>
   <summary>
     For each SSL connection that resumed a session, whether the session was
     resumed at the same version it was established at. This is only recorded in
@@ -26246,11 +26281,17 @@
 </histogram>
 
 <histogram name="Net.SSLVerificationMerged">
+  <obsolete>
+    Removed in 2012.
+  </obsolete>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>Was a speculative certificate verification used?</summary>
 </histogram>
 
 <histogram name="Net.SSLVerificationMergedMsSaved" units="milliseconds">
+  <obsolete>
+    Removed in 2012.
+  </obsolete>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>Time saved by a speculative certificate vertification.</summary>
 </histogram>
@@ -30272,31 +30313,31 @@
 </histogram>
 
 <histogram name="OOBE.ErrorScreensTime.Enrollment" units="milliseconds">
-  <owner>rsorokin@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Time spent on error screens during enrollment or autoenrollment.
   </summary>
 </histogram>
 
 <histogram name="OOBE.ErrorScreensTime.Signin" units="milliseconds">
-  <owner>rsorokin@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>Time spent on error screens during signin.</summary>
 </histogram>
 
 <histogram name="OOBE.ErrorScreensTime.Supervised" units="milliseconds">
-  <owner>rsorokin@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Time spent on error screens during supervised user creation.
   </summary>
 </histogram>
 
 <histogram name="OOBE.ErrorScreensTime.Update" units="milliseconds">
-  <owner>rsorokin@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>Time spent on error screens during update.</summary>
 </histogram>
 
 <histogram name="OOBE.NetworkErrorShown.Enrollment" enum="NetworkErrorType">
-  <owner>rsorokin@google.com</owner>
+  <owner>achuith@google.com</owner>
   <summary>
     Number of times error screen has appeared during enrollment or
     autoenrollment.
@@ -30304,19 +30345,19 @@
 </histogram>
 
 <histogram name="OOBE.NetworkErrorShown.Signin" enum="NetworkErrorType">
-  <owner>rsorokin@google.com</owner>
+  <owner>achuith@google.com</owner>
   <summary>Number of times error screen has appeared during signin.</summary>
 </histogram>
 
 <histogram name="OOBE.NetworkErrorShown.Supervised" enum="NetworkErrorType">
-  <owner>rsorokin@google.com</owner>
+  <owner>achuith@google.com</owner>
   <summary>
     Number of times error screen has appeared during supervised user creation.
   </summary>
 </histogram>
 
 <histogram name="OOBE.NetworkErrorShown.Update" enum="NetworkErrorType">
-  <owner>rsorokin@google.com</owner>
+  <owner>achuith@google.com</owner>
   <summary>Number of times error screen has appeared during update.</summary>
 </histogram>
 
@@ -31796,7 +31837,8 @@
 </histogram>
 
 <histogram name="Platform.DiskUsage.OldestUserOnDevice">
-  <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
+  <owner>achuith@chromium.org</owner>
+  <owner>omrilio@chromium.org</owner>
   <summary>
     Days since last login of the least recently user on device. Logged once a
     day, if disk usage is high.
@@ -31804,7 +31846,8 @@
 </histogram>
 
 <histogram name="Platform.DiskUsage.UsersOnDevice">
-  <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
+  <owner>achuith@chromium.org</owner>
+  <owner>omrilio@chromium.org</owner>
   <summary>
     Number of user home dirs on device. Logged once a day, if disk usage is
     high.
@@ -32110,7 +32153,8 @@
 </histogram>
 
 <histogram name="Platform.StatefulUsage" units="%">
-  <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
+  <owner>achuith@chromium.org</owner>
+  <owner>omrilio@chromium.org</owner>
   <summary>Chrome OS stateful partition usage level.</summary>
 </histogram>
 
@@ -49565,7 +49609,7 @@
 </histogram>
 
 <histogram name="UserImage.ChangeChoice" enum="ChromeOSUserImageId">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Distribution of the default images that users choose in Change Picture
     dialog (Chrome OS). One sample is taken each time the user changes picture.
@@ -49573,7 +49617,7 @@
 </histogram>
 
 <histogram name="UserImage.FirstTimeChoice" enum="ChromeOSUserImageId">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Distribution of the default images chosen on user image screen during
     out-of-the-box experience (Chrome OS). One sample is taken each time the
@@ -49582,7 +49626,7 @@
 </histogram>
 
 <histogram name="UserImage.LoggedIn" enum="ChromeOSUserImageId">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Distribution of the default images that existing users login with (Chrome
     OS). One sample is taken each time the user logs in.
@@ -49591,7 +49635,7 @@
 
 <histogram name="UserImage.ProfileDownloadResult"
     enum="ProfileImageDownloadResult">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Profile image download result for UserManager (either on behalf of the
     Change Picture prefs page, OOBE or scheduled refresh after user login).
@@ -49599,19 +49643,19 @@
 </histogram>
 
 <histogram name="UserImage.ProfileDownloadTime" units="milliseconds">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>The time it took to download user's profile picture.</summary>
 </histogram>
 
 <histogram name="UserImage.ScreenIsShownTime" units="milliseconds">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Time histogram of the &quot;Choose Picture&quot; OOBE screen display delay.
   </summary>
 </histogram>
 
 <histogram name="UserManager.LoginUserType" enum="UserType">
-  <owner>nkostylev@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     The number of users of different types that log in to the system (Chrome
     OS).
@@ -49620,7 +49664,7 @@
 
 <histogram name="UserManager.LogoutToLoginDelay" units="seconds">
   <owner>alemate@chromium.org</owner>
-  <owner>nkostylev@chromium.org</owner>
+  <owner>omrilio@chromium.org</owner>
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>
     The time between one regular user logging out and a different regular user
@@ -49630,7 +49674,7 @@
 </histogram>
 
 <histogram name="UserSessionManager.UserPodsDisplay" enum="UserPodsDisplay">
-  <owner>ginkage@chromium.org</owner>
+  <owner>achuith@chromium.org</owner>
   <summary>
     Whether the user pods were enabled during login, and what could disable
     them.
@@ -50892,6 +50936,15 @@
   </summary>
 </histogram>
 
+<histogram name="WebCore.DistillabilityUs" units="microseconds">
+  <owner>wychen@chromium.org</owner>
+  <summary>
+    The time spent on collecting the statistics of the document in the main
+    frame. These statistics would be used as features to classify whether the
+    page is suitable for DOM distiller.
+  </summary>
+</histogram>
+
 <histogram name="WebCore.Document.execCommand" enum="MappedEditingCommands">
   <owner>yoichio@chromium.org</owner>
   <summary>
@@ -64559,13 +64612,18 @@
   <int value="7" label="ERROR_SET_ATTRIBUTES">
     Couldn't change the attributes of a Mach port.
   </int>
-  <int value="8" label="ERROR_EXTRACT_RIGHT">Couldn't extract a right.</int>
+  <int value="8" label="ERROR_EXTRACT_RIGHT_DEST">
+    Couldn't extract a right from the destination process.
+  </int>
   <int value="9" label="ERROR_SEND_MACH_PORT">
     Couldn't send a Mach port in a call to mach_msg().
   </int>
   <int value="10" label="ERROR_DECREASE_REF">
     Couldn't decrease the ref count on a Mach port.
   </int>
+  <int value="11" label="ERROR_EXTRACT_RIGHT_SOURCE">
+    Couldn't extract a right from the source process.
+  </int>
 </enum>
 
 <enum name="IPCAttachmentBrokerUnprivilegedBrokerAttachmentError" type="int">
@@ -67830,6 +67888,10 @@
   <int value="14" label="Show Cached Copy button clicked"/>
   <int value="15" label="Show Cached Page button shown"/>
   <int value="16" label="Show Cached Page button clicked"/>
+  <int value="17" label="Diagnose button clicked"/>
+  <int value="18" label="Show Saved Pages Button Shown"/>
+  <int value="19" label="Show Saved Pages Button Clicked"/>
+  <int value="20" label="Show Saved Pages Button Click Load Error"/>
 </enum>
 
 <enum name="NetInternalsUiFeature" type="int">
@@ -74238,6 +74300,16 @@
   <int value="1" label="HAD_PREVIOUS_EXCEPTION"/>
 </enum>
 
+<enum name="SSLHashAlgorithm" type="int">
+  <int value="0" label="None (unused)"/>
+  <int value="1" label="MD5"/>
+  <int value="2" label="SHA-1"/>
+  <int value="3" label="SHA-224"/>
+  <int value="4" label="SHA-256"/>
+  <int value="5" label="SHA-384"/>
+  <int value="6" label="SHA-512"/>
+</enum>
+
 <enum name="SSLIsExpiredAndDecision" type="int">
   <int value="0" label="EXPIRED_AND_PROCEED"/>
   <int value="1" label="EXPIRED_AND_DO_NOT_PROCEED"/>
@@ -76670,6 +76742,12 @@
   <affected-histogram name="Autofill.FormEvents.CreditCard"/>
 </histogram_suffixes>
 
+<histogram_suffixes name="AutofillPayloadCompressionType" separator=".">
+  <suffix name="Query" label="Query request compression"/>
+  <suffix name="Upload" label="Upload request compression"/>
+  <affected-histogram name="Autofill.PayloadCompressionRatio"/>
+</histogram_suffixes>
+
 <histogram_suffixes name="AutofillRealPanResultGroups" separator=".">
   <suffix name="Failure" label="Failure"/>
   <suffix name="NetworkError" label="Network errors"/>
diff --git a/tools/valgrind/gtest_exclude/content_unittests.gtest-drmemory_win32.txt b/tools/valgrind/gtest_exclude/content_unittests.gtest-drmemory_win32.txt
index 4837afa..570acc3 100644
--- a/tools/valgrind/gtest_exclude/content_unittests.gtest-drmemory_win32.txt
+++ b/tools/valgrind/gtest_exclude/content_unittests.gtest-drmemory_win32.txt
@@ -11,3 +11,7 @@
 # http://crbug.com/522049
 RenderWidgetCompositorOutputSurfaceTest.SucceedTwice
 RenderWidgetCompositorOutputSurfaceTest.FallbackSuccessNormalSuccess
+
+# http://crbug.com/554665
+WebContentsVideoCaptureDeviceTest.VariableResolution_AnyWithinLimits
+WebContentsVideoCaptureDeviceTest.VariableResolution_FixedAspectRatio
diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc
index 2a5bd29..4a48018 100644
--- a/ui/base/win/shell.cc
+++ b/ui/base/win/shell.cc
@@ -97,15 +97,17 @@
 }
 
 bool PreventWindowFromPinning(HWND hwnd) {
+  DCHECK(hwnd);
+
   // This functionality is only available on Win7+. It also doesn't make sense
   // to do this for Chrome Metro.
   if (base::win::GetVersion() < base::win::VERSION_WIN7 ||
       base::win::IsMetroProcess())
     return false;
+
   base::win::ScopedComPtr<IPropertyStore> pps;
-  HRESULT result = SHGetPropertyStoreForWindow(
-      hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
-  if (FAILED(result))
+  if (FAILED(SHGetPropertyStoreForWindow(hwnd,
+                                         IID_PPV_ARGS(pps.Receive()))))
     return false;
 
   return base::win::SetBooleanValueForPropertyStore(
@@ -119,31 +121,34 @@
                             const base::string16& relaunch_command,
                             const base::string16& relaunch_display_name,
                             HWND hwnd) {
+  DCHECK(hwnd);
+
   // This functionality is only available on Win7+. It also doesn't make sense
   // to do this for Chrome Metro.
   if (base::win::GetVersion() < base::win::VERSION_WIN7 ||
       base::win::IsMetroProcess())
     return;
+
   base::win::ScopedComPtr<IPropertyStore> pps;
-  HRESULT result = SHGetPropertyStoreForWindow(
-      hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
-  if (S_OK == result) {
-    if (!app_id.empty())
-      base::win::SetAppIdForPropertyStore(pps.get(), app_id.c_str());
-    if (!app_icon.empty()) {
-      base::win::SetStringValueForPropertyStore(
-          pps.get(), PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str());
-    }
-    if (!relaunch_command.empty()) {
-      base::win::SetStringValueForPropertyStore(
-          pps.get(), PKEY_AppUserModel_RelaunchCommand,
-          relaunch_command.c_str());
-    }
-    if (!relaunch_display_name.empty()) {
-      base::win::SetStringValueForPropertyStore(
-          pps.get(), PKEY_AppUserModel_RelaunchDisplayNameResource,
-          relaunch_display_name.c_str());
-    }
+  if (FAILED(SHGetPropertyStoreForWindow(hwnd,
+                                         IID_PPV_ARGS(pps.Receive()))))
+    return;
+
+  if (!app_id.empty())
+    base::win::SetAppIdForPropertyStore(pps.get(), app_id.c_str());
+  if (!app_icon.empty()) {
+    base::win::SetStringValueForPropertyStore(
+        pps.get(), PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str());
+  }
+  if (!relaunch_command.empty()) {
+    base::win::SetStringValueForPropertyStore(
+        pps.get(), PKEY_AppUserModel_RelaunchCommand,
+        relaunch_command.c_str());
+  }
+  if (!relaunch_display_name.empty()) {
+    base::win::SetStringValueForPropertyStore(
+        pps.get(), PKEY_AppUserModel_RelaunchDisplayNameResource,
+        relaunch_display_name.c_str());
   }
 }
 
@@ -173,6 +178,34 @@
                          hwnd);
 }
 
+void ClearWindowPropertyStore(HWND hwnd) {
+  DCHECK(hwnd);
+
+  // This functionality is only available on Win7+. It also doesn't make sense
+  // to do this for Chrome Metro.
+  if (base::win::GetVersion() < base::win::VERSION_WIN7 ||
+      base::win::IsMetroProcess())
+    return;
+
+  base::win::ScopedComPtr<IPropertyStore> pps;
+  if (FAILED(SHGetPropertyStoreForWindow(hwnd,
+                                         IID_PPV_ARGS(pps.Receive()))))
+    return;
+
+  DWORD property_count;
+  if (FAILED(pps->GetCount(&property_count)))
+    return;
+
+  PROPVARIANT empty_property_variant = {};
+  for (DWORD i = 0; i < property_count; i++) {
+    PROPERTYKEY key;
+    if (SUCCEEDED(pps->GetAt(i, &key)))
+      pps->SetValue(key, empty_property_variant);
+  }
+
+  pps->Commit();
+}
+
 bool IsAeroGlassEnabled() {
   // For testing in Win8 (where it is not possible to disable composition) the
   // user can specify this command line switch to mimic the behavior.  In this
diff --git a/ui/base/win/shell.h b/ui/base/win/shell.h
index 4031de6..458074c6 100644
--- a/ui/base/win/shell.h
+++ b/ui/base/win/shell.h
@@ -76,6 +76,9 @@
     const base::string16& display_name,
     HWND hwnd);
 
+// Clears the Window Property Store on an HWND.
+UI_BASE_EXPORT void ClearWindowPropertyStore(HWND hwnd);
+
 // Returns true if composition is available and turned on on the current
 // platform.
 UI_BASE_EXPORT bool IsAeroGlassEnabled();
diff --git a/ui/views/mus/DEPS b/ui/views/mus/DEPS
index 6ddcc645..3dd2a940 100644
--- a/ui/views/mus/DEPS
+++ b/ui/views/mus/DEPS
@@ -10,6 +10,7 @@
   "+mojo/converters",
   "+mojo/public",
   "+skia",
+  "+third_party/mojo/src/mojo/public",
   "+ui/aura",
   "+ui/base",
   "+ui/compositor",
diff --git a/ui/views/mus/surface_binding.cc b/ui/views/mus/surface_binding.cc
index 2c6220b..90484bbf2 100644
--- a/ui/views/mus/surface_binding.cc
+++ b/ui/views/mus/surface_binding.cc
@@ -23,7 +23,7 @@
 #include "mojo/application/public/interfaces/shell.mojom.h"
 #include "mojo/converters/geometry/geometry_type_converters.h"
 #include "mojo/converters/surfaces/surfaces_type_converters.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 #include "ui/views/mus/window_tree_host_mus.h"
 
 namespace views {