[go: nahoru, domu]

Split cc/base into separate GN source_set and clean deps

//cc/base is intended to be a set of low level utilities used by the rest
of cc (and consumers of cc) and as such shouldn't contain dependencies
on other parts of //cc. This splits the //cc/base files into a separate
GN source_set so 'gn check' can examine dependencies and moves a few
types that have dependencies on other types out:

swap_promise is conceptually about swapping frames, so it goes into
cc/output

*swap_promise_monitor is dealing with swaps on trees, so it goes in
cc/trees

R=danakj@chromium.org

Review URL: https://codereview.chromium.org/1002073002

Cr-Commit-Position: refs/heads/master@{#320796}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 2327db0..bd8bfdd 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -38,39 +38,6 @@
     "animation/transform_operation.h",
     "animation/transform_operations.cc",
     "animation/transform_operations.h",
-    "base/completion_event.h",
-    "base/delayed_unique_notifier.cc",
-    "base/delayed_unique_notifier.h",
-    "base/invalidation_region.cc",
-    "base/invalidation_region.h",
-    "base/latency_info_swap_promise.cc",
-    "base/latency_info_swap_promise.h",
-    "base/latency_info_swap_promise_monitor.cc",
-    "base/latency_info_swap_promise_monitor.h",
-    "base/math_util.cc",
-    "base/math_util.h",
-    "base/ref_counted_managed.h",
-    "base/region.cc",
-    "base/region.h",
-    "base/rolling_time_delta_history.cc",
-    "base/rolling_time_delta_history.h",
-    "base/scoped_ptr_algorithm.h",
-    "base/scoped_ptr_deque.h",
-    "base/scoped_ptr_vector.h",
-    "base/simple_enclosed_region.cc",
-    "base/simple_enclosed_region.h",
-    "base/swap_promise.h",
-    "base/swap_promise_monitor.cc",
-    "base/swap_promise_monitor.h",
-    "base/switches.cc",
-    "base/switches.h",
-    "base/synced_property.h",
-    "base/tiling_data.cc",
-    "base/tiling_data.h",
-    "base/time_util.h",
-    "base/unique_notifier.cc",
-    "base/unique_notifier.h",
-    "base/util.h",
     "debug/benchmark_instrumentation.cc",
     "debug/benchmark_instrumentation.h",
     "debug/debug_colors.cc",
@@ -267,6 +234,8 @@
     "output/gl_renderer.h",
     "output/gl_renderer_draw_cache.cc",
     "output/gl_renderer_draw_cache.h",
+    "output/latency_info_swap_promise.cc",
+    "output/latency_info_swap_promise.h",
     "output/managed_memory_policy.cc",
     "output/managed_memory_policy.h",
     "output/output_surface.cc",
@@ -299,6 +268,7 @@
     "output/software_renderer.h",
     "output/static_geometry_binding.cc",
     "output/static_geometry_binding.h",
+    "output/swap_promise.h",
     "output/viewport_selection_bound.cc",
     "output/viewport_selection_bound.h",
     "output/vsync_parameter_observer.h",
@@ -510,6 +480,8 @@
     "trees/damage_tracker.h",
     "trees/draw_property_utils.cc",
     "trees/draw_property_utils.h",
+    "trees/latency_info_swap_promise_monitor.cc",
+    "trees/latency_info_swap_promise_monitor.h",
     "trees/layer_tree_host.cc",
     "trees/layer_tree_host.h",
     "trees/layer_tree_host_client.h",
@@ -537,6 +509,8 @@
     "trees/scoped_abort_remaining_swap_promises.h",
     "trees/single_thread_proxy.cc",
     "trees/single_thread_proxy.h",
+    "trees/swap_promise_monitor.cc",
+    "trees/swap_promise_monitor.h",
     "trees/thread_proxy.cc",
     "trees/thread_proxy.h",
     "trees/tree_synchronizer.cc",
@@ -547,6 +521,7 @@
   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
 
   public_deps = [
+    "//cc/base",
     "//skia",
   ]
   deps = [
diff --git a/cc/base/BUILD.gn b/cc/base/BUILD.gn
new file mode 100644
index 0000000..203f84a
--- /dev/null
+++ b/cc/base/BUILD.gn
@@ -0,0 +1,51 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+source_set("base") {
+  visibility = [ "//cc" ]
+
+  sources = [
+    "completion_event.h",
+    "delayed_unique_notifier.cc",
+    "delayed_unique_notifier.h",
+    "invalidation_region.cc",
+    "invalidation_region.h",
+    "math_util.cc",
+    "math_util.h",
+    "ref_counted_managed.h",
+    "region.cc",
+    "region.h",
+    "rolling_time_delta_history.cc",
+    "rolling_time_delta_history.h",
+    "scoped_ptr_algorithm.h",
+    "scoped_ptr_deque.h",
+    "scoped_ptr_vector.h",
+    "simple_enclosed_region.cc",
+    "simple_enclosed_region.h",
+    "switches.cc",
+    "switches.h",
+    "synced_property.h",
+    "tiling_data.cc",
+    "tiling_data.h",
+    "time_util.h",
+    "unique_notifier.cc",
+    "unique_notifier.h",
+    "util.h",
+  ]
+
+  deps = [
+    "//base",
+    "//base/third_party/dynamic_annotations",
+    "//skia",
+    "//ui/gfx",
+    "//ui/gfx/geometry",
+  ]
+
+  defines = [ "CC_IMPLEMENTATION=1" ]
+
+  if (!is_debug && (is_win || is_android)) {
+    configs -= [ "//build/config/compiler:optimize" ]
+    configs += [ "//build/config/compiler:optimize_max" ]
+  }
+}
diff --git a/cc/base/DEPS b/cc/base/DEPS
new file mode 100644
index 0000000..33b4e8f
--- /dev/null
+++ b/cc/base/DEPS
@@ -0,0 +1,12 @@
+# Things within cc/base should not depend on things in cc/ outside of cc/base.
+include_rules = [
+  "-cc",
+  "+cc/base",
+]
+
+# Tests can use things in cc/test
+specific_include_rules = {
+  ".*unittest\.cc": [
+    "+cc/test",
+  ]
+}
diff --git a/cc/base/latency_info_swap_promise.cc b/cc/base/latency_info_swap_promise.cc
deleted file mode 100644
index 8c6ee0e..0000000
--- a/cc/base/latency_info_swap_promise.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/base/latency_info_swap_promise.h"
-
-#include "base/logging.h"
-
-namespace {
-  ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType(
-      cc::SwapPromise::DidNotSwapReason reason) {
-    switch (reason) {
-      case cc::SwapPromise::DID_NOT_SWAP_UNKNOWN:
-      case cc::SwapPromise::SWAP_FAILS:
-        return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
-      case cc::SwapPromise::COMMIT_FAILS:
-        return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT;
-      case cc::SwapPromise::COMMIT_NO_UPDATE:
-        return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT;
-    }
-    NOTREACHED() << "Unhandled DidNotSwapReason.";
-    return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
-  }
-}  // namespace
-
-namespace cc {
-
-LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
-    : latency_(latency) {
-}
-
-LatencyInfoSwapPromise::~LatencyInfoSwapPromise() {
-}
-
-void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) {
-  DCHECK(!latency_.terminated);
-  metadata->latency_info.push_back(latency_);
-}
-
-void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) {
-  latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason),
-                            0, 0);
-  // TODO(miletus): Turn this back on once per-event LatencyInfo tracking
-  // is enabled in GPU side.
-  // DCHECK(latency_.terminated);
-}
-
-int64 LatencyInfoSwapPromise::TraceId() const {
-  return latency_.trace_id;
-}
-
-}  // namespace cc
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 9dbc0f3..c796e7d8 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -69,10 +69,6 @@
         'base/delayed_unique_notifier.h',
         'base/invalidation_region.cc',
         'base/invalidation_region.h',
-        'base/latency_info_swap_promise.cc',
-        'base/latency_info_swap_promise.h',
-        'base/latency_info_swap_promise_monitor.cc',
-        'base/latency_info_swap_promise_monitor.h',
         'base/math_util.cc',
         'base/math_util.h',
         'base/ref_counted_managed.h',
@@ -85,9 +81,6 @@
         'base/scoped_ptr_vector.h',
         'base/simple_enclosed_region.cc',
         'base/simple_enclosed_region.h',
-        'base/swap_promise.h',
-        'base/swap_promise_monitor.cc',
-        'base/swap_promise_monitor.h',
         'base/switches.cc',
         'base/switches.h',
         'base/synced_property.h',
@@ -293,6 +286,8 @@
         'output/gl_renderer.h',
         'output/gl_renderer_draw_cache.cc',
         'output/gl_renderer_draw_cache.h',
+        'output/latency_info_swap_promise.cc',
+        'output/latency_info_swap_promise.h',
         'output/managed_memory_policy.cc',
         'output/managed_memory_policy.h',
         'output/output_surface.cc',
@@ -325,6 +320,7 @@
         'output/software_renderer.h',
         'output/static_geometry_binding.cc',
         'output/static_geometry_binding.h',
+        'output/swap_promise.h',
         'output/viewport_selection_bound.cc',
         'output/viewport_selection_bound.h',
         'output/vsync_parameter_observer.h',
@@ -537,6 +533,8 @@
         'trees/damage_tracker.h',
         'trees/draw_property_utils.cc',
         'trees/draw_property_utils.h',
+        'trees/latency_info_swap_promise_monitor.cc',
+        'trees/latency_info_swap_promise_monitor.h',
         'trees/layer_tree_host.cc',
         'trees/layer_tree_host.h',
         'trees/layer_tree_host_client.h',
@@ -564,6 +562,8 @@
         'trees/scoped_abort_remaining_swap_promises.h',
         'trees/single_thread_proxy.cc',
         'trees/single_thread_proxy.h',
+        'trees/swap_promise_monitor.cc',
+        'trees/swap_promise_monitor.h',
         'trees/thread_proxy.cc',
         'trees/thread_proxy.h',
         'trees/tree_synchronizer.cc',
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 954f8d73..81d91b87 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -9,8 +9,8 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/swap_promise_monitor.h"
 #include "cc/input/scrollbar.h"
+#include "cc/trees/swap_promise_monitor.h"
 
 namespace gfx {
 class Point;
diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc
index ab6289e..1a690b6e 100644
--- a/cc/layers/surface_layer.cc
+++ b/cc/layers/surface_layer.cc
@@ -4,8 +4,8 @@
 
 #include "cc/layers/surface_layer.h"
 
-#include "cc/base/swap_promise.h"
 #include "cc/layers/surface_layer_impl.h"
+#include "cc/output/swap_promise.h"
 #include "cc/trees/layer_tree_host.h"
 
 namespace cc {
diff --git a/cc/output/latency_info_swap_promise.cc b/cc/output/latency_info_swap_promise.cc
new file mode 100644
index 0000000..3c07162
--- /dev/null
+++ b/cc/output/latency_info_swap_promise.cc
@@ -0,0 +1,52 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/output/latency_info_swap_promise.h"
+
+#include "base/logging.h"
+
+namespace {
+ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType(
+    cc::SwapPromise::DidNotSwapReason reason) {
+  switch (reason) {
+    case cc::SwapPromise::DID_NOT_SWAP_UNKNOWN:
+    case cc::SwapPromise::SWAP_FAILS:
+      return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
+    case cc::SwapPromise::COMMIT_FAILS:
+      return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT;
+    case cc::SwapPromise::COMMIT_NO_UPDATE:
+      return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT;
+  }
+  NOTREACHED() << "Unhandled DidNotSwapReason.";
+  return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
+}
+}  // namespace
+
+namespace cc {
+
+LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
+    : latency_(latency) {
+}
+
+LatencyInfoSwapPromise::~LatencyInfoSwapPromise() {
+}
+
+void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) {
+  DCHECK(!latency_.terminated);
+  metadata->latency_info.push_back(latency_);
+}
+
+void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) {
+  latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0,
+                            0);
+  // TODO(miletus): Turn this back on once per-event LatencyInfo tracking
+  // is enabled in GPU side.
+  // DCHECK(latency_.terminated);
+}
+
+int64 LatencyInfoSwapPromise::TraceId() const {
+  return latency_.trace_id;
+}
+
+}  // namespace cc
diff --git a/cc/base/latency_info_swap_promise.h b/cc/output/latency_info_swap_promise.h
similarity index 78%
rename from cc/base/latency_info_swap_promise.h
rename to cc/output/latency_info_swap_promise.h
index a7941f1..afd1633 100644
--- a/cc/base/latency_info_swap_promise.h
+++ b/cc/output/latency_info_swap_promise.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
-#define CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
+#ifndef CC_OUTPUT_LATENCY_INFO_SWAP_PROMISE_H_
+#define CC_OUTPUT_LATENCY_INFO_SWAP_PROMISE_H_
 
 #include "base/compiler_specific.h"
-#include "cc/base/swap_promise.h"
+#include "cc/output/swap_promise.h"
 #include "ui/events/latency_info.h"
 
 namespace cc {
@@ -27,4 +27,4 @@
 
 }  // namespace cc
 
-#endif  // CC_BASE_LATENCY_INFO_SWAP_PROMISE_H_
+#endif  // CC_OUTPUT_LATENCY_INFO_SWAP_PROMISE_H_
diff --git a/cc/base/swap_promise.h b/cc/output/swap_promise.h
similarity index 94%
rename from cc/base/swap_promise.h
rename to cc/output/swap_promise.h
index a406fda6..1d6dabcb 100644
--- a/cc/base/swap_promise.h
+++ b/cc/output/swap_promise.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CC_BASE_SWAP_PROMISE_H_
-#define CC_BASE_SWAP_PROMISE_H_
+#ifndef CC_OUTPUT_SWAP_PROMISE_H_
+#define CC_OUTPUT_SWAP_PROMISE_H_
 
 #include "cc/output/compositor_frame_metadata.h"
 
@@ -50,4 +50,4 @@
 
 }  // namespace cc
 
-#endif  // CC_BASE_SWAP_PROMISE_H_
+#endif  // CC_OUTPUT_SWAP_PROMISE_H_
diff --git a/cc/base/latency_info_swap_promise_monitor.cc b/cc/trees/latency_info_swap_promise_monitor.cc
similarity index 87%
rename from cc/base/latency_info_swap_promise_monitor.cc
rename to cc/trees/latency_info_swap_promise_monitor.cc
index de065d1..10d9380 100644
--- a/cc/base/latency_info_swap_promise_monitor.cc
+++ b/cc/trees/latency_info_swap_promise_monitor.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "cc/base/latency_info_swap_promise_monitor.h"
+#include "cc/trees/latency_info_swap_promise_monitor.h"
 
 #include "base/threading/platform_thread.h"
-#include "cc/base/latency_info_swap_promise.h"
+#include "cc/output/latency_info_swap_promise.h"
 #include "cc/trees/layer_tree_host.h"
 #include "cc/trees/layer_tree_host_impl.h"
 #include "cc/trees/layer_tree_impl.h"
@@ -14,9 +14,9 @@
 
 bool AddRenderingScheduledComponent(ui::LatencyInfo* latency_info,
                                     bool on_main) {
-  ui::LatencyComponentType type = on_main ?
-      ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT :
-      ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT;
+  ui::LatencyComponentType type =
+      on_main ? ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT
+              : ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT;
   if (latency_info->FindLatency(type, 0, nullptr))
     return false;
   latency_info->AddLatencyNumber(type, 0, 0);
@@ -25,13 +25,11 @@
 
 bool AddForwardingScrollUpdateToMainComponent(ui::LatencyInfo* latency_info) {
   if (latency_info->FindLatency(
-          ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT,
-          0,
+          ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, 0,
           nullptr))
     return false;
   latency_info->AddLatencyNumber(
-      ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT,
-      0,
+      ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, 0,
       latency_info->trace_id);
   return true;
 }
@@ -45,9 +43,11 @@
     LayerTreeHost* layer_tree_host,
     LayerTreeHostImpl* layer_tree_host_impl)
     : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
-      latency_(latency) {}
+      latency_(latency) {
+}
 
-LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {}
+LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {
+}
 
 void LatencyInfoSwapPromiseMonitor::OnSetNeedsCommitOnMain() {
   if (AddRenderingScheduledComponent(latency_, true /* on_main */)) {
@@ -68,8 +68,7 @@
     int64 new_sequence_number = 0;
     for (ui::LatencyInfo::LatencyMap::const_iterator it =
              latency_->latency_components.begin();
-         it != latency_->latency_components.end();
-         ++it) {
+         it != latency_->latency_components.end(); ++it) {
       if (it->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) {
         new_sequence_number =
             (static_cast<int64>(base::PlatformThread::CurrentId()) << 32) |
@@ -82,8 +81,7 @@
       return;
     ui::LatencyInfo new_latency;
     new_latency.AddLatencyNumber(
-        ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT,
-        0,
+        ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, 0,
         new_sequence_number);
     new_latency.TraceEventType("ScrollUpdate");
     new_latency.CopyLatencyFrom(
diff --git a/cc/base/latency_info_swap_promise_monitor.h b/cc/trees/latency_info_swap_promise_monitor.h
similarity index 82%
rename from cc/base/latency_info_swap_promise_monitor.h
rename to cc/trees/latency_info_swap_promise_monitor.h
index d9e71fbd..c1d9973 100644
--- a/cc/base/latency_info_swap_promise_monitor.h
+++ b/cc/trees/latency_info_swap_promise_monitor.h
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "base/compiler_specific.h"
-#include "cc/base/swap_promise_monitor.h"
+#include "cc/trees/swap_promise_monitor.h"
 
-#ifndef CC_BASE_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
-#define CC_BASE_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
+#ifndef CC_TREES_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
+#define CC_TREES_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
 
 namespace ui {
 struct LatencyInfo;
@@ -34,4 +34,4 @@
 
 }  // namespace cc
 
-#endif  // CC_BASE_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
+#endif  // CC_TREES_LATENCY_INFO_SWAP_PROMISE_MONITOR_H_
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 1474e6e..1379d089 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -21,8 +21,6 @@
 #include "cc/animation/animation_events.h"
 #include "cc/base/cc_export.h"
 #include "cc/base/scoped_ptr_vector.h"
-#include "cc/base/swap_promise.h"
-#include "cc/base/swap_promise_monitor.h"
 #include "cc/debug/micro_benchmark.h"
 #include "cc/debug/micro_benchmark_controller.h"
 #include "cc/input/input_handler.h"
@@ -32,6 +30,7 @@
 #include "cc/layers/layer_lists.h"
 #include "cc/output/output_surface.h"
 #include "cc/output/renderer_capabilities.h"
+#include "cc/output/swap_promise.h"
 #include "cc/resources/resource_format.h"
 #include "cc/resources/scoped_ui_resource.h"
 #include "cc/surfaces/surface_sequence.h"
@@ -39,6 +38,7 @@
 #include "cc/trees/layer_tree_host_common.h"
 #include "cc/trees/layer_tree_settings.h"
 #include "cc/trees/proxy.h"
+#include "cc/trees/swap_promise_monitor.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/gfx/geometry/rect.h"
 
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 8a603fa..a8d4294 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -18,7 +18,6 @@
 #include "cc/animation/scroll_offset_animation_curve.h"
 #include "cc/animation/scrollbar_animation_controller.h"
 #include "cc/animation/timing_function.h"
-#include "cc/base/latency_info_swap_promise_monitor.h"
 #include "cc/base/math_util.h"
 #include "cc/base/util.h"
 #include "cc/debug/benchmark_instrumentation.h"
@@ -65,13 +64,14 @@
 #include "cc/resources/zero_copy_tile_task_worker_pool.h"
 #include "cc/scheduler/delay_based_time_source.h"
 #include "cc/trees/damage_tracker.h"
+#include "cc/trees/latency_info_swap_promise_monitor.h"
 #include "cc/trees/layer_tree_host.h"
 #include "cc/trees/layer_tree_host_common.h"
 #include "cc/trees/layer_tree_impl.h"
 #include "cc/trees/single_thread_proxy.h"
 #include "cc/trees/tree_synchronizer.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
 #include "gpu/GLES2/gl2extchromium.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
 #include "ui/gfx/frame_time.h"
 #include "ui/gfx/geometry/rect_conversions.h"
 #include "ui/gfx/geometry/scroll_offset.h"
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 4289a99..8056387b 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -12,7 +12,6 @@
 #include "base/containers/hash_tables.h"
 #include "base/containers/scoped_ptr_hash_map.h"
 #include "cc/animation/scrollbar_animation_controller_thinning.h"
-#include "cc/base/latency_info_swap_promise.h"
 #include "cc/base/math_util.h"
 #include "cc/input/page_scale_animation.h"
 #include "cc/input/top_controls_manager.h"
@@ -34,6 +33,7 @@
 #include "cc/output/copy_output_request.h"
 #include "cc/output/copy_output_result.h"
 #include "cc/output/gl_renderer.h"
+#include "cc/output/latency_info_swap_promise.h"
 #include "cc/quads/render_pass_draw_quad.h"
 #include "cc/quads/solid_color_draw_quad.h"
 #include "cc/quads/texture_draw_quad.h"
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 51f0ff7..8b0983b2 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -9,7 +9,6 @@
 #include "base/auto_reset.h"
 #include "base/synchronization/lock.h"
 #include "cc/animation/timing_function.h"
-#include "cc/base/swap_promise.h"
 #include "cc/debug/frame_rate_counter.h"
 #include "cc/layers/content_layer.h"
 #include "cc/layers/content_layer_client.h"
@@ -24,6 +23,7 @@
 #include "cc/output/copy_output_request.h"
 #include "cc/output/copy_output_result.h"
 #include "cc/output/output_surface.h"
+#include "cc/output/swap_promise.h"
 #include "cc/quads/draw_quad.h"
 #include "cc/quads/io_surface_draw_quad.h"
 #include "cc/quads/tile_draw_quad.h"
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 5aee835..15e0f0c 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -12,12 +12,12 @@
 #include "base/containers/hash_tables.h"
 #include "base/values.h"
 #include "cc/base/scoped_ptr_vector.h"
-#include "cc/base/swap_promise.h"
 #include "cc/base/synced_property.h"
 #include "cc/input/layer_selection_bound.h"
 #include "cc/layers/layer_impl.h"
 #include "cc/output/begin_frame_args.h"
 #include "cc/output/renderer.h"
+#include "cc/output/swap_promise.h"
 #include "cc/resources/ui_resource_client.h"
 #include "cc/trees/layer_tree_host_impl.h"
 
diff --git a/cc/trees/scoped_abort_remaining_swap_promises.h b/cc/trees/scoped_abort_remaining_swap_promises.h
index f8dfc01..e35fbf9 100644
--- a/cc/trees/scoped_abort_remaining_swap_promises.h
+++ b/cc/trees/scoped_abort_remaining_swap_promises.h
@@ -5,7 +5,7 @@
 #ifndef CC_TREES_SCOPED_ABORT_REMAINING_SWAP_PROMISES_H_
 #define CC_TREES_SCOPED_ABORT_REMAINING_SWAP_PROMISES_H_
 
-#include "cc/base/swap_promise.h"
+#include "cc/output/swap_promise.h"
 #include "cc/trees/layer_tree_host.h"
 
 namespace cc {
diff --git a/cc/base/swap_promise_monitor.cc b/cc/trees/swap_promise_monitor.cc
similarity index 95%
rename from cc/base/swap_promise_monitor.cc
rename to cc/trees/swap_promise_monitor.cc
index 0c04f35..84d8a9f 100644
--- a/cc/base/swap_promise_monitor.cc
+++ b/cc/trees/swap_promise_monitor.cc
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 #include "base/logging.h"
-#include "cc/base/swap_promise_monitor.h"
 #include "cc/trees/layer_tree_host.h"
 #include "cc/trees/layer_tree_host_impl.h"
+#include "cc/trees/swap_promise_monitor.h"
 
 namespace cc {
 
diff --git a/cc/base/swap_promise_monitor.h b/cc/trees/swap_promise_monitor.h
similarity index 92%
rename from cc/base/swap_promise_monitor.h
rename to cc/trees/swap_promise_monitor.h
index cf06bee..d163af5 100644
--- a/cc/base/swap_promise_monitor.h
+++ b/cc/trees/swap_promise_monitor.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CC_BASE_SWAP_PROMISE_MONITOR_H_
-#define CC_BASE_SWAP_PROMISE_MONITOR_H_
+#ifndef CC_TREES_SWAP_PROMISE_MONITOR_H_
+#define CC_TREES_SWAP_PROMISE_MONITOR_H_
 
 #include "cc/base/cc_export.h"
 
@@ -42,4 +42,4 @@
 
 }  // namespace cc
 
-#endif  // CC_BASE_SWAP_PROMISE_MONITOR_H_
+#endif  // CC_TREES_SWAP_PROMISE_MONITOR_H_
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 7452520..6e1a0d9 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -12,12 +12,12 @@
 #include "base/trace_event/trace_event.h"
 #include "base/trace_event/trace_event_argument.h"
 #include "base/trace_event/trace_event_synthetic_delay.h"
-#include "cc/base/swap_promise.h"
 #include "cc/debug/benchmark_instrumentation.h"
 #include "cc/debug/devtools_instrumentation.h"
 #include "cc/input/input_handler.h"
 #include "cc/output/context_provider.h"
 #include "cc/output/output_surface.h"
+#include "cc/output/swap_promise.h"
 #include "cc/quads/draw_quad.h"
 #include "cc/resources/prioritized_resource_manager.h"
 #include "cc/scheduler/commit_earlyout_reason.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index d61000b7..41416be 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -17,7 +17,6 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/sys_info.h"
 #include "base/threading/worker_pool.h"
-#include "cc/base/latency_info_swap_promise.h"
 #include "cc/layers/delegated_frame_provider.h"
 #include "cc/layers/delegated_renderer_layer.h"
 #include "cc/layers/layer.h"
@@ -26,6 +25,7 @@
 #include "cc/output/compositor_frame_ack.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/output/copy_output_result.h"
+#include "cc/output/latency_info_swap_promise.h"
 #include "cc/output/viewport_selection_bound.h"
 #include "cc/resources/single_release_callback.h"
 #include "cc/surfaces/surface.h"
diff --git a/content/renderer/gpu/frame_swap_message_queue.h b/content/renderer/gpu/frame_swap_message_queue.h
index 6ebaf16..51eb229 100644
--- a/content/renderer/gpu/frame_swap_message_queue.h
+++ b/content/renderer/gpu/frame_swap_message_queue.h
@@ -13,7 +13,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/synchronization/lock.h"
-#include "cc/base/swap_promise.h"
+#include "cc/output/swap_promise.h"
 #include "content/common/content_export.h"
 #include "content/renderer/message_delivery_policy.h"
 
diff --git a/content/renderer/gpu/queue_message_swap_promise.h b/content/renderer/gpu/queue_message_swap_promise.h
index 0c92a93..e0fcf8c 100644
--- a/content/renderer/gpu/queue_message_swap_promise.h
+++ b/content/renderer/gpu/queue_message_swap_promise.h
@@ -7,7 +7,7 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "cc/base/swap_promise.h"
+#include "cc/output/swap_promise.h"
 
 namespace IPC {
 class SyncMessageFilter;
diff --git a/content/renderer/gpu/queue_message_swap_promise_unittest.cc b/content/renderer/gpu/queue_message_swap_promise_unittest.cc
index 7590490f..069cd2c 100644
--- a/content/renderer/gpu/queue_message_swap_promise_unittest.cc
+++ b/content/renderer/gpu/queue_message_swap_promise_unittest.cc
@@ -7,7 +7,7 @@
 #include <vector>
 
 #include "base/memory/scoped_vector.h"
-#include "cc/base/swap_promise.h"
+#include "cc/output/swap_promise.h"
 #include "content/renderer/gpu/frame_swap_message_queue.h"
 #include "content/renderer/gpu/render_widget_compositor.h"
 #include "content/renderer/render_widget.h"
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index a0881461..0232eee 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -15,9 +15,6 @@
 #include "base/sys_info.h"
 #include "base/time/time.h"
 #include "base/values.h"
-#include "cc/base/latency_info_swap_promise.h"
-#include "cc/base/latency_info_swap_promise_monitor.h"
-#include "cc/base/swap_promise.h"
 #include "cc/base/switches.h"
 #include "cc/blink/web_layer_impl.h"
 #include "cc/debug/layer_tree_debug_state.h"
@@ -27,8 +24,11 @@
 #include "cc/output/begin_frame_args.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/output/copy_output_result.h"
+#include "cc/output/latency_info_swap_promise.h"
+#include "cc/output/swap_promise.h"
 #include "cc/resources/single_release_callback.h"
 #include "cc/scheduler/begin_frame_source.h"
+#include "cc/trees/latency_info_swap_promise_monitor.h"
 #include "cc/trees/layer_tree_host.h"
 #include "content/common/content_switches_internal.h"
 #include "content/common/gpu/client/context_provider_command_buffer.h"
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h
index 240a043..ae79a308 100644
--- a/content/renderer/gpu/render_widget_compositor.h
+++ b/content/renderer/gpu/render_widget_compositor.h
@@ -9,12 +9,12 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "base/values.h"
-#include "cc/base/swap_promise.h"
-#include "cc/base/swap_promise_monitor.h"
 #include "cc/input/top_controls_state.h"
+#include "cc/output/swap_promise.h"
 #include "cc/trees/layer_tree_host_client.h"
 #include "cc/trees/layer_tree_host_single_thread_client.h"
 #include "cc/trees/layer_tree_settings.h"
+#include "cc/trees/swap_promise_monitor.h"
 #include "content/common/content_export.h"
 #include "content/renderer/gpu/compositor_dependencies.h"
 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index caa771f..f6369c3 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -6,7 +6,7 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "cc/base/swap_promise_monitor.h"
+#include "cc/trees/swap_promise_monitor.h"
 #include "content/common/input/did_overscroll_params.h"
 #include "content/renderer/input/input_handler_proxy_client.h"
 #include "testing/gmock/include/gmock/gmock.h"
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index ecbd59cc..b34ab5b 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -15,9 +15,9 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
 #include "base/trace_event/trace_event.h"
-#include "cc/base/latency_info_swap_promise.h"
 #include "cc/blink/web_layer_impl.h"
 #include "cc/layers/texture_layer.h"
+#include "cc/output/latency_info_swap_promise.h"
 #include "cc/trees/layer_tree_host.h"
 #include "content/common/content_constants_internal.h"
 #include "content/common/frame_messages.h"
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index e8b40ba..f050a64 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -15,12 +15,12 @@
 #include "base/strings/string_util.h"
 #include "base/sys_info.h"
 #include "base/trace_event/trace_event.h"
-#include "cc/base/latency_info_swap_promise.h"
 #include "cc/base/switches.h"
 #include "cc/input/input_handler.h"
 #include "cc/layers/layer.h"
 #include "cc/output/begin_frame_args.h"
 #include "cc/output/context_provider.h"
+#include "cc/output/latency_info_swap_promise.h"
 #include "cc/scheduler/begin_frame_source.h"
 #include "cc/surfaces/surface_id_allocator.h"
 #include "cc/trees/layer_tree_host.h"