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; |
| 48 settings.globalHudLayerSettings.showFPSCounter = webSettings.showFPSCounter; |
| 49 settings.globalHudLayerSettings.showPaintRects = webSettings.showPaintRects; |
| 50 settings.globalHudLayerSettings.showPlatformLayerTree = webSettings.showPlat
formLayerTree; |
49 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); | 51 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); |
50 if (!m_layerTreeHost.get()) | 52 if (!m_layerTreeHost.get()) |
51 return false; | 53 return false; |
52 | |
53 if (webSettings.showFPSCounter) | |
54 setShowFPSCounter(true); | |
55 return true; | 54 return true; |
56 } | 55 } |
57 | 56 |
58 void WebLayerTreeViewImpl::setSurfaceReady() | 57 void WebLayerTreeViewImpl::setSurfaceReady() |
59 { | 58 { |
60 m_layerTreeHost->setSurfaceReady(); | 59 m_layerTreeHost->setSurfaceReady(); |
61 } | 60 } |
62 | 61 |
63 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) | 62 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) |
64 { | 63 { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; | 182 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; |
184 stats.totalCommitCount = ccStats.totalCommitCount; | 183 stats.totalCommitCount = ccStats.totalCommitCount; |
185 stats.totalPixelsPainted = ccStats.totalPixelsPainted; | 184 stats.totalPixelsPainted = ccStats.totalPixelsPainted; |
186 stats.totalPixelsRasterized = ccStats.totalPixelsRasterized; | 185 stats.totalPixelsRasterized = ccStats.totalPixelsRasterized; |
187 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls; | 186 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls; |
188 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; | 187 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; |
189 } | 188 } |
190 | 189 |
191 void WebLayerTreeViewImpl::setShowFPSCounter(bool show) | 190 void WebLayerTreeViewImpl::setShowFPSCounter(bool show) |
192 { | 191 { |
193 m_layerTreeHost->setShowFPSCounter(show); | 192 HeadsUpDisplayLayerSettings settings(m_layerTreeHost->hudLayerSettings()); |
| 193 settings.showFPSCounter = show; |
| 194 m_layerTreeHost->setHudLayerSettings(settings); |
| 195 } |
| 196 |
| 197 void WebLayerTreeViewImpl::setShowPaintRects(bool show) |
| 198 { |
| 199 HeadsUpDisplayLayerSettings settings(m_layerTreeHost->hudLayerSettings()); |
| 200 settings.showPaintRects = show; |
| 201 m_layerTreeHost->setHudLayerSettings(settings); |
194 } | 202 } |
195 | 203 |
196 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) { | 204 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) { |
197 setFontAtlas(asciiToWebRectTable, bitmap, fontHeight); | 205 setFontAtlas(asciiToWebRectTable, bitmap, fontHeight); |
198 } | 206 } |
199 | 207 |
200 void WebLayerTreeViewImpl::setFontAtlas(WebRect asciiToWebRectTable[128], const
SkBitmap& bitmap, int fontHeight) | 208 void WebLayerTreeViewImpl::setFontAtlas(WebRect asciiToWebRectTable[128], const
SkBitmap& bitmap, int fontHeight) |
201 { | 209 { |
202 gfx::Rect asciiToRectTable[128]; | 210 gfx::Rect asciiToRectTable[128]; |
203 for (int i = 0; i < 128; ++i) | 211 for (int i = 0; i < 128; ++i) |
204 asciiToRectTable[i] = asciiToWebRectTable[i]; | 212 asciiToRectTable[i] = asciiToWebRectTable[i]; |
205 scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable
, fontHeight); | 213 scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable
, fontHeight); |
206 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); | 214 m_layerTreeHost->requestHudLayer()->setFontAtlas(fontAtlas.Pass()); |
207 } | 215 } |
208 | 216 |
209 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) | 217 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) |
210 { | 218 { |
211 m_layerTreeHost->loseContext(numTimes); | 219 m_layerTreeHost->loseContext(numTimes); |
212 } | 220 } |
213 | 221 |
214 void WebLayerTreeViewImpl::willBeginFrame() | 222 void WebLayerTreeViewImpl::willBeginFrame() |
215 { | 223 { |
216 m_client->willBeginFrame(); | 224 m_client->willBeginFrame(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 { | 282 { |
275 m_client->didCompleteSwapBuffers(); | 283 m_client->didCompleteSwapBuffers(); |
276 } | 284 } |
277 | 285 |
278 void WebLayerTreeViewImpl::scheduleComposite() | 286 void WebLayerTreeViewImpl::scheduleComposite() |
279 { | 287 { |
280 m_client->scheduleComposite(); | 288 m_client->scheduleComposite(); |
281 } | 289 } |
282 | 290 |
283 } // namespace WebKit | 291 } // namespace WebKit |
OLD | NEW |