diff --git a/DEPS b/DEPS
index 072975d..335af88e 100644
--- a/DEPS
+++ b/DEPS
@@ -48,7 +48,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling ANGLE
   # and whatever else without interference from each other.
-  'angle_revision': 'f178d0bdd19377f8fabd856b118e165803af2fc6',
+  'angle_revision': 'ed0ab661b141d5b5d1793728eb1049526856b8d7',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling build tools
   # and whatever else without interference from each other.
diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn
index 5b0f6b6..597b4cd5 100644
--- a/content/gpu/BUILD.gn
+++ b/content/gpu/BUILD.gn
@@ -20,7 +20,12 @@
   }
 }
 
-source_set("gpu_sources") {
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "static_library"
+}
+target(link_target_type, "gpu_sources") {
   # This is an internal content API. Code outside of the content "component"
   # (like content/test and content/shell) should depend on ":gpu" above.
   visibility = [ "//content/*" ]
diff --git a/content/public/gpu/BUILD.gn b/content/public/gpu/BUILD.gn
index de4f504..654b19a1 100644
--- a/content/public/gpu/BUILD.gn
+++ b/content/public/gpu/BUILD.gn
@@ -15,7 +15,12 @@
   }
 }
 
-source_set("gpu_sources") {
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "static_library"
+}
+target(link_target_type, "gpu_sources") {
   # You must depend on this via //content/public/gpu above for the component
   # build to work properly.
   visibility = [ "//content/*" ]
diff --git a/content/test/data/indexeddb/database_callbacks_first.html b/content/test/data/indexeddb/database_callbacks_first.html
index 7410e02..2e4331a 100644
--- a/content/test/data/indexeddb/database_callbacks_first.html
+++ b/content/test/data/indexeddb/database_callbacks_first.html
@@ -4,7 +4,7 @@
       // Collect the IDBRequest so that only the indexeddb message dispatcher
       // has a reference to IDBDatabase.
       gc();
-      // Make Document::detach run stopActiveDOMObjects.
+      // Make Document::detachLayoutTree run stopActiveDOMObjects.
       location.href = 'database_callbacks_second.html';
     }
     function openConnection() {
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
index 3887e7f..bb90bf65 100644
--- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -40,10 +40,6 @@
     # All platforms.
     self.Flaky('conformance2/query/occlusion-query.html', bug=603168)
 
-    # Avoid a conflict with a Mac expectation by setting
-    self.Fail('conformance2/textures/misc/tex-input-validation.html',
-        ['d3d9', 'd3d11', 'opengl'], bug=483282)
-
     # All platforms with AMD GPU.
     self.Fail('deqp/functional/gles3/multisample.html',
         ['amd'], bug=617290)
@@ -52,31 +48,8 @@
     self.Fail('conformance/glsl/bugs/' +
         'pow-of-small-constant-in-user-defined-function.html',
         ['win'], bug=485641)
-    self.Fail('conformance/misc/uninitialized-test.html',
-        ['win'], bug=483282)
     self.Fail('conformance/rendering/point-specific-shader-variables.html',
         ['win'], bug=616335)
-    self.Fail('conformance/textures/webgl_canvas/' +
-        'tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html',
-        ['win'], bug=483282)
-    self.Fail('conformance/textures/webgl_canvas/' +
-        'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html',
-        ['win'], bug=483282)
-    self.Fail('conformance/textures/webgl_canvas/' +
-        'tex-2d-rgb-rgb-unsigned_short_5_6_5.html',
-        ['win'], bug=483282)
-    self.Fail('conformance/textures/image_bitmap_from_canvas/' +
-        'tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html',
-        ['win'], bug=628954)
-    self.Fail('conformance/textures/image_bitmap_from_canvas/' +
-        'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html',
-        ['win'], bug=628954)
-    self.Fail('conformance/textures/image_bitmap_from_canvas/' +
-        'tex-2d-rgb-rgb-unsigned_short_5_6_5.html',
-        ['win'], bug=628954)
-
-    self.Fail('deqp/data/gles2/shaders/functions.html',
-        ['win'], bug=478572)
 
     # ANGLE bug id
     self.Fail('deqp/functional/gles3/fboinvalidate/sub.html',
@@ -89,8 +62,6 @@
     # La la la la la la la la la la ...
 
     # Win / AMD
-    self.Fail('deqp/functional/gles3/fbomultisample.8_samples.html',
-        ['win', ('amd', 0x6779)], bug=483282)
     self.Fail('deqp/functional/gles3/texturespecification/' +
         'texstorage2d_format_depth_stencil.html',
         ['win', ('amd', 0x6779)], bug=614178)
@@ -105,8 +76,6 @@
     self.Fail('deqp/functional/gles3/shadertexturefunction/texturesize.html',
         ['win', ('amd', 0x6779)], bug=483282)
 
-    self.Fail('deqp/functional/gles3/framebufferblit/rect_02.html',
-        ['win', ('amd', 0x6779)], bug=483282)
     self.Fail('deqp/functional/gles3/textureshadow/2d*',
         ['win', ('amd', 0x6779)], bug=483282)
     self.Fail('deqp/functional/gles3/textureshadow/cube*',
@@ -115,6 +84,11 @@
     self.Fail('deqp/functional/gles3/transformfeedback/*',
         ['win', ('amd', 0x6779)], bug=626068)
 
+    self.Fail('deqp/functional/gles3/shadercommonfunction.html',
+        ['win', ('amd', 0x6779)], bug=483282)
+    self.Fail('deqp/functional/gles3/fbomultisample.8_samples.html',
+        ['win', ('amd', 0x6779)], bug=483282)
+
     # It's unfortunate that these suppressions need to be so broad, but
     # basically any test that uses readPixels is potentially flaky, and
     # it's infeasible to suppress individual failures one by one.
@@ -168,8 +142,6 @@
         ['win', 'intel'], bug=483282)
     self.Fail('deqp/functional/gles3/uniformbuffers/*.html',
         ['win', 'intel'], bug=483282)
-    self.Fail('deqp/functional/gles3/framebufferblit/rect_02.html',
-        ['win', 'intel'], bug=483282)
     self.Fail('deqp/functional/gles3/textureshadow/2d_array_*.html',
         ['win', 'intel'], bug=483282)
     self.Fail('conformance2/rendering/uniform-block-buffer-size.html',
@@ -376,6 +348,10 @@
     self.Fail('deqp/functional/gles3/negativeshaderapi.html',
         ['mac', ('nvidia', 0xfe9)], bug=483282)
 
+    self.Flaky('deqp/functional/gles3/vertexarrays/' +
+        'multiple_attributes.output.html',
+        ['mac', ('nvidia', 0xfe9)], bug=483282)
+
     # Mac AMD
     self.Fail('deqp/functional/gles3/clipping.html',
         ['mac', 'amd'], bug=483282)
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
index 40fd92e..843c66f 100644
--- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -526,7 +526,6 @@
     # TexSubImage2D have to match the current texture's.
     self.Fail('conformance/textures/misc/tex-sub-image-2d-bad-args.html',
         bug=570453)
-    self.Fail('deqp/data/gles2/shaders/preprocessor.html', bug=483282)
 
     self.Fail('conformance/extensions/webgl-draw-buffers.html',
         bug=625365)
@@ -552,22 +551,21 @@
     self.Fail('conformance/glsl/constructors/' +
               'glsl-construct-vec-mat-index.html',
               ['win'], bug=525188)
-    self.Flaky('deqp/data/gles2/shaders/constants.html', ['win'], bug=594922)
     self.Fail('conformance/rendering/point-specific-shader-variables.html',
         ['win'], bug=616335)
+    self.Fail('deqp/data/gles2/shaders/functions.html',
+        ['win'], bug=478572)
 
     # Win NVIDIA failures
-    self.Fail('deqp/data/gles2/shaders/functions.html',
-        ['win', 'nvidia'], bug=478572)
     self.Flaky('conformance/textures/misc/texture-npot-video.html',
         ['win', 'nvidia'], bug=626524)
+    self.Flaky('conformance/textures/misc/texture-upload-size.html',
+        ['win', 'nvidia'], bug=630860)
 
     # Win7 / Intel failures
     self.Fail('conformance/textures/misc/' +
               'copy-tex-image-and-sub-image-2d.html',
               ['win7', 'intel'])
-    self.Fail('deqp/data/gles2/shaders/functions.html',
-        ['win7', 'intel'], bug=478572)
 
     # Win / AMD flakiness seen on new tryservers.
     # It's unfortunate that this suppression needs to be so broad, but
@@ -576,8 +574,6 @@
     self.Flaky('conformance/*', ['win', ('amd', 0x6779)], bug=491419)
 
     # Win AMD failures
-    self.Fail('deqp/data/gles2/shaders/functions.html',
-        ['win', 'amd'], bug=478572)
 
     # Win / AMD D3D9 failures
     self.Fail('conformance/extensions/angle-instanced-arrays.html',
@@ -598,6 +594,8 @@
         ['win', 'd3d9'], bug=415609)
     self.Flaky('conformance/glsl/matrices/glsl-mat4-to-mat3.html',
         ['win', 'd3d9'], bug=617148)
+    self.Flaky('conformance/glsl/matrices/glsl-mat3-construction.html',
+        ['win', 'd3d9'], bug=617148)
 
     # WIN / D3D9 / Intel failures
     self.Fail('conformance/ogles/GL/cos/cos_001_to_006.html',
diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js
index 263e4dd7..5d81c45 100644
--- a/extensions/renderer/resources/media_router_bindings.js
+++ b/extensions/renderer/resources/media_router_bindings.js
@@ -470,7 +470,7 @@
     /**
      * @type {function(string)}
      */
-    this.startlisteningForRouteMessages = null;
+    this.startListeningForRouteMessages = null;
 
     /**
      * @type {function(string)}
diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn
index 14f25b66..7858b57 100644
--- a/gpu/command_buffer/service/BUILD.gn
+++ b/gpu/command_buffer/service/BUILD.gn
@@ -17,7 +17,12 @@
   }
 }
 
-source_set("service_sources") {
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "static_library"
+}
+target(link_target_type, "service_sources") {
   # External code should depend on this via //gpu/command_buffer/service above
   # rather than depending on this directly or the component build will break.
   visibility = [ "//gpu/*" ]
diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn
index 790aac8..e4de76295 100644
--- a/gpu/ipc/service/BUILD.gn
+++ b/gpu/ipc/service/BUILD.gn
@@ -20,7 +20,12 @@
   }
 }
 
-source_set("ipc_service_sources") {
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "static_library"
+}
+target(link_target_type, "ipc_service_sources") {
   visibility = [ "//gpu/*" ]
   sources = [
     "gpu_channel.cc",
diff --git a/media/gpu/ipc/service/BUILD.gn b/media/gpu/ipc/service/BUILD.gn
index 0b167ed..bb1266e 100644
--- a/media/gpu/ipc/service/BUILD.gn
+++ b/media/gpu/ipc/service/BUILD.gn
@@ -2,7 +2,12 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-source_set("service") {
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "static_library"
+}
+target(link_target_type, "service") {
   visibility = [
     "//media/*",
     "//content/gpu/*",
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 616337c0..6745e16 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1098,6 +1098,7 @@
 crbug.com/619103 virtual/rootlayerscrolls/fast/scrolling/background-paint-scrolled-out-and-in.html [ Crash Timeout ]
 crbug.com/619103 virtual/rootlayerscrolls/fast/scrolling/background-paint-scrolled.html [ Crash Timeout ]
 crbug.com/619103 [ Debug ] fast/layers/remove-layer-with-nested-stacking.html [ Crash Timeout ]
+crbug.com/619103 compositing/iframes/become-composited-nested-iframes.html [ Pass Crash Timeout ]
 
 crbug.com/464736 http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html [ Pass Failure ]
 
diff --git a/third_party/WebKit/LayoutTests/animations/lazy-detached-animation-stop.html b/third_party/WebKit/LayoutTests/animations/lazy-detached-animation-stop.html
index 74f1a83a..e8ccb1e1 100644
--- a/third_party/WebKit/LayoutTests/animations/lazy-detached-animation-stop.html
+++ b/third_party/WebKit/LayoutTests/animations/lazy-detached-animation-stop.html
@@ -39,7 +39,7 @@
     requestAnimationFrame(function() {
         input.type = "button";
         input.type = "text";
-        // Remove the element, but there's no detach() since it's already detach'ed().
+        // Remove the element, but there's no detachLayoutTree() since it's already detached.
         input.remove();
         // Change the id which should mean no more animations.
         input.id = "target2";
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html
index c9da3924..8f61e19 100644
--- a/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/reattach-with-sibling-invalidation.html
@@ -24,7 +24,7 @@
     // Schedule sibling invalidation set to invalidate span.b
     input.className = "a";
 
-    // Trigger lazyReattachIfAttached() -> detach().
+    // Trigger lazyReattachIfAttached() -> detachLayoutTree().
     document.querySelector("input").type = "button";
 
     // One for attaching the input, and one for the span.b recalc.
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress-expected.txt
deleted file mode 100644
index 9cd121a9..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Test that at least one progress event is fired after starting to load the video.
-
-RUN(video.play())
-EVENT(loadstart)
-EVENT(progress)
-END OF TEST
-
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html b/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html
index 1aef38a..68cedea 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-play-progress.html
@@ -1,28 +1,18 @@
-<html>
-  <head>
-      <script src=../../media-resources/media-file.js></script>
-      <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
-           (Please avoid writing new tests using video-test.js) -->
-      <script src=../../media-resources/video-test.js></script>
-      <script>
-          function start() {
-              findMediaElement();
+<!DOCTYPE html>
+<title>Test that at least one progress event is fired after starting to load the video.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+    var video = document.querySelector("video");
 
-              var progressCount = 0;
+    var watcher = new EventWatcher(t, video, ["loadstart", "progress"]);
+    watcher.wait_for(["loadstart", "progress"]).then(t.step_func_done());
 
-              // Make sure we've at least reached NETWORK_LOADING before waiting for progress.
-              waitForEvent('loadstart', function() {
-                  waitForEventAndEnd('progress')
-              } );
-
-              var mediaFile = findMediaFile("video", "resources/test");
-              video.src = "http://127.0.0.1:8000/" + mediaFile;
-              run("video.play()");
-          }
-      </script>
-    </head>
-    <body onload="start()">
-      <video></video>
-      <p>Test that at least one progress event is fired after starting to load the video.</p>
-    </body>
-</html>
+    var mediaFile = findMediaFile("video", "resources/test");
+    video.src = "http://127.0.0.1:8000/" + mediaFile;
+    video.play();
+  });
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt
deleted file mode 100644
index 65cd43b..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Test that stalling very early, while loading meta-data, stops delaying the load event.
-
-EVENT(loadstart)
-EVENT(stalled)
-EVENT(window.onload)
-END OF TEST
-
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html
index 50d7fe8..0cc49a92 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html
@@ -1,21 +1,19 @@
+<!DOCTYPE html>
+<title>Test that stalling very early, while loading meta-data, stops delaying the load event.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
 <video></video>
-<p>Test that stalling very early, while loading meta-data, stops delaying the load event.</p>
-<script src=../../media-resources/media-file.js></script>
-<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
-     (Please avoid writing new tests using video-test.js) -->
-<script src=../../media-resources/video-test.js></script>
 <script>
+async_test(function(t) {
+    var video = document.querySelector("video");
 
-    // Expected events.
-    waitForEvent("loadstart");
-    waitForEvent("stalled");
-    waitForEvent("suspend");
-
-    // We want to make sure the onload event fires.
-    window.onload = function() {
-       consoleWrite("EVENT(window.onload)");
-       endTest();
-    };
+    var expectedEvents = ["loadstart", "stalled"];
+    var watcher = new EventWatcher(t, video, expectedEvents);
+    watcher.wait_for(expectedEvents).then(t.step_func(function() {
+        // We want to make sure the onload event fires.
+        window.onload = t.step_func_done();
+    }));
 
     // Find a supported media file.
     var mediaFile = findMediaFile("video", "content/test");
@@ -23,5 +21,5 @@
 
     // Load should stall very early in the loading process.
     video.src = "http://127.0.0.1:8000/resources/load-and-stall.cgi?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=1&stallFor=4";
-
-</script>
+});
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/video-query-url-expected.txt
deleted file mode 100644
index 2c00f86..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url-expected.txt
+++ /dev/null
@@ -1,5 +0,0 @@
- 
-Tests that WebKit is able to open a media file specified with a query url.  
-EVENT(canplay)
-END OF TEST
-
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html b/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html
index 688f712c..e4255a4 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-query-url.html
@@ -1,36 +1,24 @@
-<html>
-    <head>
-        <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
-             (Please avoid writing new tests using video-test.js) -->
-        <script src=../../media-resources/video-test.js></script>
-        <script src=../../media-resources/media-file.js></script>
-        <script>
-            function loadMediaFrame()
-            {
-                findMediaElement();
+<!DOCTYPE html>
+<title>Tests that a media file specified with a query url is opened successfully.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<body>
+<video></video>
+<script>
+async_test(function(t) {
+    var iframe = document.createElement('iframe');
 
-                var movie = findMediaFile('video', 'test');
-                var type = mimeTypeForExtension(movie.split('.').pop());
-                var frame = document.createElement('iframe');
+    iframe.onload = t.step_func(function() {
+        var movie = findMediaFile('video', 'test');
+        var type = mimeTypeForExtension(movie.split('.').pop());
+        var video = document.querySelector('video');
+        video.onerror = t.unreached_func();
+        video.oncanplay = t.step_func_done();
+        video.src = 'http://127.0.0.1:8000/media/resources/load-video.php?name=' + movie + '&type=' + type;
+    });
 
-                frame.width = 0;
-                frame.height = 0;
-                frame.addEventListener('load', function () {
-                    video.src = 'http://127.0.0.1:8000/media/resources/load-video.php?name=' + movie + '&type=' + type;
-
-                    waitForEventAndFail('error');
-                    waitForEventAndEnd('canplay');
-                });
-
-                frame.src = "data:text/html,<b>test</b>";
-                document.body.appendChild(frame);
-            }
-        </script>
-    </head>
-
-    <body onload="loadMediaFrame()">
-        <video controls></video>
-        <br>
-        Tests that WebKit is able to open a media file specified with a query url.
-    </body>
-</html>
+    iframe.src = 'data:text/html,<b>test</b>';
+    document.body.appendChild(iframe);
+});
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-referer-expected.txt b/third_party/WebKit/LayoutTests/http/tests/media/video-referer-expected.txt
deleted file mode 100644
index 64d9bcbe..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-referer-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-EVENT(canplay)
-END OF TEST
-Tests that the media player will send the relevant referer when requesting the media file.
-
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
index d6796ba..2949aca 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
@@ -1,35 +1,30 @@
-<html>
-<head>
-</head>
-<body onload="loadCookieAndReferer()">
-<video id="video">
-    <source id="source">
+<!DOCTYPE html>
+<title>Tests that the media player will send the relevant referer when requesting the media file.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<body>
+<video>
+    <source></source>
 </video>
-<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
-     (Please avoid writing new tests using video-test.js) -->
-<script src=../../media-resources/video-test.js></script>
-<script src=../../media-resources/media-file.js></script>
 <script>
-    function loadCookieAndReferer () {
-        var movie = findMediaFile('video', 'test');
-        var type = mimeTypeForExtension(movie.split('.').pop());
-        var frame = document.createElement('iframe');
-        frame.width = 0;
-        frame.height = 0;
-        frame.addEventListener('load', function () {
-                source = document.getElementById('source');
-                source.src = 'http://127.0.0.1:8000/media/resources/video-referer-check-referer.php?name=' + movie + '&type=' + type;
-                source.type = type;
+async_test(function(t) {
+    var movie = findMediaFile('video', 'test');
+    var type = mimeTypeForExtension(movie.split('.').pop());
+    var iframe = document.createElement('iframe');
 
-                waitForEventAndFail('error');
-                waitForEventAndEnd('canplay');
-                video.load();
-        });
+    iframe.onload = t.step_func(function() {
+        var video = document.querySelector('video');
+        video.onerror = t.unreached_func();
+        video.oncanplay = t.step_func_done();
 
-        frame.src = "data:text/html,<b>test</b>";
-        document.body.appendChild(frame);
-    }
-</script>
-Tests that the media player will send the relevant referer when requesting the media file.<br/>
-</body>
-</html>
+        var source = document.querySelector('source');
+        source.src = 'http://127.0.0.1:8000/media/resources/video-referer-check-referer.php?name=' + movie + '&type=' + type;
+        source.type = type;
+        video.load();
+    });
+
+    iframe.src = 'data:text/html,<b>test</b>';
+    document.body.appendChild(iframe);
+});
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html
index a6eda1f..294d0a5 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html
@@ -142,8 +142,8 @@
             var l = listenersArray[i];
             InspectorTest.log("  type:" + l.type);
             InspectorTest.log("  useCapture:" + l.useCapture);
-            InspectorTest.log("  lineNumber:" + l.location.lineNumber);
-            InspectorTest.log("  columnNumber:" + l.location.columnNumber);
+            InspectorTest.log("  lineNumber:" + l.lineNumber);
+            InspectorTest.log("  columnNumber:" + l.columnNumber);
             if (l.handler) {
                 InspectorTest.log("  handler.type:" + l.handler.type);
                 InspectorTest.log("  handler.className:" + l.handler.className);
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
index ca95165f..b52f771 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
@@ -170,7 +170,7 @@
     return wrapUnique(new SourceLocation(m_url.isolatedCopy(), m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->isolatedCopy() : nullptr, m_scriptId));
 }
 
-std::unique_ptr<protocol::Runtime::StackTrace> SourceLocation::buildInspectorObject() const
+std::unique_ptr<protocol::Runtime::API::StackTrace> SourceLocation::buildInspectorObject() const
 {
     return m_stackTrace ? m_stackTrace->buildInspectorObject() : nullptr;
 }
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h
index 69b5af5..d4188d7 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h
@@ -18,8 +18,6 @@
 class TracedValue;
 class V8StackTrace;
 
-namespace protocol { namespace Runtime { class StackTrace; }}
-
 class CORE_EXPORT SourceLocation {
 public:
     // Zero lineNumber and columnNumber mean unknown. Captures current stack trace.
@@ -55,7 +53,7 @@
     String toString() const;
 
     // Could be null when stack trace is unknown.
-    std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObject() const;
+    std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() const;
 
 private:
     SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId);
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn
index 22eca265..70c7179 100644
--- a/third_party/WebKit/Source/core/BUILD.gn
+++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -5,6 +5,7 @@
 import("//build/config/chrome_build.gni")
 import("//build/config/chromecast_build.gni")
 import("//build/config/ui.gni")
+import("//build/split_static_library.gni")
 import("//third_party/WebKit/Source/bindings/bindings.gni")
 import("//third_party/WebKit/Source/bindings/core/v8/generated.gni")
 import("//third_party/WebKit/Source/bindings/modules/modules.gni")
@@ -69,6 +70,20 @@
   }
 }
 
+if (is_component_build) {
+  link_target_type = "source_set"
+} else {
+  link_target_type = "split_static_library"
+
+  if (is_win && is_official_build) {
+    # Shard this target into parts to work around linker limitations
+    # on link time code generation builds.
+    split_count = 5
+  } else {
+    split_count = 1
+  }
+}
+
 # GYP version: WebKit/Source/core/core.gyp:webcore_generated
 source_set("generated") {
   deps = [
@@ -188,7 +203,7 @@
 }
 
 # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_dom
-source_set("dom") {
+target(link_target_type, "dom") {
   sources = rebase_path(webcore_dom_files, ".", "//")
 
   configs -= core_config_remove
@@ -203,7 +218,7 @@
 }
 
 # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_html
-source_set("html") {
+target(link_target_type, "html") {
   sources = rebase_path(webcore_html_files, ".", "//")
 
   configs -= core_config_remove
@@ -215,7 +230,7 @@
 }
 
 # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_svg
-source_set("svg") {
+target(link_target_type, "svg") {
   sources = rebase_path(webcore_svg_files, ".", "//")
 
   configs -= core_config_remove
@@ -227,7 +242,13 @@
 }
 
 # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_remaining
-source_set("remaining") {
+target(link_target_type, "remaining") {
+  if (is_win && is_official_build) {
+    # Shard this target into parts to work around linker limitations
+    # on link time code generation builds.
+    split_count = 19
+  }
+
   # This is currently a mashup of "webcore_rendering" and "webcore_remaining"
   # in GYP. The file list variable is the same and then GYP filters on wether
   # the path starts with "rendering/" or not. We should tweak the .gypis a bit
@@ -336,7 +357,7 @@
 }
 
 # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_generated
-source_set("core_generated") {
+target(link_target_type, "core_generated") {
   sources = bindings_core_v8_files
 
   # These files include all the .cpp files generated from the .idl files
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index 51a45f3f..a432929 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -1901,10 +1901,6 @@
             'inspector/WorkerInspectorController.h',
             'inspector/WorkerThreadDebugger.cpp',
             'inspector/WorkerThreadDebugger.h',
-            'inspector/protocol/Debugger.h',
-            'inspector/protocol/HeapProfiler.h',
-            'inspector/protocol/Profiler.h',
-            'inspector/protocol/Runtime.h',
             'loader/BeaconLoader.cpp',
             'loader/BeaconLoader.h',
             'loader/CookieJar.cpp',
diff --git a/third_party/WebKit/Source/core/css/MediaValuesDynamic.h b/third_party/WebKit/Source/core/css/MediaValuesDynamic.h
index 476a46f..523783e 100644
--- a/third_party/WebKit/Source/core/css/MediaValuesDynamic.h
+++ b/third_party/WebKit/Source/core/css/MediaValuesDynamic.h
@@ -45,7 +45,7 @@
     MediaValuesDynamic(LocalFrame*, bool overriddenViewportDimensions, double viewportWidth, double viewportHeight);
 
     // This raw ptr is safe, as MediaValues would not outlive MediaQueryEvaluator, and
-    // MediaQueryEvaluator is reset on |Document::detach|.
+    // MediaQueryEvaluator is reset on |Document::detachLayoutTree|.
     Member<LocalFrame> m_frame;
     bool m_viewportDimensionsOverridden;
     double m_viewportWidthOverride;
diff --git a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
index 196d623..4947f68 100644
--- a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
+++ b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
@@ -103,7 +103,7 @@
 
 TEST_F(ActiveDOMObjectTest, MoveToStoppedDocument)
 {
-    destDocument().detach();
+    destDocument().detachLayoutTree();
 
     EXPECT_CALL(activeDOMObject(), stop());
     activeDOMObject().didMoveToNewExecutionContext(&destDocument());
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index f5ce454..16d612c0 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -505,7 +505,7 @@
     AttachContext context;
     context.clearInvalidation = true;
     if (!oldChild.needsAttach())
-        oldChild.detach(context);
+        oldChild.detachLayoutTree(context);
 
     if (nextChild)
         nextChild->setPreviousSibling(previousChild);
@@ -759,17 +759,17 @@
     Node::attachLayoutTree(context);
 }
 
-void ContainerNode::detach(const AttachContext& context)
+void ContainerNode::detachLayoutTree(const AttachContext& context)
 {
     AttachContext childrenContext(context);
     childrenContext.resolvedStyle = nullptr;
     childrenContext.clearInvalidation = true;
 
     for (Node* child = firstChild(); child; child = child->nextSibling())
-        child->detach(childrenContext);
+        child->detachLayoutTree(childrenContext);
 
     setChildNeedsStyleRecalc();
-    Node::detach(context);
+    Node::detachLayoutTree(context);
 }
 
 void ContainerNode::childrenChanged(const ChildrenChange& change)
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.h b/third_party/WebKit/Source/core/dom/ContainerNode.h
index 7b7bb4e3..58a97a0bd 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.h
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.h
@@ -110,7 +110,7 @@
     void cloneChildNodes(ContainerNode* clone);
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     LayoutRect boundingBox() const final;
     void setFocus(bool) override;
     void focusStateChanged();
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 01d8cf82..4b756bc 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2126,7 +2126,7 @@
         view()->didAttachDocument();
 }
 
-void Document::detach(const AttachContext& context)
+void Document::detachLayoutTree(const AttachContext& context)
 {
     TRACE_EVENT0("blink", "Document::detach");
     RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0);
@@ -2142,7 +2142,7 @@
     // Defer widget updates to avoid plugins trying to run script inside ScriptForbiddenScope,
     // which will crash the renderer after https://crrev.com/200984
     HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
-    // Don't allow script to run in the middle of detach() because a detaching Document is not in a
+    // Don't allow script to run in the middle of detachLayoutTree() because a detaching Document is not in a
     // consistent state.
     ScriptForbiddenScope forbidScript;
     view()->dispose();
@@ -2195,7 +2195,7 @@
         clearAXObjectCache();
 
     m_layoutView = nullptr;
-    ContainerNode::detach(context);
+    ContainerNode::detachLayoutTree(context);
 
     if (this != &axObjectCacheOwner()) {
         if (AXObjectCache* cache = existingAXObjectCache()) {
@@ -2235,10 +2235,10 @@
         Platform::current()->currentThread()->scheduler()->timerTaskRunner()->clone());
 
     // This is required, as our LocalFrame might delete itself as soon as it detaches
-    // us. However, this violates Node::detach() semantics, as it's never
-    // possible to re-attach. Eventually Document::detach() should be renamed,
+    // us. However, this violates Node::detachLayoutTree() semantics, as it's never
+    // possible to re-attach. Eventually Document::detachLayoutTree() should be renamed,
     // or this setting of the frame to 0 could be made explicit in each of the
-    // callers of Document::detach().
+    // callers of Document::detachLayoutTree().
     m_frame = nullptr;
 
     if (m_mediaQueryMatcher)
@@ -2247,7 +2247,7 @@
     m_lifecycle.advanceTo(DocumentLifecycle::Stopped);
 
     // FIXME: Currently we call notifyContextDestroyed() only in
-    // Document::detach(), which means that we don't call
+    // Document::detachLayoutTree(), which means that we don't call
     // notifyContextDestroyed() for a document that doesn't get detached.
     // If such a document has any observer, the observer won't get
     // a contextDestroyed() notification. This can happen for a document
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index 6966b1f..751ed94 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -467,7 +467,7 @@
     ResourceFetcher* fetcher() { return m_fetcher.get(); }
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
     // If you have a Document, use layoutView() instead which is faster.
     void layoutObject() const = delete;
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index dc278ab..bd5544f1 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1575,7 +1575,7 @@
     createPseudoElementIfNeeded(PseudoIdFirstLetter);
 }
 
-void Element::detach(const AttachContext& context)
+void Element::detachLayoutTree(const AttachContext& context)
 {
     HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
     cancelFocusAppearanceUpdate();
@@ -1607,7 +1607,7 @@
             shadow->detach(context);
     }
 
-    ContainerNode::detach(context);
+    ContainerNode::detachLayoutTree(context);
 
     if (!context.performingReattach && isUserActionElement()) {
         if (hovered())
diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h
index ce78f2a6..d4566f8 100644
--- a/third_party/WebKit/Source/core/dom/Element.h
+++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -331,7 +331,7 @@
     virtual void copyNonAttributePropertiesFromElement(const Element&) { }
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
     virtual LayoutObject* createLayoutObject(const ComputedStyle&);
     virtual bool layoutObjectIsNeeded(const ComputedStyle&);
diff --git a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp
index 09090b0..7f6052d 100644
--- a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp
+++ b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp
@@ -217,7 +217,7 @@
     attachFirstLetterTextLayoutObjects();
 }
 
-void FirstLetterPseudoElement::detach(const AttachContext& context)
+void FirstLetterPseudoElement::detachLayoutTree(const AttachContext& context)
 {
     if (m_remainingTextLayoutObject) {
         if (m_remainingTextLayoutObject->node() && document().isActive()) {
@@ -229,7 +229,7 @@
     }
     m_remainingTextLayoutObject = nullptr;
 
-    PseudoElement::detach(context);
+    PseudoElement::detachLayoutTree(context);
 }
 
 ComputedStyle* FirstLetterPseudoElement::styleForFirstLetter(LayoutObject* layoutObjectContainer)
diff --git a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h
index 9ff719c9..387eb23d 100644
--- a/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h
+++ b/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h
@@ -53,7 +53,7 @@
     void updateTextFragments();
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
 private:
     explicit FirstLetterPseudoElement(Element*);
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 955634a4..5bc034f 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -951,7 +951,7 @@
 
     // We only need to detach if the node has already been through attachLayoutTree().
     if (getStyleChangeType() < NeedsReattachStyleChange)
-        detach(reattachContext);
+        detachLayoutTree(reattachContext);
     attachLayoutTree(reattachContext);
 }
 
@@ -968,7 +968,7 @@
         cache->updateCacheAfterNodeIsAttached(this);
 }
 
-void Node::detach(const AttachContext& context)
+void Node::detachLayoutTree(const AttachContext& context)
 {
     DCHECK(document().lifecycle().stateAllowsDetach());
     DocumentLifecycle::DetachScope willDetach(document().lifecycle());
diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h
index b63afa0..d0d15f40 100644
--- a/third_party/WebKit/Source/core/dom/Node.h
+++ b/third_party/WebKit/Source/core/dom/Node.h
@@ -513,7 +513,7 @@
 
     // Detaches the node from the layout tree, making it invisible in the rendered view. This method will remove
     // the node's layout object from the layout tree and delete it.
-    virtual void detach(const AttachContext& = AttachContext());
+    virtual void detachLayoutTree(const AttachContext& = AttachContext());
 
     void reattach(const AttachContext& = AttachContext());
     void lazyReattachIfAttached();
@@ -828,7 +828,7 @@
     AttachContext context;
     context.performingReattach = true;
 
-    detach(context);
+    detachLayoutTree(context);
     markAncestorsWithChildNeedsStyleRecalc();
 }
 
diff --git a/third_party/WebKit/Source/core/dom/PseudoElement.cpp b/third_party/WebKit/Source/core/dom/PseudoElement.cpp
index 1b15a9a..8a58992 100644
--- a/third_party/WebKit/Source/core/dom/PseudoElement.cpp
+++ b/third_party/WebKit/Source/core/dom/PseudoElement.cpp
@@ -107,7 +107,7 @@
     DCHECK(!nextSibling());
     DCHECK(!previousSibling());
 
-    detach();
+    detachLayoutTree();
     Element* parent = parentOrShadowHostElement();
     document().adoptIfNeeded(*this);
     setParentOrShadowHostNode(0);
diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp
index 646fd927..35dbeb9 100644
--- a/third_party/WebKit/Source/core/dom/Text.cpp
+++ b/third_party/WebKit/Source/core/dom/Text.cpp
@@ -374,7 +374,7 @@
     reattachContext.performingReattach = true;
 
     if (getStyleChangeType() < NeedsReattachStyleChange)
-        detach(reattachContext);
+        detachLayoutTree(reattachContext);
     if (layoutObjectIsNeeded)
         LayoutTreeBuilderForText(*this, layoutParent->layoutObject()).createLayoutObject();
     CharacterData::attachLayoutTree(reattachContext);
diff --git a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
index 83461d3..d952b48 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
@@ -214,7 +214,7 @@
     childrenContext.resolvedStyle = 0;
 
     for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShadowRoot())
-        root->detach(childrenContext);
+        root->detachLayoutTree(childrenContext);
 }
 
 void ElementShadow::setNeedsDistributionRecalc()
diff --git a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
index 89374de..0657d87 100644
--- a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
@@ -112,12 +112,12 @@
     HTMLElement::attachLayoutTree(context);
 }
 
-void InsertionPoint::detach(const AttachContext& context)
+void InsertionPoint::detachLayoutTree(const AttachContext& context)
 {
     for (size_t i = 0; i < m_distributedNodes.size(); ++i)
         m_distributedNodes.at(i)->lazyReattachIfAttached();
 
-    HTMLElement::detach(context);
+    HTMLElement::detachLayoutTree(context);
 }
 
 void InsertionPoint::willRecalcStyle(StyleRecalcChange change)
diff --git a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
index 883b844..d34aa24 100644
--- a/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
+++ b/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
@@ -57,7 +57,7 @@
     virtual bool canAffectSelector() const { return false; }
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
     size_t distributedNodesSize() const { return m_distributedNodes.size(); }
     Node* distributedNodeAt(size_t index)  const { return m_distributedNodes.at(index); }
diff --git a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
index 41f0e8b4..ef084ff 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
@@ -150,11 +150,11 @@
     DocumentFragment::attachLayoutTree(context);
 }
 
-void ShadowRoot::detach(const AttachContext& context)
+void ShadowRoot::detachLayoutTree(const AttachContext& context)
 {
     if (context.clearInvalidation)
         document().styleEngine().styleInvalidator().clearInvalidation(*this);
-    DocumentFragment::detach(context);
+    DocumentFragment::detachLayoutTree(context);
 }
 
 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* insertionPoint)
diff --git a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
index d7753ba..2a49aaf 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
+++ b/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
@@ -81,7 +81,7 @@
     bool isV1() const { return type() == ShadowRootType::Open || type() == ShadowRootType::Closed; }
 
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
     InsertionNotificationRequest insertedInto(ContainerNode*) override;
     void removedFrom(ContainerNode*) override;
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 47b0b70b..3fa8e63 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -311,8 +311,8 @@
 void FrameView::detachScrollbars()
 {
     // Previously, we detached custom scrollbars as early as possible to prevent
-    // Document::detach() from messing with the view such that its scroll bars
-    // won't be torn down. However, scripting in Document::detach() is forbidden
+    // Document::detachLayoutTree() from messing with the view such that its scroll bars
+    // won't be torn down. However, scripting in Document::detachLayoutTree() is forbidden
     // now, so it's not clear if these edge cases can still happen.
     // However, for Oilpan, we still need to remove the native scrollbars before
     // we lose the connection to the HostWindow, so we just unconditionally
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 8c9fb0d..ccb59c9d 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -391,10 +391,10 @@
     // handlers might start a new subresource load in this frame.
     m_loader.stopAllLoaders();
     m_loader.detach();
-    document()->detach();
+    document()->detachLayoutTree();
     // This is the earliest that scripting can be disabled:
     // - FrameLoader::detach() can fire XHR abort events
-    // - Document::detach()'s deferred widget updates can run script.
+    // - Document::detachLayoutTree()'s deferred widget updates can run script.
     ScriptForbiddenScope forbidScript;
     m_loader.clear();
     // Clear FrameScheduler again in case it is recreated in scripting.
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
index c73756007f..dd60325 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -806,9 +806,9 @@
         document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore);
 }
 
-void HTMLInputElement::detach(const AttachContext& context)
+void HTMLInputElement::detachLayoutTree(const AttachContext& context)
 {
-    HTMLTextFormControlElement::detach(context);
+    HTMLTextFormControlElement::detachLayoutTree(context);
     m_needsToUpdateViewValue = true;
     m_inputTypeView->closePopupView();
 }
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.h b/third_party/WebKit/Source/core/html/HTMLInputElement.h
index 7499c72..2a2d07c4 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.h
@@ -154,7 +154,7 @@
 
     bool layoutObjectIsNeeded(const ComputedStyle&) final;
     LayoutObject* createLayoutObject(const ComputedStyle&) override;
-    void detach(const AttachContext& = AttachContext()) final;
+    void detachLayoutTree(const AttachContext& = AttachContext()) final;
     void updateFocusAppearance(SelectionBehaviorOnFocus) final;
 
     // FIXME: For isActivatedSubmit and setActivatedSubmit, we should use the NVI-idiom here by making
diff --git a/third_party/WebKit/Source/core/html/HTMLOptGroupElement.cpp b/third_party/WebKit/Source/core/html/HTMLOptGroupElement.cpp
index 3eb3c97b..2416ae9 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptGroupElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLOptGroupElement.cpp
@@ -78,10 +78,10 @@
     HTMLElement::attachLayoutTree(context);
 }
 
-void HTMLOptGroupElement::detach(const AttachContext& context)
+void HTMLOptGroupElement::detachLayoutTree(const AttachContext& context)
 {
     m_style.clear();
-    HTMLElement::detach(context);
+    HTMLElement::detachLayoutTree(context);
 }
 
 bool HTMLOptGroupElement::supportsFocus() const
diff --git a/third_party/WebKit/Source/core/html/HTMLOptGroupElement.h b/third_party/WebKit/Source/core/html/HTMLOptGroupElement.h
index 65d681a..1e12275 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptGroupElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLOptGroupElement.h
@@ -53,7 +53,7 @@
     void accessKeyAction(bool sendMouseEvents) override;
     void didAddUserAgentShadowRoot(ShadowRoot&) override;
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     bool matchesEnabledPseudoClass() const override;
     InsertionNotificationRequest insertedInto(ContainerNode*) override;
     void removedFrom(ContainerNode*) override;
diff --git a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
index 3fabbd82..36f6e5c 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
@@ -101,10 +101,10 @@
     HTMLElement::attachLayoutTree(optionContext);
 }
 
-void HTMLOptionElement::detach(const AttachContext& context)
+void HTMLOptionElement::detachLayoutTree(const AttachContext& context)
 {
     m_style.clear();
-    HTMLElement::detach(context);
+    HTMLElement::detachLayoutTree(context);
 }
 
 bool HTMLOptionElement::supportsFocus() const
diff --git a/third_party/WebKit/Source/core/html/HTMLOptionElement.h b/third_party/WebKit/Source/core/html/HTMLOptionElement.h
index 26f0703..14254d39 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptionElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLOptionElement.h
@@ -94,7 +94,7 @@
     bool matchesDefaultPseudoClass() const override;
     bool matchesEnabledPseudoClass() const override;
     void attachLayoutTree(const AttachContext& = AttachContext()) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicString&) override;
     InsertionNotificationRequest insertedInto(ContainerNode*) override;
     void removedFrom(ContainerNode*) override;
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
index 6f7cfd3..52e34180 100644
--- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
@@ -71,7 +71,7 @@
 
 HTMLPlugInElement::~HTMLPlugInElement()
 {
-    ASSERT(!m_pluginWrapper); // cleared in detach()
+    DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree()
     ASSERT(!m_isDelayingLoadEvent);
 }
 
@@ -221,7 +221,7 @@
     return false;
 }
 
-void HTMLPlugInElement::detach(const AttachContext& context)
+void HTMLPlugInElement::detachLayoutTree(const AttachContext& context)
 {
     // Update the widget the next time we attach (detaching destroys the plugin).
     // FIXME: None of this "needsWidgetUpdate" related code looks right.
@@ -243,7 +243,7 @@
 
     resetInstance();
 
-    HTMLFrameOwnerElement::detach(context);
+    HTMLFrameOwnerElement::detachLayoutTree(context);
 }
 
 LayoutObject* HTMLPlugInElement::createLayoutObject(const ComputedStyle& style)
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.h b/third_party/WebKit/Source/core/html/HTMLPlugInElement.h
index 455ef3235..2d7aaecc 100644
--- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.h
@@ -108,7 +108,7 @@
     bool willRespondToMouseClickEvents() final;
     void defaultEventHandler(Event*) final;
     void attachLayoutTree(const AttachContext& = AttachContext()) final;
-    void detach(const AttachContext& = AttachContext()) final;
+    void detachLayoutTree(const AttachContext& = AttachContext()) final;
     void finishParsingChildren() final;
 
     // Element functions:
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
index fbf1559..aa894aee 100644
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
@@ -1946,9 +1946,9 @@
         m_popup->updateFromElement(PopupMenu::ByStyleChange);
 }
 
-void HTMLSelectElement::detach(const AttachContext& context)
+void HTMLSelectElement::detachLayoutTree(const AttachContext& context)
 {
-    HTMLFormControlElementWithState::detach(context);
+    HTMLFormControlElementWithState::detachLayoutTree(context);
     if (m_popup)
         m_popup->disconnectClient();
     m_popupIsVisible = false;
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.h b/third_party/WebKit/Source/core/html/HTMLSelectElement.h
index 318487e..08d0bb72 100644
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.h
@@ -193,7 +193,7 @@
 
     LayoutObject* createLayoutObject(const ComputedStyle&) override;
     void didRecalcStyle(StyleRecalcChange) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     void appendToFormData(FormData&) override;
     void didAddUserAgentShadowRoot(ShadowRoot&) override;
 
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
index 2b8044b..82903e3 100644
--- a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
@@ -153,7 +153,7 @@
     EXPECT_FALSE(select->popupIsVisible());
     select->showPopup();
     EXPECT_TRUE(select->popupIsVisible());
-    document().detach();
+    document().detachLayoutTree();
     EXPECT_FALSE(select->popupIsVisible());
 }
 
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
index ce03ac55..b9a0079 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -196,12 +196,12 @@
     HTMLElement::attachLayoutTree(context);
 }
 
-void HTMLSlotElement::detach(const AttachContext& context)
+void HTMLSlotElement::detachLayoutTree(const AttachContext& context)
 {
     for (auto& node : m_distributedNodes)
         node->lazyReattachIfAttached();
 
-    HTMLElement::detach(context);
+    HTMLElement::detachLayoutTree(context);
 }
 
 void HTMLSlotElement::attributeChanged(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason reason)
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.h b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
index 7725689d..f6c561308 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
@@ -64,7 +64,7 @@
     void lazyReattachDistributedNodesIfNeeded();
 
     void attachLayoutTree(const AttachContext& = AttachContext()) final;
-    void detach(const AttachContext& = AttachContext()) final;
+    void detachLayoutTree(const AttachContext& = AttachContext()) final;
 
     void attributeChanged(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) final;
 
diff --git a/third_party/WebKit/Source/core/html/PluginDocument.cpp b/third_party/WebKit/Source/core/html/PluginDocument.cpp
index 68d525a3..221c5a4 100644
--- a/third_party/WebKit/Source/core/html/PluginDocument.cpp
+++ b/third_party/WebKit/Source/core/html/PluginDocument.cpp
@@ -189,11 +189,11 @@
     return m_pluginNode.get();
 }
 
-void PluginDocument::detach(const AttachContext& context)
+void PluginDocument::detachLayoutTree(const AttachContext& context)
 {
     // Release the plugin node so that we don't have a circular reference.
     m_pluginNode = nullptr;
-    HTMLDocument::detach(context);
+    HTMLDocument::detachLayoutTree(context);
 }
 
 DEFINE_TRACE(PluginDocument)
diff --git a/third_party/WebKit/Source/core/html/PluginDocument.h b/third_party/WebKit/Source/core/html/PluginDocument.h
index 41280cf..dcdbf41 100644
--- a/third_party/WebKit/Source/core/html/PluginDocument.h
+++ b/third_party/WebKit/Source/core/html/PluginDocument.h
@@ -45,7 +45,7 @@
     Widget* pluginWidget();
     Node* pluginNode();
 
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
 
     DECLARE_VIRTUAL_TRACE();
 
diff --git a/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp b/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp
index 35630e7..e660069b 100644
--- a/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp
@@ -49,9 +49,9 @@
     return element;
 }
 
-void ClearButtonElement::detach(const AttachContext& context)
+void ClearButtonElement::detachLayoutTree(const AttachContext& context)
 {
-    HTMLDivElement::detach(context);
+    HTMLDivElement::detachLayoutTree(context);
 }
 
 void ClearButtonElement::defaultEventHandler(Event* event)
diff --git a/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.h b/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.h
index aa5f75d4..886b892cb 100644
--- a/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.h
+++ b/third_party/WebKit/Source/core/html/shadow/ClearButtonElement.h
@@ -48,7 +48,7 @@
 
 private:
     ClearButtonElement(Document&, ClearButtonOwner&);
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     bool isMouseFocusable() const override { return false; }
     void defaultEventHandler(Event*) override;
     bool isClearButtonElement() const override;
diff --git a/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp b/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp
index 604fa168..a48f52c 100644
--- a/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp
@@ -144,10 +144,10 @@
     m_chooser->endChooser();
 }
 
-void PickerIndicatorElement::detach(const AttachContext& context)
+void PickerIndicatorElement::detachLayoutTree(const AttachContext& context)
 {
     closePopup();
-    HTMLDivElement::detach(context);
+    HTMLDivElement::detachLayoutTree(context);
 }
 
 AXObject* PickerIndicatorElement::popupRootAXObject() const
diff --git a/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.h b/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.h
index 344b36ce..f1d3bef 100644
--- a/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.h
+++ b/third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.h
@@ -75,7 +75,7 @@
     PickerIndicatorElement(Document&, PickerIndicatorOwner&);
     LayoutObject* createLayoutObject(const ComputedStyle&) override;
     void defaultEventHandler(Event*) override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     bool isPickerIndicatorElement() const override;
     InsertionNotificationRequest insertedInto(ContainerNode*) override;
     void didNotifySubtreeInsertionsToDocument() override;
diff --git a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
index b3aa972..8d9d3f15 100644
--- a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
@@ -245,13 +245,13 @@
     return HTMLDivElement::willRespondToMouseClickEvents();
 }
 
-void SliderThumbElement::detach(const AttachContext& context)
+void SliderThumbElement::detachLayoutTree(const AttachContext& context)
 {
     if (m_inDragMode) {
         if (LocalFrame* frame = document().frame())
             frame->eventHandler().setCapturingMouseEventsNode(nullptr);
     }
-    HTMLDivElement::detach(context);
+    HTMLDivElement::detachLayoutTree(context);
 }
 
 HTMLInputElement* SliderThumbElement::hostInput() const
diff --git a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.h b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.h
index 562c60f9..ef06fa471 100644
--- a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.h
+++ b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.h
@@ -51,7 +51,7 @@
     void defaultEventHandler(Event*) override;
     bool willRespondToMouseMoveEvents() override;
     bool willRespondToMouseClickEvents() override;
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     const AtomicString& shadowPseudoId() const override;
     HTMLInputElement* hostInput() const;
     void setPositionFromPoint(const LayoutPoint&);
diff --git a/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp b/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp
index 2ed99ed..fc68e0ee 100644
--- a/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp
@@ -59,10 +59,10 @@
     return element;
 }
 
-void SpinButtonElement::detach(const AttachContext& context)
+void SpinButtonElement::detachLayoutTree(const AttachContext& context)
 {
     releaseCapture(EventDispatchDisallowed);
-    HTMLDivElement::detach(context);
+    HTMLDivElement::detachLayoutTree(context);
 }
 
 void SpinButtonElement::defaultEventHandler(Event* event)
diff --git a/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.h b/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.h
index 3b696c8d..e7f9d56e 100644
--- a/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.h
+++ b/third_party/WebKit/Source/core/html/shadow/SpinButtonElement.h
@@ -76,7 +76,7 @@
 private:
     SpinButtonElement(Document&, SpinButtonOwner&);
 
-    void detach(const AttachContext&) override;
+    void detachLayoutTree(const AttachContext&) override;
     bool isSpinButtonElement() const override { return true; }
     bool isDisabledFormControl() const override { return shadowHost() && shadowHost()->isDisabledFormControl(); }
     bool matchesReadOnlyPseudoClass() const override;
diff --git a/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp b/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp
index c8bb783..642fb02 100644
--- a/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp
@@ -165,13 +165,13 @@
     return element;
 }
 
-void SearchFieldCancelButtonElement::detach(const AttachContext& context)
+void SearchFieldCancelButtonElement::detachLayoutTree(const AttachContext& context)
 {
     if (m_capturing) {
         if (LocalFrame* frame = document().frame())
             frame->eventHandler().setCapturingMouseEventsNode(nullptr);
     }
-    HTMLDivElement::detach(context);
+    HTMLDivElement::detachLayoutTree(context);
 }
 
 
diff --git a/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.h b/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.h
index 8e743b2..10094cf 100644
--- a/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.h
+++ b/third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.h
@@ -75,7 +75,7 @@
 
 private:
     explicit SearchFieldCancelButtonElement(Document&);
-    void detach(const AttachContext& = AttachContext()) override;
+    void detachLayoutTree(const AttachContext& = AttachContext()) override;
     bool supportsFocus() const override { return false; }
 
     bool m_capturing;
diff --git a/third_party/WebKit/Source/core/inspector/BUILD.gn b/third_party/WebKit/Source/core/inspector/BUILD.gn
index f69b512a..815a1c4 100644
--- a/third_party/WebKit/Source/core/inspector/BUILD.gn
+++ b/third_party/WebKit/Source/core/inspector/BUILD.gn
@@ -36,6 +36,8 @@
   ]
   sources = [
     "../../platform/inspector_protocol/CodeGenerator.py",
+    "../../platform/inspector_protocol/Exported_h.template",
+    "../../platform/inspector_protocol/Imported_h.template",
     "../../platform/inspector_protocol/TypeBuilder_cpp.template",
     "../../platform/inspector_protocol/TypeBuilder_h.template",
   ]
@@ -56,6 +58,7 @@
     "$blink_core_output_dir/inspector/protocol/CSS.h",
     "$blink_core_output_dir/inspector/protocol/Database.cpp",
     "$blink_core_output_dir/inspector/protocol/Database.h",
+    "$blink_core_output_dir/inspector/protocol/Debugger.h",
     "$blink_core_output_dir/inspector/protocol/DeviceOrientation.cpp",
     "$blink_core_output_dir/inspector/protocol/DeviceOrientation.h",
     "$blink_core_output_dir/inspector/protocol/DOM.cpp",
@@ -86,6 +89,7 @@
     "$blink_core_output_dir/inspector/protocol/Page.h",
     "$blink_core_output_dir/inspector/protocol/Rendering.cpp",
     "$blink_core_output_dir/inspector/protocol/Rendering.h",
+    "$blink_core_output_dir/inspector/protocol/Runtime.h",
     "$blink_core_output_dir/inspector/protocol/Security.cpp",
     "$blink_core_output_dir/inspector/protocol/Security.h",
     "$blink_core_output_dir/inspector/protocol/ServiceWorker.cpp",
@@ -103,6 +107,8 @@
     rebase_path("browser_protocol.json", root_build_dir),
     "--include",
     rebase_path("../../platform/v8_inspector/js_protocol.json", root_build_dir),
+    "--include_package",
+    "platform/v8_inspector/public/protocol",
     "--string_type",
     "String",
     "--export_macro",
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
index bb49a92..8852b4a 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -357,7 +357,7 @@
     }
 }
 
-void InspectorAnimationAgent::resolveAnimation(ErrorString* errorString, const String& animationId, std::unique_ptr<protocol::Runtime::RemoteObject>* result)
+void InspectorAnimationAgent::resolveAnimation(ErrorString* errorString, const String& animationId, std::unique_ptr<protocol::Runtime::API::RemoteObject>* result)
 {
     blink::Animation* animation = assertAnimation(errorString, animationId);
     if (!animation)
@@ -375,7 +375,7 @@
 
     ScriptState::Scope scope(scriptState);
     m_v8Session->releaseObjectGroup("animation");
-    *result = m_v8Session->wrapObject(scriptState->context(), toV8(animation, scriptState->context()->Global(), scriptState->isolate()), "animation", false);
+    *result = m_v8Session->wrapObject(scriptState->context(), toV8(animation, scriptState->context()->Global(), scriptState->isolate()), "animation");
     if (!*result)
         *errorString = "Element not associated with a document.";
 }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
index 1e4e2b3..048e2b4 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
@@ -42,7 +42,7 @@
     void setTiming(ErrorString*, const String& animationId, double duration, double delay) override;
     void seekAnimations(ErrorString*, std::unique_ptr<protocol::Array<String>> animations, double currentTime) override;
     void releaseAnimations(ErrorString*, std::unique_ptr<protocol::Array<String>> animations) override;
-    void resolveAnimation(ErrorString*, const String& animationId, std::unique_ptr<protocol::Runtime::RemoteObject>*) override;
+    void resolveAnimation(ErrorString*, const String& animationId, std::unique_ptr<protocol::Runtime::API::RemoteObject>*) override;
 
     // API for InspectorInstrumentation
     void didCreateAnimation(unsigned);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
index b9f6f8f..22e3649 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -1364,7 +1364,7 @@
     *nodeId = pushNodePathToFrontend(node);
 }
 
-void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::RemoteObject>* result)
+void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::API::RemoteObject>* result)
 {
     String objectGroupName = objectGroup.fromMaybe("");
     Node* node = nodeForId(nodeId);
@@ -2041,7 +2041,7 @@
     *result = highlight.asProtocolValue();
 }
 
-std::unique_ptr<protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
+std::unique_ptr<protocol::Runtime::API::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
 {
     Document* document = node->isDocumentNode() ? &node->document() : node->ownerDocument();
     LocalFrame* frame = document ? document->frame() : nullptr;
@@ -2053,7 +2053,7 @@
         return nullptr;
 
     ScriptState::Scope scope(scriptState);
-    return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptState->context(), node), objectGroup, false);
+    return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptState->context(), node), objectGroup);
 }
 
 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorString)
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h
index 84dc60e..b1b9ec9 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h
@@ -133,7 +133,7 @@
     void pushNodeByPathToFrontend(ErrorString*, const String& path, int* outNodeId) override;
     void pushNodesByBackendIdsToFrontend(ErrorString*, std::unique_ptr<protocol::Array<int>> backendNodeIds, std::unique_ptr<protocol::Array<int>>* nodeIds) override;
     void setInspectedNode(ErrorString*, int nodeId) override;
-    void resolveNode(ErrorString*, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::RemoteObject>*) override;
+    void resolveNode(ErrorString*, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::API::RemoteObject>*) override;
     void getAttributes(ErrorString*, int nodeId, std::unique_ptr<protocol::Array<String>>* attributes) override;
     void copyTo(ErrorString*, int nodeId, int targetNodeId, const Maybe<int>& insertBeforeNodeId, int* outNodeId) override;
     void moveTo(ErrorString*, int nodeId, int targetNodeId, const Maybe<int>& insertBeforeNodeId, int* outNodeId) override;
@@ -176,7 +176,7 @@
 
     static String documentURLString(Document*);
 
-    std::unique_ptr<protocol::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup);
+    std::unique_ptr<protocol::Runtime::API::RemoteObject> resolveNode(Node*, const String& objectGroup);
 
     InspectorHistory* history() { return m_history.get(); }
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
index 689d6fd..4e8b106 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
@@ -310,7 +310,7 @@
     if (hasBreakpoint(node, AttributeModified)) {
         std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
         descriptionForDOMEvent(node, AttributeModified, false, eventData.get());
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::DOM, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, std::move(eventData));
     }
 }
 
@@ -456,21 +456,19 @@
     int columnNumber;
     getFunctionLocation(function, scriptId, lineNumber, columnNumber);
 
-    std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger::Location::create()
-        .setScriptId(scriptId)
-        .setLineNumber(lineNumber).build();
-    location->setColumnNumber(columnNumber);
     std::unique_ptr<protocol::DOMDebugger::EventListener> value = protocol::DOMDebugger::EventListener::create()
         .setType(info.eventType)
         .setUseCapture(info.useCapture)
         .setPassive(info.passive)
-        .setLocation(std::move(location)).build();
+        .setScriptId(scriptId)
+        .setLineNumber(lineNumber)
+        .setColumnNumber(columnNumber).build();
     if (!objectGroupId.isEmpty()) {
-        value->setHandler(m_v8Session->wrapObject(context, function, objectGroupId, false));
-        value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler, objectGroupId, false));
+        value->setHandler(m_v8Session->wrapObject(context, function, objectGroupId));
+        value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler, objectGroupId));
         v8::Local<v8::Function> removeFunction;
         if (info.removeFunction.ToLocal(&removeFunction))
-            value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunction, objectGroupId, false));
+            value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunction, objectGroupId));
     }
     return value;
 }
@@ -485,7 +483,7 @@
     if (hasBreakpoint(parent, SubtreeModified)) {
         std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
         descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get());
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::DOM, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, std::move(eventData));
     }
 }
 
@@ -495,11 +493,11 @@
     if (hasBreakpoint(node, NodeRemoved)) {
         std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
         descriptionForDOMEvent(node, NodeRemoved, false, eventData.get());
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::DOM, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, std::move(eventData));
     } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) {
         std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
         descriptionForDOMEvent(node, SubtreeModified, false, eventData.get());
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::DOM, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, std::move(eventData));
     }
     didRemoveDOMNode(node);
 }
@@ -509,7 +507,7 @@
     if (hasBreakpoint(element, AttributeModified)) {
         std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
         descriptionForDOMEvent(element, AttributeModified, false, eventData.get());
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::DOM, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, std::move(eventData));
     }
 }
 
@@ -521,8 +519,8 @@
     if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
         // For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint.
         // Target node may be unknown to frontend, so we need to push it first.
-        std::unique_ptr<protocol::Runtime::RemoteObject> targetNodeObject = m_domAgent->resolveNode(target, V8InspectorSession::backtraceObjectGroup);
-        description->setValue("targetNode", targetNodeObject->serialize());
+        std::unique_ptr<protocol::Runtime::API::RemoteObject> targetNodeObject = m_domAgent->resolveNode(target, V8InspectorSession::backtraceObjectGroup);
+        description->setValue("targetNode", protocol::SerializedValue::create(targetNodeObject->toJSONString()));
 
         // Find breakpoint owner node.
         if (!insertion)
@@ -577,9 +575,9 @@
     if (!eventData)
         return;
     if (synchronous)
-        m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::EventListener, std::move(eventData));
+        m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::EventListener, std::move(eventData));
     else
-        m_v8Session->schedulePauseOnNextStatement(protocol::Debugger::Paused::ReasonEnum::EventListener, std::move(eventData));
+        m_v8Session->schedulePauseOnNextStatement(protocol::Debugger::API::Paused::ReasonEnum::EventListener, std::move(eventData));
 }
 
 std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePauseOnNativeEventData(const String& eventName, const String* targetName)
@@ -681,7 +679,7 @@
     std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create();
     eventData->setString("breakpointURL", breakpointURL);
     eventData->setString("url", url);
-    m_v8Session->breakProgram(protocol::Debugger::Paused::ReasonEnum::XHR, std::move(eventData));
+    m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::XHR, std::move(eventData));
 }
 
 void InspectorDOMDebuggerAgent::didAddBreakpoint()
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
index 6de9834..d1fc956 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
@@ -86,7 +86,7 @@
         .build();
     if (!message->location()->url().isEmpty())
         entry->setUrl(message->location()->url());
-    std::unique_ptr<protocol::Runtime::StackTrace> stackTrace = message->location()->buildInspectorObject();
+    std::unique_ptr<protocol::Runtime::API::StackTrace> stackTrace = message->location()->buildInspectorObject();
     if (stackTrace)
         entry->setStackTrace(std::move(stackTrace));
     if (message->location()->lineNumber())
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
index 2f161f11..191bb42 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -830,7 +830,7 @@
 
 std::unique_ptr<protocol::Network::Initiator> InspectorNetworkAgent::buildInitiatorObject(Document* document, const FetchInitiatorInfo& initiatorInfo)
 {
-    std::unique_ptr<protocol::Runtime::StackTrace> currentStackTrace = SourceLocation::capture(document)->buildInspectorObject();
+    std::unique_ptr<protocol::Runtime::API::StackTrace> currentStackTrace = SourceLocation::capture(document)->buildInspectorObject();
     if (currentStackTrace) {
         std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol::Network::Initiator::create()
             .setType(protocol::Network::Initiator::TypeEnum::Script).build();
@@ -860,7 +860,7 @@
 
 void InspectorNetworkAgent::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const String&)
 {
-    std::unique_ptr<protocol::Runtime::StackTrace> currentStackTrace = SourceLocation::capture(document)->buildInspectorObject();
+    std::unique_ptr<protocol::Runtime::API::StackTrace> currentStackTrace = SourceLocation::capture(document)->buildInspectorObject();
     if (!currentStackTrace) {
         frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlWithoutFragment(requestURL).getString());
         return;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
index 068317a..d11f14f5 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -516,9 +516,7 @@
         return;
     }
 
-    std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> results;
-    results = V8ContentSearchUtil::searchInTextByLines(m_v8Session, content, query, caseSensitive, isRegex);
-    callback->sendSuccess(std::move(results));
+    callback->sendSuccess(V8ContentSearchUtil::searchInTextByLines(m_v8Session, content, query, caseSensitive, isRegex));
 }
 
 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const Maybe<bool>& optionalCaseSensitive, const Maybe<bool>& optionalIsRegex, std::unique_ptr<SearchInResourceCallback> callback)
diff --git a/third_party/WebKit/Source/core/inspector/InspectorSession.cpp b/third_party/WebKit/Source/core/inspector/InspectorSession.cpp
index 5044d5c..92c7fdb 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorSession.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorSession.cpp
@@ -12,7 +12,6 @@
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "platform/inspector_protocol/Parser.h"
-#include "platform/v8_inspector/protocol/Debugger.h"
 #include "platform/v8_inspector/public/V8Debugger.h"
 #include "platform/v8_inspector/public/V8InspectorSession.h"
 
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json
index 2361dfa..f4d307b 100644
--- a/third_party/WebKit/Source/core/inspector/browser_protocol.json
+++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -3114,7 +3114,9 @@
                     { "name": "type", "type": "string", "description": "<code>EventListener</code>'s type." },
                     { "name": "useCapture", "type": "boolean", "description": "<code>EventListener</code>'s useCapture." },
                     { "name": "passive", "type": "boolean", "description": "<code>EventListener</code>'s passive flag." },
-                    { "name": "location", "$ref": "Debugger.Location", "description": "Handler code location." },
+                    { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script id of the handler code." },
+                    { "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." },
+                    { "name": "columnNumber", "type": "integer", "description": "Column number in the script (0-based)." },
                     { "name": "handler", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event handler function value." },
                     { "name": "originalHandler", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event original handler function value." },
                     { "name": "removeFunction", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event listener remove function." }
diff --git a/third_party/WebKit/Source/core/inspector/inspector.gyp b/third_party/WebKit/Source/core/inspector/inspector.gyp
index b04b03e..a67b70e 100644
--- a/third_party/WebKit/Source/core/inspector/inspector.gyp
+++ b/third_party/WebKit/Source/core/inspector/inspector.gyp
@@ -55,6 +55,8 @@
             # The python script in action below.
             '../../platform/inspector_protocol/CodeGenerator.py',
             # Source code templates.
+            '../../platform/inspector_protocol/Exported_h.template',
+            '../../platform/inspector_protocol/Imported_h.template',
             '../../platform/inspector_protocol/TypeBuilder_h.template',
             '../../platform/inspector_protocol/TypeBuilder_cpp.template',
             # Protocol definition
@@ -74,6 +76,7 @@
             '<(blink_core_output_dir)/inspector/protocol/CSS.h',
             '<(blink_core_output_dir)/inspector/protocol/Database.cpp',
             '<(blink_core_output_dir)/inspector/protocol/Database.h',
+            '<(blink_core_output_dir)/inspector/protocol/Debugger.h',
             '<(blink_core_output_dir)/inspector/protocol/DeviceOrientation.cpp',
             '<(blink_core_output_dir)/inspector/protocol/DeviceOrientation.h',
             '<(blink_core_output_dir)/inspector/protocol/DOM.cpp',
@@ -104,6 +107,7 @@
             '<(blink_core_output_dir)/inspector/protocol/Page.h',
             '<(blink_core_output_dir)/inspector/protocol/Rendering.cpp',
             '<(blink_core_output_dir)/inspector/protocol/Rendering.h',
+            '<(blink_core_output_dir)/inspector/protocol/Runtime.h',
             '<(blink_core_output_dir)/inspector/protocol/Security.cpp',
             '<(blink_core_output_dir)/inspector/protocol/Security.h',
             '<(blink_core_output_dir)/inspector/protocol/ServiceWorker.cpp',
@@ -120,6 +124,7 @@
             '../../platform/inspector_protocol/CodeGenerator.py',
             '--protocol', 'browser_protocol.json',
             '--include', '../../platform/v8_inspector/js_protocol.json',
+            '--include_package', 'platform/v8_inspector/public/protocol',
             '--string_type', 'String',
             '--export_macro', 'CORE_EXPORT',
             '--output_dir', '<(blink_core_output_dir)/inspector/protocol',
diff --git a/third_party/WebKit/Source/core/inspector/protocol/Debugger.h b/third_party/WebKit/Source/core/inspector/protocol/Debugger.h
deleted file mode 100644
index 4acd2a3c..0000000
--- a/third_party/WebKit/Source/core/inspector/protocol/Debugger.h
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2016 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 "platform/v8_inspector/protocol/Debugger.h"
diff --git a/third_party/WebKit/Source/core/inspector/protocol/HeapProfiler.h b/third_party/WebKit/Source/core/inspector/protocol/HeapProfiler.h
deleted file mode 100644
index 9047195..0000000
--- a/third_party/WebKit/Source/core/inspector/protocol/HeapProfiler.h
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2016 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 "platform/v8_inspector/protocol/HeapProfiler.h"
diff --git a/third_party/WebKit/Source/core/inspector/protocol/Profiler.h b/third_party/WebKit/Source/core/inspector/protocol/Profiler.h
deleted file mode 100644
index 7e4ba4ca..0000000
--- a/third_party/WebKit/Source/core/inspector/protocol/Profiler.h
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2016 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 "platform/v8_inspector/protocol/Profiler.h"
diff --git a/third_party/WebKit/Source/core/inspector/protocol/Runtime.h b/third_party/WebKit/Source/core/inspector/protocol/Runtime.h
deleted file mode 100644
index 65eb04d..0000000
--- a/third_party/WebKit/Source/core/inspector/protocol/Runtime.h
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2016 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 "platform/v8_inspector/protocol/Runtime.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
index 5c70b6f..1f3d90a9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
@@ -357,7 +357,7 @@
 {
     // Remove and destroy in separate steps, so that we get to test removal of subtrees.
     child->remove();
-    child->node()->detach();
+    child->node()->detachLayoutTree();
 }
 
 void MultiColumnTreeModifyingTest::destroyLayoutObject(const char* childId)
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 8dae489..2db924a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -180,7 +180,7 @@
 // LayoutObjects are created during the DOM attachment. This phase computes
 // the style and create the LayoutObject associated with the Node (see
 // Node::attachLayoutTree). LayoutObjects are destructed during detachment (see
-// Node::detach), which can happen when the DOM node is removed from the
+// Node::detachLayoutTree), which can happen when the DOM node is removed from the
 // DOM tree, during page tear down or when the style is changed to contain
 // 'display: none'.
 //
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextFragment.h b/third_party/WebKit/Source/core/layout/LayoutTextFragment.h
index 636c1582..375eaa69 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextFragment.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTextFragment.h
@@ -87,7 +87,7 @@
     unsigned m_fragmentLength;
     bool m_isRemainingTextLayoutObject;
     RefPtr<StringImpl> m_contentString;
-    // Reference back to FirstLetterPseudoElement; cleared by FirstLetterPseudoElement::detach() if
+    // Reference back to FirstLetterPseudoElement; cleared by FirstLetterPseudoElement::detachLayoutTree() if
     // it goes away first.
     UntracedMember<FirstLetterPseudoElement> m_firstLetterPseudoElement;
 };
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp
index 0496404..88a2b50 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -920,7 +920,7 @@
     if (m_compositor)
         m_compositor->setIsInWindow(isInWindow);
 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
-    // We don't invalidate layers during document detach(), so must clear the should-keep-alive
+    // We don't invalidate layers during Document::detachLayoutTree(), so must clear the should-keep-alive
     // DisplayItemClients which may be deleted before the layers being subsequence owners.
     if (!isInWindow && layer())
         layer()->endShouldKeepAliveAllClientsRecursive();
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 2a181112..f1aff24 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -342,7 +342,7 @@
     // frame on a detached DOM tree, which is bad.
     SubframeLoadingDisabler disabler(m_frame->document());
     m_frame->detachChildren();
-    m_frame->document()->detach();
+    m_frame->document()->detachLayoutTree();
     clear();
 
     // detachChildren() potentially detaches the frame from the document. The
@@ -1123,7 +1123,7 @@
     // No more events will be dispatched so detach the Document.
     // TODO(yoav): Should we also be nullifying domWindow's document (or domWindow) since the doc is now detached?
     if (m_frame->document())
-        m_frame->document()->detach();
+        m_frame->document()->detachLayoutTree();
     m_documentLoader = m_provisionalDocumentLoader.release();
     takeObjectSnapshot();
 
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
index f687976..52d1db4 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -340,7 +340,7 @@
 // 2. FrameNavigationDisabler / LocalFrame::isNavigationAllowed() are intended
 //    to prevent Documents from being reattached during destruction, since it
 //    can cause bugs with security origin confusion. This is primarily intended
-//    to block /synchronous/ navigations during things lke Document::detach().
+//    to block /synchronous/ navigations during things lke Document::detachLayoutTree().
 inline bool NavigationScheduler::shouldScheduleReload() const
 {
     return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisablerForBeforeUnload::isNavigationAllowed();
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 93c7abd..d8ab12d 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -76,9 +76,9 @@
     ASSERT(isConnected() || !hasRelativeLengths());
 }
 
-void SVGElement::detach(const AttachContext& context)
+void SVGElement::detachLayoutTree(const AttachContext& context)
 {
-    Element::detach(context);
+    Element::detachLayoutTree(context);
     if (SVGElement* element = correspondingElement())
         element->removeInstanceMapping(this);
 }
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.h b/third_party/WebKit/Source/core/svg/SVGElement.h
index 924b8d8..c416534 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.h
+++ b/third_party/WebKit/Source/core/svg/SVGElement.h
@@ -56,7 +56,7 @@
 public:
     ~SVGElement() override;
     void attachLayoutTree(const AttachContext&) override;
-    void detach(const AttachContext&) override;
+    void detachLayoutTree(const AttachContext&) override;
 
     short tabIndex() const override;
     bool supportsFocus() const override { return false; }
diff --git a/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp b/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp
index 81e446a..cf2c911 100644
--- a/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp
+++ b/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp
@@ -73,10 +73,10 @@
     if (frame) {
         Document* oldDocument = frame->document();
         // Before parsing, we need to save & detach the old document and get the new document
-        // in place. Document::detach() tears down the FrameView, so remember whether or not
+        // in place. Document::detachLayoutTree() tears down the FrameView, so remember whether or not
         // there was one.
         bool hasView = frame->view();
-        oldDocument->detach();
+        oldDocument->detachLayoutTree();
         // Re-create the FrameView if needed.
         if (hasView)
             frame->loader().client()->transitionToCommittedForNewPage();
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
index 3793814e..08191ab 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
@@ -503,7 +503,7 @@
         /**
          * @param {function(?)} fulfill
          * @param {function(*)} reject
-         * @this {WebInspector.RemoteObject}
+         * @this {WebInspector.RemoteObjectImpl}
          */
         function eventListeners(fulfill, reject)
         {
@@ -521,7 +521,7 @@
             this.target().domdebuggerAgent().getEventListeners(this._objectId, mycallback.bind(this));
 
             /**
-             * @this {!WebInspector.RemoteObject}
+             * @this {WebInspector.RemoteObjectImpl}
              * @param {?Protocol.Error} error
              * @param {!Array<!DOMDebuggerAgent.EventListener>} payloads
              */
@@ -535,7 +535,7 @@
             }
 
             /**
-             * @this {!WebInspector.RemoteObject}
+             * @this {WebInspector.RemoteObjectImpl}
              * @param {!DOMDebuggerAgent.EventListener} payload
              */
             function createEventListener(payload)
@@ -547,7 +547,7 @@
                                                       payload.passive,
                                                       payload.handler ? this.target().runtimeModel.createRemoteObject(payload.handler) : null,
                                                       payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null,
-                                                      WebInspector.DebuggerModel.Location.fromPayload(this._debuggerModel, payload.location),
+                                                      /** @type {!WebInspector.DebuggerModel.Location} */ (this._debuggerModel.createRawLocationByScriptId(payload.scriptId, payload.lineNumber, payload.columnNumber)),
                                                       payload.removeFunction ? this.target().runtimeModel.createRemoteObject(payload.removeFunction) : null);
             }
         }
diff --git a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
index 8f230c4..3e32d9b 100644
--- a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
@@ -470,9 +470,9 @@
         ScriptState::Scope scope(scriptState);
         v8::Local<v8::Context> context = scriptState->context();
         std::unique_ptr<DataEntry> dataEntry = DataEntry::create()
-            .setKey(m_v8Session->wrapObject(context, idbCursor->key(scriptState).v8Value(), indexedDBObjectGroup, false))
-            .setPrimaryKey(m_v8Session->wrapObject(context, idbCursor->primaryKey(scriptState).v8Value(), indexedDBObjectGroup, false))
-            .setValue(m_v8Session->wrapObject(context, idbCursor->value(scriptState).v8Value(), indexedDBObjectGroup, false))
+            .setKey(m_v8Session->wrapObject(context, idbCursor->key(scriptState).v8Value(), indexedDBObjectGroup))
+            .setPrimaryKey(m_v8Session->wrapObject(context, idbCursor->primaryKey(scriptState).v8Value(), indexedDBObjectGroup))
+            .setValue(m_v8Session->wrapObject(context, idbCursor->value(scriptState).v8Value(), indexedDBObjectGroup))
             .build();
         m_result->addItem(std::move(dataEntry));
     }
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn
index 0d87250..92e9fcdd 100644
--- a/third_party/WebKit/Source/platform/BUILD.gn
+++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -196,6 +196,8 @@
   ]
   sources = [
     "inspector_protocol/CodeGenerator.py",
+    "inspector_protocol/Exported_h.template",
+    "inspector_protocol/Imported_h.template",
     "inspector_protocol/TypeBuilder_cpp.template",
     "inspector_protocol/TypeBuilder_h.template",
   ]
@@ -213,6 +215,8 @@
     "$blink_platform_output_dir/v8_inspector/protocol/Profiler.h",
     "$blink_platform_output_dir/v8_inspector/protocol/Runtime.cpp",
     "$blink_platform_output_dir/v8_inspector/protocol/Runtime.h",
+    "$blink_platform_output_dir/v8_inspector/public/protocol/Runtime.h",
+    "$blink_platform_output_dir/v8_inspector/public/protocol/Debugger.h",
   ]
 
   args = [
@@ -227,6 +231,11 @@
                 root_build_dir),
     "--output_package",
     "platform/v8_inspector/protocol",
+    "--exported_dir",
+    rebase_path(blink_platform_output_dir + "/v8_inspector/public/protocol",
+                root_build_dir),
+    "--exported_package",
+    "platform/v8_inspector/public/protocol",
   ]
 }
 
diff --git a/third_party/WebKit/Source/platform/LifecycleNotifier.h b/third_party/WebKit/Source/platform/LifecycleNotifier.h
index 11f3e65..c38d3da 100644
--- a/third_party/WebKit/Source/platform/LifecycleNotifier.h
+++ b/third_party/WebKit/Source/platform/LifecycleNotifier.h
@@ -86,7 +86,7 @@
 template<typename T, typename Observer>
 inline LifecycleNotifier<T, Observer>::~LifecycleNotifier()
 {
-    // FIXME: Enable the following ASSERT. Also see a FIXME in Document::detach().
+    // FIXME: Enable the following ASSERT. Also see a FIXME in Document::detachLayoutTree().
     // ASSERT(!m_observers.size());
 }
 
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py b/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
index c785c79..34462ae 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
+++ b/third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py
@@ -43,10 +43,13 @@
 cmdline_parser = optparse.OptionParser()
 cmdline_parser.add_option("--protocol")
 cmdline_parser.add_option("--include")
+cmdline_parser.add_option("--include_package")
 cmdline_parser.add_option("--string_type")
 cmdline_parser.add_option("--export_macro")
 cmdline_parser.add_option("--output_dir")
 cmdline_parser.add_option("--output_package")
+cmdline_parser.add_option("--exported_dir")
+cmdline_parser.add_option("--exported_package")
 
 try:
     arg_options, arg_values = cmdline_parser.parse_args()
@@ -54,12 +57,23 @@
     if not protocol_file:
         raise Exception("Protocol directory must be specified")
     include_file = arg_options.include
+    include_package = arg_options.include_package
+    if include_file and not include_package:
+        raise Exception("Include package must be specified when using include file")
+    if include_package and not include_file:
+        raise Exception("Include file must be specified when using include package")
     output_dirname = arg_options.output_dir
     if not output_dirname:
         raise Exception("Output directory must be specified")
     output_package = arg_options.output_package
     if not output_package:
         raise Exception("Output package must be specified")
+    exported_dirname = arg_options.exported_dir
+    if not exported_dirname:
+        exported_dirname = os.path.join(output_dirname, "exported")
+    exported_package = arg_options.exported_package
+    if not exported_package:
+        exported_package = os.path.join(output_package, "exported")
     string_type = arg_options.string_type
     if not string_type:
         raise Exception("String type must be specified")
@@ -84,24 +98,28 @@
         os.path.getmtime(__file__),
         os.path.getmtime(os.path.join(templates_dir, "TypeBuilder_h.template")),
         os.path.getmtime(os.path.join(templates_dir, "TypeBuilder_cpp.template")),
+        os.path.getmtime(os.path.join(templates_dir, "Exported_h.template")),
+        os.path.getmtime(os.path.join(templates_dir, "Imported_h.template")),
         os.path.getmtime(protocol_file))
 
     for domain in parsed_json["domains"]:
         name = domain["domain"]
-        h_path = os.path.join(output_dirname, name + ".h")
-        cpp_path = os.path.join(output_dirname, name + ".cpp")
-        if not os.path.exists(h_path) or not os.path.exists(cpp_path):
-            return False
-        generated_ts = max(os.path.getmtime(h_path), os.path.getmtime(cpp_path))
-        if generated_ts < template_ts:
-            return False
+        paths = []
+        if name in generate_domains:
+            paths = [os.path.join(output_dirname, name + ".h"), os.path.join(output_dirname, name + ".cpp")]
+            if domain["has_exports"]:
+                paths.append(os.path.join(exported_dirname, name + ".h"))
+        if name in include_domains and domain["has_exports"]:
+            paths = [os.path.join(output_dirname, name + '.h')]
+        for path in paths:
+            if not os.path.exists(path):
+                return False
+            generated_ts = os.path.getmtime(path)
+            if generated_ts < template_ts:
+                return False
     return True
 
 
-if up_to_date():
-    sys.exit()
-
-
 def to_title_case(name):
     return name[:1].upper() + name[1:]
 
@@ -144,12 +162,47 @@
                 continue
             if json["$ref"].find(".") == -1:
                 json["$ref"] = domain_name + "." + json["$ref"]
+        return
 
     for domain in json_api["domains"]:
         patch_full_qualified_refs_in_domain(domain, domain["domain"])
 
 
+def calculate_exports():
+    def calculate_exports_in_json(json_value):
+        has_exports = False
+        if isinstance(json_value, list):
+            for item in json_value:
+                has_exports = calculate_exports_in_json(item) or has_exports
+        if isinstance(json_value, dict):
+            has_exports = ("exported" in json_value and json_value["exported"]) or has_exports
+            for key in json_value:
+                has_exports = calculate_exports_in_json(json_value[key]) or has_exports
+        return has_exports
+
+    json_api["has_exports"] = False
+    for domain_json in json_api["domains"]:
+        domain_json["has_exports"] = calculate_exports_in_json(domain_json)
+        json_api["has_exports"] = json_api["has_exports"] or domain_json["has_exports"]
+
+
+def create_include_type_definition(domain_name, type):
+    # pylint: disable=W0622
+    return {
+        "return_type": "std::unique_ptr<protocol::%s::API::%s>" % (domain_name, type["id"]),
+        "pass_type": "std::unique_ptr<protocol::%s::API::%s>" % (domain_name, type["id"]),
+        "to_raw_type": "%s.get()",
+        "to_pass_type": "std::move(%s)",
+        "to_rvalue": "std::move(%s)",
+        "type": "std::unique_ptr<protocol::%s::API::%s>" % (domain_name, type["id"]),
+        "raw_type": "protocol::%s::API::%s" % (domain_name, type["id"]),
+        "raw_pass_type": "protocol::%s::API::%s*" % (domain_name, type["id"]),
+        "raw_return_type": "protocol::%s::API::%s*" % (domain_name, type["id"]),
+    }
+
+
 def create_user_type_definition(domain_name, type):
+    # pylint: disable=W0622
     return {
         "return_type": "std::unique_ptr<protocol::%s::%s>" % (domain_name, type["id"]),
         "pass_type": "std::unique_ptr<protocol::%s::%s>" % (domain_name, type["id"]),
@@ -164,6 +217,7 @@
 
 
 def create_object_type_definition():
+    # pylint: disable=W0622
     return {
         "return_type": "std::unique_ptr<protocol::DictionaryValue>",
         "pass_type": "std::unique_ptr<protocol::DictionaryValue>",
@@ -178,6 +232,7 @@
 
 
 def create_any_type_definition():
+    # pylint: disable=W0622
     return {
         "return_type": "std::unique_ptr<protocol::Value>",
         "pass_type": "std::unique_ptr<protocol::Value>",
@@ -192,6 +247,7 @@
 
 
 def create_string_type_definition(domain):
+    # pylint: disable=W0622
     return {
         "return_type": string_type,
         "pass_type": ("const %s&" % string_type),
@@ -206,6 +262,7 @@
 
 
 def create_primitive_type_definition(type):
+    # pylint: disable=W0622
     typedefs = {
         "number": "double",
         "integer": "int",
@@ -244,6 +301,7 @@
 
 
 def wrap_array_definition(type):
+    # pylint: disable=W0622
     return {
         "return_type": "std::unique_ptr<protocol::Array<%s>>" % type["raw_type"],
         "pass_type": "std::unique_ptr<protocol::Array<%s>>" % type["raw_type"],
@@ -265,15 +323,18 @@
         if not ("types" in domain):
             continue
         for type in domain["types"]:
-            if type["type"] == "object":
-                type_definitions[domain["domain"] + "." + type["id"]] = create_user_type_definition(domain["domain"], type)
+            type_name = domain["domain"] + "." + type["id"]
+            if type["type"] == "object" and domain["domain"] in include_domains:
+                type_definitions[type_name] = create_include_type_definition(domain["domain"], type)
+            elif type["type"] == "object":
+                type_definitions[type_name] = create_user_type_definition(domain["domain"], type)
             elif type["type"] == "array":
                 items_type = type["items"]["type"]
-                type_definitions[domain["domain"] + "." + type["id"]] = wrap_array_definition(type_definitions[items_type])
+                type_definitions[type_name] = wrap_array_definition(type_definitions[items_type])
             elif type["type"] == domain["domain"] + ".string":
-                type_definitions[domain["domain"] + "." + type["id"]] = create_string_type_definition(domain["domain"])
+                type_definitions[type_name] = create_string_type_definition(domain["domain"])
             else:
-                type_definitions[domain["domain"] + "." + type["id"]] = create_primitive_type_definition(type["type"])
+                type_definitions[type_name] = create_primitive_type_definition(type["type"])
 
 
 def type_definition(name):
@@ -303,7 +364,25 @@
     return False
 
 
+def generate(domain_object, template, file_name):
+    template_context = {
+        "domain": domain_object,
+        "join_arrays": join_arrays,
+        "resolve_type": resolve_type,
+        "type_definition": type_definition,
+        "has_disable": has_disable,
+        "export_macro": export_macro,
+        "output_package": output_package,
+        "exported_package": exported_package,
+        "include_package": include_package
+    }
+    out_file = output_file(file_name)
+    out_file.write(template.render(template_context))
+    out_file.close()
+
+
 generate_domains = []
+include_domains = []
 json_api = {}
 json_api["domains"] = parsed_json["domains"]
 
@@ -314,44 +393,33 @@
     input_file = open(include_file, "r")
     json_string = input_file.read()
     parsed_json = json.loads(json_string)
+    for domain in parsed_json["domains"]:
+        include_domains.append(domain["domain"])
     json_api["domains"] += parsed_json["domains"]
 
-
 patch_full_qualified_refs()
+calculate_exports()
 create_type_definitions()
 
+if up_to_date():
+    sys.exit()
 if not os.path.exists(output_dirname):
     os.mkdir(output_dirname)
+if json_api["has_exports"] and not os.path.exists(exported_dirname):
+    os.mkdir(exported_dirname)
+
 jinja_env = initialize_jinja_env(output_dirname)
-
-h_template_name = "/TypeBuilder_h.template"
-cpp_template_name = "/TypeBuilder_cpp.template"
-h_template = jinja_env.get_template(h_template_name)
-cpp_template = jinja_env.get_template(cpp_template_name)
-
-
-def generate(domain):
-    class_name = domain["domain"]
-    h_file_name = output_dirname + "/" + class_name + ".h"
-    cpp_file_name = output_dirname + "/" + class_name + ".cpp"
-
-    template_context = {
-        "domain": domain,
-        "join_arrays": join_arrays,
-        "resolve_type": resolve_type,
-        "type_definition": type_definition,
-        "has_disable": has_disable,
-        "export_macro": export_macro,
-        "output_package": output_package,
-    }
-    h_file = output_file(h_file_name)
-    cpp_file = output_file(cpp_file_name)
-    h_file.write(h_template.render(template_context))
-    cpp_file.write(cpp_template.render(template_context))
-    h_file.close()
-    cpp_file.close()
-
+h_template = jinja_env.get_template("/TypeBuilder_h.template")
+cpp_template = jinja_env.get_template("/TypeBuilder_cpp.template")
+exported_template = jinja_env.get_template("/Exported_h.template")
+imported_template = jinja_env.get_template("/Imported_h.template")
 
 for domain in json_api["domains"]:
+    class_name = domain["domain"]
     if domain["domain"] in generate_domains:
-        generate(domain)
+        generate(domain, h_template, output_dirname + "/" + class_name + ".h")
+        generate(domain, cpp_template, output_dirname + "/" + class_name + ".cpp")
+        if domain["has_exports"]:
+            generate(domain, exported_template, exported_dirname + "/" + class_name + ".h")
+    if domain["domain"] in include_domains and domain["has_exports"]:
+        generate(domain, imported_template, output_dirname + "/" + class_name + ".h")
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Exported_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Exported_h.template
new file mode 100644
index 0000000..5cfabc5
--- /dev/null
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Exported_h.template
@@ -0,0 +1,65 @@
+// This file is generated
+
+// Copyright (c) 2016 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 protocol_{{domain.domain}}_api_h
+#define protocol_{{domain.domain}}_api_h
+
+{% if export_macro == "PLATFORM_EXPORT" %}
+#include "platform/inspector_protocol/Platform.h"
+{% else %}
+#include "core/CoreExport.h"
+{% endif %}
+#include "platform/inspector_protocol/String16.h"
+
+namespace blink {
+namespace protocol {
+namespace {{domain.domain}} {
+namespace API {
+
+// ------------- Enums.
+  {% for type in domain.types %}
+    {% if ("enum" in type) and type.exported %}
+
+namespace {{type.id}}Enum {
+      {% for literal in type.enum %}
+{{export_macro}} extern const char* {{ literal | dash_to_camelcase}};
+      {% endfor %}
+} // {{type.id}}Enum
+    {% endif %}
+  {% endfor %}
+  {% for command in join_arrays(domain, ["commands", "events"]) %}
+    {% for param in join_arrays(command, ["parameters", "returns"]) %}
+      {% if ("enum" in param) and (param.exported) %}
+
+namespace {{command.name | to_title_case}} {
+namespace {{param.name | to_title_case}}Enum {
+        {% for literal in param.enum %}
+{{export_macro}} extern const char* {{ literal | dash_to_camelcase}};
+        {% endfor %}
+} // {{param.name | to_title_case}}Enum
+} // {{command.name | to_title_case }}
+      {% endif %}
+    {% endfor %}
+  {% endfor %}
+
+// ------------- Types.
+  {% for type in domain.types %}
+    {% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %}
+
+class {{export_macro}} {{type.id}} {
+public:
+    virtual String16 toJSONString() const = 0;
+    virtual ~{{type.id}}() { }
+    static std::unique_ptr<protocol::{{domain.domain}}::API::{{type.id}}> fromJSONString(const String16& json);
+};
+  {% endfor %}
+
+} // namespace API
+} // namespace {{domain.domain}}
+} // namespace protocol
+} // namespace blink
+
+#endif // !defined(protocol_{{domain.domain}}_api_h)
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
new file mode 100644
index 0000000..a9abdad
--- /dev/null
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template
@@ -0,0 +1,49 @@
+// This file is generated
+
+// Copyright (c) 2016 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 protocol_{{domain.domain}}_imported_h
+#define protocol_{{domain.domain}}_imported_h
+
+#include "platform/inspector_protocol/ErrorSupport.h"
+#include "platform/inspector_protocol/ValueConversions.h"
+#include "platform/inspector_protocol/Values.h"
+#include "{{include_package}}/{{domain.domain}}.h"
+
+namespace blink {
+namespace protocol {
+  {% for type in domain.types %}
+    {% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %}
+
+template<>
+struct ValueConversions<{{domain.domain}}::API::{{type.id}}> {
+    static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
+    {
+        if (!value) {
+            errors->addError("value expected");
+            return nullptr;
+        }
+        std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.domain}}::API::{{type.id}}::fromJSONString(value->toJSONString());
+        if (!result)
+            errors->addError("cannot parse");
+        return result;
+    }
+
+    static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{type.id}}* value)
+    {
+        return SerializedValue::create(value->toJSONString());
+    }
+
+    static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{domain.domain}}::API::{{type.id}}>& value)
+    {
+        return SerializedValue::create(value->toJSONString());
+    }
+};
+  {% endfor %}
+
+} // namespace protocol
+} // namespace blink
+
+#endif // !defined(protocol_{{domain.domain}}_imported_h)
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_cpp.template b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_cpp.template
index f1a252c..e9489f4 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_cpp.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_cpp.template
@@ -7,6 +7,7 @@
 #include "{{output_package}}/{{domain.domain}}.h"
 
 #include "platform/inspector_protocol/DispatcherBase.h"
+#include "platform/inspector_protocol/Parser.h"
 
 namespace blink {
 namespace protocol {
@@ -22,7 +23,17 @@
       {% for literal in type.enum %}
 const char* {{ literal | dash_to_camelcase}} = "{{literal}}";
       {% endfor %}
-} // {{type.id}}Enum
+} // namespace {{type.id}}Enum
+      {% if type.exported %}
+
+namespace API {
+namespace {{type.id}}Enum {
+        {% for literal in type.enum %}
+const char* {{ literal | dash_to_camelcase}} = "{{literal}}";
+        {% endfor %}
+} // namespace {{type.id}}Enum
+} // namespace API
+      {% endif %}
     {% endif %}
     {% for property in type.properties %}
       {% if "enum" in property %}
@@ -81,6 +92,23 @@
     ErrorSupport errors;
     return parse(serialize().get(), &errors);
 }
+    {% if type.exported %}
+
+String16 {{type.id}}::toJSONString() const
+{
+    return serialize()->toJSONString();
+}
+
+// static
+std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const String16& json)
+{
+    ErrorSupport errors;
+    std::unique_ptr<Value> value = parseJSON(json);
+    if (!value)
+        return nullptr;
+    return protocol::{{domain.domain}}::{{type.id}}::parse(value.get(), &errors);
+}
+    {% endif %}
   {% endfor %}
 
 // ------------- Enum values from params.
@@ -94,8 +122,20 @@
         {% for literal in param.enum %}
 const char* {{ literal | to_title_case}} = "{{literal}}";
         {% endfor %}
-} // {{param.name | to_title_case}}Enum
-} // {{command.name | to_title_case }}
+} // namespace {{param.name | to_title_case}}Enum
+} // namespace {{command.name | to_title_case }}
+        {% if param.exported %}
+
+namespace API {
+namespace {{command.name | to_title_case}} {
+namespace {{param.name | to_title_case}}Enum {
+        {% for literal in param.enum %}
+const char* {{ literal | to_title_case}} = "{{literal}}";
+        {% endfor %}
+} // namespace {{param.name | to_title_case}}Enum
+} // namespace {{command.name | to_title_case }}
+} // namespace API
+        {% endif %}
       {% endif %}
     {% endfor %}
   {% endfor %}
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
index 05ca81d..d236374 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
@@ -23,9 +23,14 @@
 #include "platform/inspector_protocol/String16.h"
 #include "platform/inspector_protocol/Values.h"
 #include "platform/inspector_protocol/ValueConversions.h"
+// For each imported domain we generate a ValueConversions struct instead of a full domain definition
+// and include Domain::API version from there.
 {% for name in domain.dependencies %}
 #include "{{output_package}}/{{name}}.h"
 {% endfor %}
+{% if domain["has_exports"] %}
+#include "{{exported_package}}/{{domain.domain}}.h"
+{% endif %}
 
 namespace blink {
 namespace protocol {
@@ -53,7 +58,7 @@
       {% for literal in type.enum %}
 {{export_macro}} extern const char* {{ literal | dash_to_camelcase}};
       {% endfor %}
-} // {{type.id}}Enum
+} // namespace {{type.id}}Enum
     {% endif %}
   {% endfor %}
   {% for command in join_arrays(domain, ["commands", "events"]) %}
@@ -77,7 +82,8 @@
     {% set type_def = type_definition(domain.domain + "." + type.id)%}
 
 // {{type.description}}
-class {{export_macro}} {{type.id}} {
+class {{export_macro}} {{type.id}} {% if type.exported %}: public API::{{type.id}} {% endif %}{
+    PROTOCOL_DISALLOW_COPY({{type.id}});
 public:
     static std::unique_ptr<{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors);
 
@@ -103,6 +109,9 @@
 
     std::unique_ptr<protocol::DictionaryValue> serialize() const;
     std::unique_ptr<{{type.id}}> clone() const;
+    {% if type.exported %}
+    String16 toJSONString() const override;
+    {% endif %}
 
     template<int STATE>
     class {{type.id}}Builder {
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Values.cpp b/third_party/WebKit/Source/platform/inspector_protocol/Values.cpp
index 7d4ec24..5b8f13b4 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/Values.cpp
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Values.cpp
@@ -92,6 +92,11 @@
     return false;
 }
 
+bool Value::asSerialized(String16*) const
+{
+    return false;
+}
+
 String16 Value::toJSONString() const
 {
     String16Builder result;
@@ -188,6 +193,23 @@
     return StringValue::create(m_stringValue);
 }
 
+bool SerializedValue::asSerialized(String16* output) const
+{
+    *output = m_serializedValue;
+    return true;
+}
+
+void SerializedValue::writeJSON(String16Builder* output) const
+{
+    DCHECK(type() == TypeSerialized);
+    output->append(m_serializedValue);
+}
+
+std::unique_ptr<Value> SerializedValue::clone() const
+{
+    return SerializedValue::create(m_serializedValue);
+}
+
 DictionaryValue::~DictionaryValue()
 {
 }
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Values.h b/third_party/WebKit/Source/platform/inspector_protocol/Values.h
index 07a2cac9..48a20127 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/Values.h
+++ b/third_party/WebKit/Source/platform/inspector_protocol/Values.h
@@ -38,7 +38,8 @@
         TypeDouble,
         TypeString,
         TypeObject,
-        TypeArray
+        TypeArray,
+        TypeSerialized
     };
 
     ValueType type() const { return m_type; }
@@ -49,6 +50,7 @@
     virtual bool asDouble(double* output) const;
     virtual bool asInteger(int* output) const;
     virtual bool asString(String16* output) const;
+    virtual bool asSerialized(String16* output) const;
 
     String16 toJSONString() const;
     virtual void writeJSON(String16Builder* output) const;
@@ -123,6 +125,24 @@
     String16 m_stringValue;
 };
 
+class PLATFORM_EXPORT SerializedValue : public Value {
+public:
+    static std::unique_ptr<SerializedValue> create(const String16& value)
+    {
+        return wrapUnique(new SerializedValue(value));
+    }
+
+    bool asSerialized(String16* output) const override;
+    void writeJSON(String16Builder* output) const override;
+    std::unique_ptr<Value> clone() const override;
+
+private:
+    explicit SerializedValue(const String16& value) : Value(TypeSerialized), m_serializedValue(value) { }
+    explicit SerializedValue(const char* value) : Value(TypeSerialized), m_serializedValue(value) { }
+
+    String16 m_serializedValue;
+};
+
 class PLATFORM_EXPORT DictionaryValue : public Value {
 public:
     using Entry = std::pair<String16, Value*>;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 302b635..e1e825c 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -315,7 +315,7 @@
 
     v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
     if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
-        exceptionDetailsObject->setStackTrace(m_context->debugger()->createStackTrace(stackTrace)->buildInspectorObject());
+        exceptionDetailsObject->setStackTrace(m_context->debugger()->createStackTraceImpl(stackTrace)->buildInspectorObjectImpl());
     return exceptionDetailsObject;
 }
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
index f7e142de..2440748 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
@@ -108,7 +108,7 @@
         if (!inspectedContext)
             return;
         V8DebuggerImpl* debugger = inspectedContext->debugger();
-        std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForConsoleAPI(debugger->client()->currentTimeMS(), type, arguments, debugger->captureStackTrace(false), inspectedContext);
+        std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForConsoleAPI(debugger->client()->currentTimeMS(), type, arguments, debugger->captureStackTraceImpl(false), inspectedContext);
         debugger->ensureConsoleMessageStorage(inspectedContext->contextGroupId())->addMessage(std::move(message));
     }
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp
index 42fe95b..6a57261 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp
@@ -191,7 +191,7 @@
 {
 }
 
-void V8ConsoleMessage::setLocation(const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId)
+void V8ConsoleMessage::setLocation(const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTraceImpl> stackTrace, int scriptId)
 {
     m_url = url;
     m_lineNumber = lineNumber;
@@ -262,7 +262,7 @@
         if (!m_url.isEmpty())
             details->setUrl(m_url);
         if (m_stackTrace)
-            details->setStackTrace(m_stackTrace->buildInspectorObject());
+            details->setStackTrace(m_stackTrace->buildInspectorObjectImpl());
 
         std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapException(session, generatePreview);
 
@@ -286,7 +286,7 @@
                 arguments->addItem(std::move(messageArg));
             }
         }
-        frontend->consoleAPICalled(consoleAPITypeValue(m_type), std::move(arguments), m_contextId, m_timestamp, m_stackTrace ? m_stackTrace->buildInspectorObject() : nullptr);
+        frontend->consoleAPICalled(consoleAPITypeValue(m_type), std::move(arguments), m_contextId, m_timestamp, m_stackTrace ? m_stackTrace->buildInspectorObjectImpl() : nullptr);
         return;
     }
     NOTREACHED();
@@ -318,7 +318,7 @@
 }
 
 // static
-std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForConsoleAPI(double timestamp, ConsoleAPIType type, const std::vector<v8::Local<v8::Value>>& arguments, std::unique_ptr<V8StackTrace> stackTrace, InspectedContext* context)
+std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForConsoleAPI(double timestamp, ConsoleAPIType type, const std::vector<v8::Local<v8::Value>>& arguments, std::unique_ptr<V8StackTraceImpl> stackTrace, InspectedContext* context)
 {
     std::unique_ptr<V8ConsoleMessage> message = wrapUnique(new V8ConsoleMessage(V8MessageOrigin::kConsole, timestamp, String16()));
     if (stackTrace && !stackTrace->isEmpty()) {
@@ -349,7 +349,7 @@
 }
 
 // static
-std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException(double timestamp, const String16& messageText, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId, v8::Isolate* isolate, int contextId, v8::Local<v8::Value> exception, unsigned exceptionId)
+std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException(double timestamp, const String16& messageText, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTraceImpl> stackTrace, int scriptId, v8::Isolate* isolate, int contextId, v8::Local<v8::Value> exception, unsigned exceptionId)
 {
     std::unique_ptr<V8ConsoleMessage> message = wrapUnique(new V8ConsoleMessage(V8MessageOrigin::kException, timestamp, messageText));
     message->setLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId);
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.h b/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.h
index 923a84e..9662ba9 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.h
@@ -10,7 +10,6 @@
 #include "platform/v8_inspector/protocol/Console.h"
 #include "platform/v8_inspector/protocol/Runtime.h"
 #include "platform/v8_inspector/public/V8ConsoleTypes.h"
-#include "platform/v8_inspector/public/V8StackTrace.h"
 #include <deque>
 #include <v8.h>
 
@@ -19,7 +18,7 @@
 class InspectedContext;
 class V8DebuggerImpl;
 class V8InspectorSessionImpl;
-class V8StackTrace;
+class V8StackTraceImpl;
 
 enum class V8MessageOrigin { kConsole, kException, kRevokedException };
 
@@ -33,7 +32,7 @@
         double timestamp,
         ConsoleAPIType,
         const std::vector<v8::Local<v8::Value>>& arguments,
-        std::unique_ptr<V8StackTrace>,
+        std::unique_ptr<V8StackTraceImpl>,
         InspectedContext*);
 
     static std::unique_ptr<V8ConsoleMessage> createForException(
@@ -42,7 +41,7 @@
         const String16& url,
         unsigned lineNumber,
         unsigned columnNumber,
-        std::unique_ptr<V8StackTrace>,
+        std::unique_ptr<V8StackTraceImpl>,
         int scriptId,
         v8::Isolate*,
         int contextId,
@@ -66,7 +65,7 @@
     using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>;
     std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> wrapArguments(V8InspectorSessionImpl*, bool generatePreview) const;
     std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(V8InspectorSessionImpl*, bool generatePreview) const;
-    void setLocation(const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId);
+    void setLocation(const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTraceImpl>, int scriptId);
 
     V8MessageOrigin m_origin;
     double m_timestamp;
@@ -74,7 +73,7 @@
     String16 m_url;
     unsigned m_lineNumber;
     unsigned m_columnNumber;
-    std::unique_ptr<V8StackTrace> m_stackTrace;
+    std::unique_ptr<V8StackTraceImpl> m_stackTrace;
     int m_scriptId;
     int m_contextId;
     ConsoleAPIType m_type;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
index 2b232ef..7af2a5e 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
@@ -516,10 +516,15 @@
 {
     v8::HandleScope handles(m_isolate);
     ScriptsMap::iterator it = m_scripts.find(scriptId);
-    if (it != m_scripts.end())
-        *results = V8ContentSearchUtil::searchInTextByLines(m_session, toProtocolString(it->second->source(m_isolate)), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromMaybe(false));
-    else
+    if (it == m_scripts.end()) {
         *error = String16("No script for id: " + scriptId);
+        return;
+    }
+
+    std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = searchInTextByLinesImpl(m_session, toProtocolString(it->second->source(m_isolate)), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromMaybe(false));
+    *results = protocol::Array<protocol::Debugger::SearchMatch>::create();
+    for (size_t i = 0; i < matches.size(); ++i)
+        (*results)->addItem(std::move(matches[i]));
 }
 
 void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString,
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
index 4d84b32..d9db1a3 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
@@ -859,6 +859,11 @@
 
 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::StackTrace> stackTrace)
 {
+    return createStackTraceImpl(stackTrace);
+}
+
+std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::createStackTraceImpl(v8::Local<v8::StackTrace> stackTrace)
+{
     int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0;
     return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTraceImpl::maxCallStackSizeToCapture);
 }
@@ -1069,13 +1074,14 @@
         arguments.push_back(arg1);
     if (!arg2.IsEmpty())
         arguments.push_back(arg2);
-    ensureConsoleMessageStorage(contextGroupId)->addMessage(V8ConsoleMessage::createForConsoleAPI(m_client->currentTimeMS(), ConsoleAPIType::kLog, arguments, captureStackTrace(false), inspectedContext));
+    ensureConsoleMessageStorage(contextGroupId)->addMessage(V8ConsoleMessage::createForConsoleAPI(m_client->currentTimeMS(), ConsoleAPIType::kLog, arguments, captureStackTraceImpl(false), inspectedContext));
 }
 
 void V8DebuggerImpl::exceptionThrown(int contextGroupId, const String16& errorMessage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId)
 {
+    std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8StackTraceImpl*>(stackTrace.release()));
     unsigned exceptionId = ++m_lastExceptionId;
-    std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createForException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumber, std::move(stackTrace), scriptId, m_isolate, 0, v8::Local<v8::Value>(), exceptionId);
+    std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createForException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumber, std::move(stackTraceImpl), scriptId, m_isolate, 0, v8::Local<v8::Value>(), exceptionId);
     ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMessage));
 }
 
@@ -1084,8 +1090,9 @@
     int contextGroupId = getGroupId(context);
     if (!contextGroupId)
         return 0;
+    std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8StackTraceImpl*>(stackTrace.release()));
     unsigned exceptionId = ++m_lastExceptionId;
-    std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createForException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumber, std::move(stackTrace), scriptId, m_isolate, contextId(context), exception, exceptionId);
+    std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createForException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumber, std::move(stackTraceImpl), scriptId, m_isolate, contextId(context), exception, exceptionId);
     ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMessage));
     return exceptionId;
 }
@@ -1102,6 +1109,11 @@
 
 std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(bool fullStack)
 {
+    return captureStackTraceImpl(fullStack);
+}
+
+std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::captureStackTraceImpl(bool fullStack)
+{
     if (!m_isolate->InContext())
         return nullptr;
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
index 0be86bf..7994685b 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
@@ -120,6 +120,8 @@
     void enableStackCapturingIfNeeded();
     void disableStackCapturingIfNeeded();
     V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId);
+    std::unique_ptr<V8StackTraceImpl> createStackTraceImpl(v8::Local<v8::StackTrace>);
+    std::unique_ptr<V8StackTraceImpl> captureStackTraceImpl(bool fullStack);
 
     // V8Debugger implementation
     std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) override;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
index fc13b3d..db89ba4 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
@@ -209,6 +209,11 @@
     return objectValue;
 }
 
+std::unique_ptr<protocol::Runtime::API::RemoteObject> V8InspectorSessionImpl::wrapObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& groupName)
+{
+    return wrapObject(context, value, groupName, false);
+}
+
 std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& groupName, bool generatePreview)
 {
     ErrorString errorString;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.h
index 21753da..888c3d7 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.h
@@ -48,6 +48,8 @@
     void discardInjectedScripts();
     void reportAllContexts(V8RuntimeAgentImpl*);
     void setCustomObjectFormatterEnabled(bool);
+    std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview);
+    std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Context>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns);
 
     // V8InspectorSession implementation.
     void dispatchProtocolMessage(const String16& message) override;
@@ -61,8 +63,7 @@
     void stepOver() override;
     void releaseObjectGroup(const String16& objectGroup) override;
     v8::Local<v8::Value> findObject(ErrorString*, const String16& objectId, v8::Local<v8::Context>* = nullptr, String16* groupName = nullptr) override;
-    std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview) override;
-    std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Context>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns);
+    std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName) override;
 
     V8InspectorSession::Inspectable* inspectedObject(unsigned num);
     static const unsigned kInspectedObjectBufferSize = 5;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.cpp
index 343234c0..8221c3a 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.cpp
@@ -227,7 +227,7 @@
     return m_frames[0].m_scriptId;
 }
 
-std::unique_ptr<protocol::Runtime::StackTrace> V8StackTraceImpl::buildInspectorObject() const
+std::unique_ptr<protocol::Runtime::StackTrace> V8StackTraceImpl::buildInspectorObjectImpl() const
 {
     std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>> frames = protocol::Array<protocol::Runtime::CallFrame>::create();
     for (size_t i = 0; i < m_frames.size(); i++)
@@ -238,7 +238,7 @@
     if (!m_description.isEmpty())
         stackTrace->setDescription(m_description);
     if (m_parent)
-        stackTrace->setParent(m_parent->buildInspectorObject());
+        stackTrace->setParent(m_parent->buildInspectorObjectImpl());
     return stackTrace;
 }
 
@@ -249,7 +249,12 @@
     std::unique_ptr<V8StackTraceImpl> fullChain = V8StackTraceImpl::create(debugger, m_contextGroupId, v8::Local<v8::StackTrace>(), V8StackTraceImpl::maxCallStackSizeToCapture);
     if (!fullChain || !fullChain->m_parent)
         return nullptr;
-    return fullChain->m_parent->buildInspectorObject();
+    return fullChain->m_parent->buildInspectorObjectImpl();
+}
+
+std::unique_ptr<protocol::Runtime::API::StackTrace> V8StackTraceImpl::buildInspectorObject() const
+{
+    return buildInspectorObjectImpl();
 }
 
 String16 V8StackTraceImpl::toString() const
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.h
index 63b59e8d..c9f3137 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StackTraceImpl.h
@@ -5,7 +5,9 @@
 #ifndef V8StackTraceImpl_h
 #define V8StackTraceImpl_h
 
+#include "platform/inspector_protocol/Allocator.h"
 #include "platform/inspector_protocol/Platform.h"
+#include "platform/v8_inspector/protocol/Runtime.h"
 #include "platform/v8_inspector/public/V8StackTrace.h"
 
 #include <vector>
@@ -57,6 +59,7 @@
     std::unique_ptr<V8StackTrace> isolatedCopy() override;
     std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl();
     std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V8DebuggerImpl*) const;
+    std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl() const;
     ~V8StackTraceImpl() override;
 
     // V8StackTrace implementation.
@@ -66,7 +69,7 @@
     int topColumnNumber() const override;
     String16 topScriptId() const override;
     String16 topFunctionName() const override;
-    std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObject() const override;
+    std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() const override;
     String16 toString() const override;
 
 private:
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
index 4ba7898b..843c7c0 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
@@ -182,6 +182,17 @@
     return toProtocolString(value.As<v8::String>());
 }
 
+std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLinesImpl(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
+{
+    std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->debugger(), query, caseSensitive, isRegex);
+    std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*regex.get(), text);
+
+    std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result;
+    for (const auto& match : matches)
+        result.push_back(buildObjectForSearchMatch(match.first, match.second));
+    return result;
+}
+
 namespace V8ContentSearchUtil {
 
 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated)
@@ -194,15 +205,12 @@
     return findMagicComment(content, "sourceMappingURL", multiline, deprecated);
 }
 
-std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> searchInTextByLines(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
+std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> searchInTextByLines(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
 {
-    std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> result = protocol::Array<protocol::Debugger::SearchMatch>::create();
-    std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->debugger(), query, caseSensitive, isRegex);
-    std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*regex.get(), text);
-
-    for (const auto& match : matches)
-        result->addItem(buildObjectForSearchMatch(match.first, match.second));
-
+    std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = searchInTextByLinesImpl(session, text, query, caseSensitive, isRegex);
+    std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> result = protocol::Array<protocol::Debugger::API::SearchMatch>::create();
+    for (size_t i = 0; i < matches.size(); ++i)
+        result->addItem(std::move(matches[i]));
     return result;
 }
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.h b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.h
index 2d42613d..47e5018 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.h
@@ -7,10 +7,13 @@
 
 #include "platform/inspector_protocol/String16.h"
 #include "platform/inspector_protocol/Values.h"
+#include "platform/v8_inspector/protocol/Debugger.h"
 #include <v8.h>
 
 namespace blink {
 
+class V8InspectorSession;
+
 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context>, v8::Local<v8::Value>, int maxDepth = protocol::Value::maxDepth);
 
 v8::Local<v8::String> toV8String(v8::Isolate*, const String16&);
@@ -19,6 +22,8 @@
 String16 toProtocolString(v8::Local<v8::String>);
 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value>);
 
+std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLinesImpl(V8InspectorSession*, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex);
+
 } //  namespace blink
 
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json b/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json
index 78548bc..387ef9a 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json
+++ b/third_party/WebKit/Source/platform/v8_inspector/js_protocol.json
@@ -18,6 +18,7 @@
                 "id": "RemoteObject",
                 "type": "object",
                 "description": "Mirror object referencing original JavaScript object.",
+                "exported": true,
                 "properties": [
                     { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." },
                     { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
@@ -166,6 +167,7 @@
                 "id": "StackTrace",
                 "type": "object",
                 "description": "Call frames for assertions or error messages.",
+                "exported": true,
                 "properties": [
                     { "name": "description", "type": "string", "optional": true, "description": "String label of this stack trace. For async traces this may be a name of the function that initiated the async call." },
                     { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "JavaScript function name." },
@@ -427,6 +429,7 @@
                 "id": "SearchMatch",
                 "type": "object",
                 "description": "Search match for resource.",
+                "exported": true,
                 "properties": [
                     { "name": "lineNumber", "type": "number", "description": "Line number in resource content." },
                     { "name": "lineContent", "type": "string", "description": "Line with match content." }
@@ -700,7 +703,7 @@
                 "name": "paused",
                 "parameters": [
                     { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." },
-                    { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "debugCommand", "promiseRejection", "other" ], "description": "Pause reason." },
+                    { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "debugCommand", "promiseRejection", "other" ], "description": "Pause reason.", "exported": true },
                     { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." },
                     { "name": "hitBreakpoints", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Hit breakpoints IDs", "hidden": true },
                     { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any.", "hidden": true }
diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8ContentSearchUtil.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8ContentSearchUtil.h
index a932b7a..0faaf78 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/public/V8ContentSearchUtil.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8ContentSearchUtil.h
@@ -7,7 +7,7 @@
 
 #include "platform/inspector_protocol/Platform.h"
 #include "platform/inspector_protocol/String16.h"
-#include "platform/v8_inspector/protocol/Debugger.h"
+#include "platform/v8_inspector/public/protocol/Debugger.h"
 
 namespace blink {
 
@@ -17,7 +17,7 @@
 
 PLATFORM_EXPORT String16 findSourceURL(const String16& content, bool multiline, bool* deprecated = nullptr);
 PLATFORM_EXPORT String16 findSourceMapURL(const String16& content, bool multiline, bool* deprecated = nullptr);
-PLATFORM_EXPORT std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> searchInTextByLines(V8InspectorSession*, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex);
+PLATFORM_EXPORT std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> searchInTextByLines(V8InspectorSession*, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex);
 
 }
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8InspectorSession.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8InspectorSession.h
index 2103467..6d3caae 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/public/V8InspectorSession.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8InspectorSession.h
@@ -6,7 +6,7 @@
 #define V8InspectorSession_h
 
 #include "platform/inspector_protocol/Platform.h"
-#include "platform/v8_inspector/protocol/Runtime.h"
+#include "platform/v8_inspector/public/protocol/Runtime.h"
 
 #include <v8.h>
 
@@ -40,7 +40,7 @@
 
     // Remote objects.
     static const char backtraceObjectGroup[];
-    virtual std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview) = 0;
+    virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName) = 0;
     virtual v8::Local<v8::Value> findObject(ErrorString*, const String16& objectId, v8::Local<v8::Context>* = nullptr, String16* objectGroup = nullptr) = 0;
     virtual void releaseObjectGroup(const String16&) = 0;
 };
diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8StackTrace.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8StackTrace.h
index beee115..2935eef 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/public/V8StackTrace.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8StackTrace.h
@@ -7,7 +7,7 @@
 
 #include "platform/inspector_protocol/Platform.h"
 #include "platform/inspector_protocol/String16.h"
-#include "platform/v8_inspector/protocol/Runtime.h"
+#include "platform/v8_inspector/public/protocol/Runtime.h"
 
 #include <v8.h>
 
@@ -24,7 +24,7 @@
     virtual String16 topFunctionName() const = 0;
 
     virtual ~V8StackTrace() { }
-    virtual std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObject() const = 0;
+    virtual std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() const = 0;
     virtual String16 toString() const = 0;
     virtual std::unique_ptr<V8StackTrace> clone() = 0;
     virtual std::unique_ptr<V8StackTrace> isolatedCopy() = 0; // Safe to pass between threads.
diff --git a/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp b/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp
index 48e7ee1..60ac3c0 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp
+++ b/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp
@@ -79,6 +79,8 @@
             # Source code templates.
             '../inspector_protocol/TypeBuilder_h.template',
             '../inspector_protocol/TypeBuilder_cpp.template',
+            '../inspector_protocol/Exported_h.template',
+            '../inspector_protocol/Imported_h.template',
             # Protocol definitions
             'js_protocol.json',
           ],
@@ -93,6 +95,8 @@
             '<(blink_platform_output_dir)/v8_inspector/protocol/Profiler.h',
             '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.cpp',
             '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.h',
+            '<(blink_platform_output_dir)/v8_inspector/public/protocol/Runtime.h',
+            '<(blink_platform_output_dir)/v8_inspector/public/protocol/Debugger.h',
           ],
           'action': [
             'python',
@@ -102,6 +106,8 @@
             '--export_macro', 'PLATFORM_EXPORT',
             '--output_dir', '<(blink_platform_output_dir)/v8_inspector/protocol',
             '--output_package', 'platform/v8_inspector/protocol',
+            '--exported_dir', '<(blink_platform_output_dir)/v8_inspector/public/protocol',
+            '--exported_package', 'platform/v8_inspector/public/protocol',
           ],
           'message': 'Generating protocol backend sources from json definitions.',
         },
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 34ec122..3d7d4d3 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -378,7 +378,7 @@
 
     // Simulate detaching the document from its DOM window. This should not
     // cause a crash when the WebViewImpl is closed by the test runner.
-    frame()->document()->detach();
+    frame()->document()->detachLayoutTree();
 }
 
 TEST_F(ScrollingCoordinatorTest, clippedBodyTest)
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
index e83429b7..cca822ef 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -1634,9 +1634,9 @@
     navigateTo(m_baseURL + "content-width-1000-min-scale.html");
 
     WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl();
-    // The detach() and dispose() calls are a hack to prevent this test
+    // The detachLayoutTree() and dispose() calls are a hack to prevent this test
     // from violating invariants about frame state during navigation/detach.
-    localFrame->frame()->document()->detach();
+    localFrame->frame()->document()->detachLayoutTree();
     localFrame->createFrameView();
 
     FrameView& frameView = *localFrame->frameView();
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 762ed80..6437329 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -385,9 +385,9 @@
     EXPECT_EQ(kTransparent, webView->backgroundColor());
 
     LocalFrame* frame = webView->mainFrameImpl()->frame();
-    // The detach() and dispose() calls are a hack to prevent this test
+    // The detachLayoutTree() and dispose() calls are a hack to prevent this test
     // from violating invariants about frame state during navigation/detach.
-    frame->document()->detach();
+    frame->document()->detachLayoutTree();
 
     // Creating a new frame view with the background color having 0 alpha.
     frame->createView(IntSize(1024, 768), Color::transparent, true);