Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Side by Side Diff: webkit/compositor_bindings/web_layer_tree_view_impl.cc

Issue 11189037: toggle FPS counter in compositor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: plumbing 'showFPSCounter' through HUD, added 'createHUDLayerIfNeeded' Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "web_layer_tree_view_impl.h" 6 #include "web_layer_tree_view_impl.h"
7 7
8 #include "cc/font_atlas.h" 8 #include "cc/font_atlas.h"
9 #include "cc/input_handler.h" 9 #include "cc/input_handler.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 17 matching lines...) Expand all
28 { 28 {
29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client)); 29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client));
30 if (!layerTreeViewImpl->initialize(settings)) 30 if (!layerTreeViewImpl->initialize(settings))
31 return 0; 31 return 0;
32 layerTreeViewImpl->setRootLayer(root); 32 layerTreeViewImpl->setRootLayer(root);
33 return layerTreeViewImpl.release(); 33 return layerTreeViewImpl.release();
34 } 34 }
35 35
36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
37 : m_client(client) 37 : m_client(client)
38 , m_hasFontAtlas(false)
38 { 39 {
39 } 40 }
40 41
41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() 42 WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
42 { 43 {
43 } 44 }
44 45
45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs) 46 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs)
46 { 47 {
47 CCLayerTreeSettings settings; 48 CCLayerTreeSettings settings;
48 settings.acceleratePainting = webSettings.acceleratePainting; 49 settings.acceleratePainting = webSettings.acceleratePainting;
49 settings.showFPSCounter = webSettings.showFPSCounter;
50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; 50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree;
51 settings.showPaintRects = webSettings.showPaintRects; 51 settings.showPaintRects = webSettings.showPaintRects;
52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; 52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled;
53 settings.refreshRate = webSettings.refreshRate; 53 settings.refreshRate = webSettings.refreshRate;
54 settings.defaultTileSize = convert(webSettings.defaultTileSize); 54 settings.defaultTileSize = convert(webSettings.defaultTileSize);
55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); 55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize);
56 m_layerTreeHost = CCLayerTreeHost::create(this, settings); 56 m_layerTreeHost = CCLayerTreeHost::create(this, settings);
57 if (!m_layerTreeHost.get()) 57 if (!m_layerTreeHost.get())
58 return false; 58 return false;
59 return true; 59 return true;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; 174 stats.numFramesSentToScreen = ccStats.numFramesSentToScreen;
175 stats.droppedFrameCount = ccStats.droppedFrameCount; 175 stats.droppedFrameCount = ccStats.droppedFrameCount;
176 stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; 176 stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds;
177 stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; 177 stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds;
178 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; 178 stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds;
179 stats.totalCommitCount = ccStats.totalCommitCount; 179 stats.totalCommitCount = ccStats.totalCommitCount;
180 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls; 180 stats.numImplThreadScrolls = ccStats.numImplThreadScrolls;
181 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; 181 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls;
182 } 182 }
183 183
184 void WebLayerTreeViewImpl::setShowFPSCounter(bool show)
185 {
186 m_layerTreeHost->setShowFPSCounter(show);
187 }
188
189 bool WebLayerTreeViewImpl::hasFontAtlas()
190 {
191 return m_hasFontAtlas;
192 }
193
184 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT able[128], int fontHeight) 194 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT able[128], int fontHeight)
185 { 195 {
186 IntRect asciiToRectTable[128]; 196 IntRect asciiToRectTable[128];
187 for (int i = 0; i < 128; ++i) 197 for (int i = 0; i < 128; ++i)
188 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); 198 asciiToRectTable[i] = convert(asciiToWebRectTable[i]);
189 scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectT able, fontHeight); 199 scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectT able, fontHeight);
190 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); 200 m_layerTreeHost->setFontAtlas(fontAtlas.Pass());
201 m_hasFontAtlas = true;
191 } 202 }
192 203
193 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) 204 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes)
194 { 205 {
195 m_layerTreeHost->loseContext(numTimes); 206 m_layerTreeHost->loseContext(numTimes);
196 } 207 }
197 208
198 void WebLayerTreeViewImpl::willBeginFrame() 209 void WebLayerTreeViewImpl::willBeginFrame()
199 { 210 {
200 m_client->willBeginFrame(); 211 m_client->willBeginFrame();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { 269 {
259 m_client->didCompleteSwapBuffers(); 270 m_client->didCompleteSwapBuffers();
260 } 271 }
261 272
262 void WebLayerTreeViewImpl::scheduleComposite() 273 void WebLayerTreeViewImpl::scheduleComposite()
263 { 274 {
264 m_client->scheduleComposite(); 275 m_client->scheduleComposite();
265 } 276 }
266 277
267 } // namespace WebKit 278 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698