| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/compositor/compositor.h" | 5 #include "ui/gfx/compositor/compositor.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "third_party/skia/include/images/SkImageEncoder.h" | 9 #include "third_party/skia/include/images/SkImageEncoder.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 command_line->HasSwitch(switches::kUIShowFPSCounter); | 119 command_line->HasSwitch(switches::kUIShowFPSCounter); |
| 120 settings.showPlatformLayerTree = | 120 settings.showPlatformLayerTree = |
| 121 command_line->HasSwitch(switches::kUIShowLayerTree); | 121 command_line->HasSwitch(switches::kUIShowLayerTree); |
| 122 settings.refreshRate = test_compositor_enabled ? | 122 settings.refreshRate = test_compositor_enabled ? |
| 123 kTestRefreshRate : kDefaultRefreshRate; | 123 kTestRefreshRate : kDefaultRefreshRate; |
| 124 settings.partialSwapEnabled = | 124 settings.partialSwapEnabled = |
| 125 command_line->HasSwitch(switches::kUIEnablePartialSwap); | 125 command_line->HasSwitch(switches::kUIEnablePartialSwap); |
| 126 settings.perTilePainting = | 126 settings.perTilePainting = |
| 127 command_line->HasSwitch(switches::kUIEnablePerTilePainting); | 127 command_line->HasSwitch(switches::kUIEnablePerTilePainting); |
| 128 | 128 |
| 129 #if defined(WEBLAYERTREEVIEW_HAS_INITIALIZE) | |
| 130 host_.initialize(this, root_web_layer_, settings); | 129 host_.initialize(this, root_web_layer_, settings); |
| 131 #else | |
| 132 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); | |
| 133 #endif | |
| 134 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); | 130 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); |
| 135 WidgetSizeChanged(size_); | 131 WidgetSizeChanged(size_); |
| 136 } | 132 } |
| 137 | 133 |
| 138 Compositor::~Compositor() { | 134 Compositor::~Compositor() { |
| 139 // There's a cycle between |root_web_layer_| and |host_|, which results in | 135 // There's a cycle between |root_web_layer_| and |host_|, which results in |
| 140 // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle | 136 // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle |
| 141 // is broken. | 137 // is broken. |
| 142 host_.setRootLayer(NULL); | 138 host_.setRootLayer(NULL); |
| 143 if (root_layer_) | 139 if (root_layer_) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 331 |
| 336 COMPOSITOR_EXPORT void DisableTestCompositor() { | 332 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 337 test_compositor_enabled = false; | 333 test_compositor_enabled = false; |
| 338 } | 334 } |
| 339 | 335 |
| 340 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 336 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 341 return test_compositor_enabled; | 337 return test_compositor_enabled; |
| 342 } | 338 } |
| 343 | 339 |
| 344 } // namespace ui | 340 } // namespace ui |
| OLD | NEW |