Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "web_layer_tree_view_impl.h" | 5 #include "web_layer_tree_view_impl.h" |
| 6 | 6 |
| 7 #include "cc/font_atlas.h" | 7 #include "cc/font_atlas.h" |
| 8 #include "cc/heads_up_display_layer.h" | |
| 8 #include "cc/input_handler.h" | 9 #include "cc/input_handler.h" |
| 9 #include "cc/layer.h" | 10 #include "cc/layer.h" |
| 10 #include "cc/layer_tree_host.h" | 11 #include "cc/layer_tree_host.h" |
| 11 #include "cc/thread.h" | 12 #include "cc/thread.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
| 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" |
| 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " | 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 30 | 31 |
| 31 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() | 32 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() |
| 32 { | 33 { |
| 33 } | 34 } |
| 34 | 35 |
| 35 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs, scoped_ptr<Thread> implThread) | 36 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs, scoped_ptr<Thread> implThread) |
| 36 { | 37 { |
| 37 LayerTreeSettings settings; | 38 LayerTreeSettings settings; |
| 38 settings.acceleratePainting = webSettings.acceleratePainting; | 39 settings.acceleratePainting = webSettings.acceleratePainting; |
| 39 settings.showDebugBorders = webSettings.showDebugBorders; | 40 settings.showDebugBorders = webSettings.showDebugBorders; |
| 40 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; | |
| 41 settings.showPaintRects = webSettings.showPaintRects; | |
| 42 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; | 41 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; |
| 43 settings.perTilePaintingEnabled = webSettings.perTilePaintingEnabled; | 42 settings.perTilePaintingEnabled = webSettings.perTilePaintingEnabled; |
| 44 settings.acceleratedAnimationEnabled = webSettings.acceleratedAnimationEnabl ed; | 43 settings.acceleratedAnimationEnabled = webSettings.acceleratedAnimationEnabl ed; |
| 45 settings.pageScalePinchZoomEnabled = webSettings.pageScalePinchZoomEnabled; | 44 settings.pageScalePinchZoomEnabled = webSettings.pageScalePinchZoomEnabled; |
| 46 settings.refreshRate = webSettings.refreshRate; | 45 settings.refreshRate = webSettings.refreshRate; |
| 47 settings.defaultTileSize = webSettings.defaultTileSize; | 46 settings.defaultTileSize = webSettings.defaultTileSize; |
| 48 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; | 47 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; |
| 49 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); | 48 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); |
| 50 if (!m_layerTreeHost.get()) | 49 if (!m_layerTreeHost.get()) |
| 51 return false; | 50 return false; |
| 52 | 51 |
| 53 if (webSettings.showFPSCounter) | 52 if (webSettings.showFPSCounter) |
| 54 setShowFPSCounter(true); | 53 setShowFPSCounter(true); |
| 54 if (webSettings.showPaintRects) | |
| 55 setShowPaintRects(true); | |
| 56 if (webSettings.showPlatformLayerTree) | |
| 57 setShowPlatformLayerTree(true); | |
| 55 return true; | 58 return true; |
| 56 } | 59 } |
| 57 | 60 |
| 58 void WebLayerTreeViewImpl::setSurfaceReady() | 61 void WebLayerTreeViewImpl::setSurfaceReady() |
| 59 { | 62 { |
| 60 m_layerTreeHost->setSurfaceReady(); | 63 m_layerTreeHost->setSurfaceReady(); |
| 61 } | 64 } |
| 62 | 65 |
| 63 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) | 66 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) |
| 64 { | 67 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; | 186 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; |
| 184 stats.totalCommitCount = ccStats.totalCommitCount; | 187 stats.totalCommitCount = ccStats.totalCommitCount; |
| 185 stats.totalPixelsPainted = ccStats.totalPixelsPainted; | 188 stats.totalPixelsPainted = ccStats.totalPixelsPainted; |
| 186 stats.totalPixelsRasterized = ccStats.totalPixelsRasterized; | 189 stats.totalPixelsRasterized = ccStats.totalPixelsRasterized; |
| 187 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls; | 190 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls; |
| 188 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; | 191 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; |
| 189 } | 192 } |
| 190 | 193 |
| 191 void WebLayerTreeViewImpl::setShowFPSCounter(bool show) | 194 void WebLayerTreeViewImpl::setShowFPSCounter(bool show) |
| 192 { | 195 { |
| 193 m_layerTreeHost->setShowFPSCounter(show); | 196 m_layerTreeHost->requestHUDLayer()->setShowFPSCounter(show); |
|
egraether
2012/11/15 23:37:07
I tried to improve the pipeline here, by leaving o
| |
| 197 } | |
| 198 | |
| 199 void WebLayerTreeViewImpl::setShowPaintRects(bool show) | |
| 200 { | |
| 201 m_layerTreeHost->requestHUDLayer()->setShowPaintRects(show); | |
| 202 } | |
| 203 | |
| 204 void WebLayerTreeViewImpl::setShowPlatformLayerTree(bool show) | |
| 205 { | |
| 206 m_layerTreeHost->requestHUDLayer()->setShowPlatformLayerTree(show); | |
| 194 } | 207 } |
| 195 | 208 |
| 196 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT able[128], int fontHeight) { | 209 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT able[128], int fontHeight) { |
| 197 setFontAtlas(asciiToWebRectTable, bitmap, fontHeight); | 210 setFontAtlas(asciiToWebRectTable, bitmap, fontHeight); |
| 198 } | 211 } |
| 199 | 212 |
| 200 void WebLayerTreeViewImpl::setFontAtlas(WebRect asciiToWebRectTable[128], const SkBitmap& bitmap, int fontHeight) | 213 void WebLayerTreeViewImpl::setFontAtlas(WebRect asciiToWebRectTable[128], const SkBitmap& bitmap, int fontHeight) |
| 201 { | 214 { |
| 202 gfx::Rect asciiToRectTable[128]; | 215 gfx::Rect asciiToRectTable[128]; |
| 203 for (int i = 0; i < 128; ++i) | 216 for (int i = 0; i < 128; ++i) |
| 204 asciiToRectTable[i] = asciiToWebRectTable[i]; | 217 asciiToRectTable[i] = asciiToWebRectTable[i]; |
| 205 scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable , fontHeight); | 218 scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable , fontHeight); |
| 206 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); | 219 m_layerTreeHost->requestHUDLayer()->setFontAtlas(fontAtlas.Pass()); |
| 207 } | 220 } |
| 208 | 221 |
| 209 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) | 222 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) |
| 210 { | 223 { |
| 211 m_layerTreeHost->loseContext(numTimes); | 224 m_layerTreeHost->loseContext(numTimes); |
| 212 } | 225 } |
| 213 | 226 |
| 214 void WebLayerTreeViewImpl::willBeginFrame() | 227 void WebLayerTreeViewImpl::willBeginFrame() |
| 215 { | 228 { |
| 216 m_client->willBeginFrame(); | 229 m_client->willBeginFrame(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 { | 287 { |
| 275 m_client->didCompleteSwapBuffers(); | 288 m_client->didCompleteSwapBuffers(); |
| 276 } | 289 } |
| 277 | 290 |
| 278 void WebLayerTreeViewImpl::scheduleComposite() | 291 void WebLayerTreeViewImpl::scheduleComposite() |
| 279 { | 292 { |
| 280 m_client->scheduleComposite(); | 293 m_client->scheduleComposite(); |
| 281 } | 294 } |
| 282 | 295 |
| 283 } // namespace WebKit | 296 } // namespace WebKit |
| OLD | NEW |