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 "config.h" | 5 #include "config.h" |
6 #include "WebLayerTreeViewImpl.h" | 6 #include "WebLayerTreeViewImpl.h" |
7 | 7 |
8 #include "WebLayerImpl.h" | 8 #include "WebLayerImpl.h" |
9 #include "WebToCCInputHandlerAdapter.h" | 9 #include "WebToCCInputHandlerAdapter.h" |
10 #include "cc/font_atlas.h" | 10 #include "cc/font_atlas.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 : m_client(client) | 37 : m_client(client) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() | 41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) | 45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) |
46 { | 46 { |
47 CCLayerTreeSettings settings; | 47 LayerTreeSettings settings; |
48 settings.acceleratePainting = webSettings.acceleratePainting; | 48 settings.acceleratePainting = webSettings.acceleratePainting; |
49 settings.showFPSCounter = webSettings.showFPSCounter; | 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 = LayerTreeHost::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; |
60 } | 60 } |
61 | 61 |
62 void WebLayerTreeViewImpl::setSurfaceReady() | 62 void WebLayerTreeViewImpl::setSurfaceReady() |
63 { | 63 { |
64 m_layerTreeHost->setSurfaceReady(); | 64 m_layerTreeHost->setSurfaceReady(); |
65 } | 65 } |
66 | 66 |
67 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) | 67 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) |
68 { | 68 { |
69 m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer
()); | 69 m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer
()); |
70 } | 70 } |
71 | 71 |
72 void WebLayerTreeViewImpl::clearRootLayer() | 72 void WebLayerTreeViewImpl::clearRootLayer() |
73 { | 73 { |
74 m_layerTreeHost->setRootLayer(scoped_refptr<LayerChromium>()); | 74 m_layerTreeHost->setRootLayer(scoped_refptr<Layer>()); |
75 } | 75 } |
76 | 76 |
77 void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, co
nst WebSize& deviceViewportSize) | 77 void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, co
nst WebSize& deviceViewportSize) |
78 { | 78 { |
79 if (!deviceViewportSize.isEmpty()) | 79 if (!deviceViewportSize.isEmpty()) |
80 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(de
viceViewportSize)); | 80 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(de
viceViewportSize)); |
81 else | 81 else |
82 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(la
youtViewportSize)); | 82 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(la
youtViewportSize)); |
83 } | 83 } |
84 | 84 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 m_layerTreeHost->setNeedsRedraw(); | 137 m_layerTreeHost->setNeedsRedraw(); |
138 } | 138 } |
139 | 139 |
140 bool WebLayerTreeViewImpl::commitRequested() const | 140 bool WebLayerTreeViewImpl::commitRequested() const |
141 { | 141 { |
142 return m_layerTreeHost->commitRequested(); | 142 return m_layerTreeHost->commitRequested(); |
143 } | 143 } |
144 | 144 |
145 void WebLayerTreeViewImpl::composite() | 145 void WebLayerTreeViewImpl::composite() |
146 { | 146 { |
147 if (CCProxy::hasImplThread()) | 147 if (Proxy::hasImplThread()) |
148 m_layerTreeHost->setNeedsCommit(); | 148 m_layerTreeHost->setNeedsCommit(); |
149 else | 149 else |
150 m_layerTreeHost->composite(); | 150 m_layerTreeHost->composite(); |
151 } | 151 } |
152 | 152 |
153 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) | 153 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) |
154 { | 154 { |
155 m_layerTreeHost->updateAnimations(frameBeginTime); | 155 m_layerTreeHost->updateAnimations(frameBeginTime); |
156 } | 156 } |
157 | 157 |
158 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec
t) | 158 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec
t) |
159 { | 159 { |
160 return m_layerTreeHost->compositeAndReadback(pixels, convert(rect)); | 160 return m_layerTreeHost->compositeAndReadback(pixels, convert(rect)); |
161 } | 161 } |
162 | 162 |
163 void WebLayerTreeViewImpl::finishAllRendering() | 163 void WebLayerTreeViewImpl::finishAllRendering() |
164 { | 164 { |
165 m_layerTreeHost->finishAllRendering(); | 165 m_layerTreeHost->finishAllRendering(); |
166 } | 166 } |
167 | 167 |
168 void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const | 168 void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const |
169 { | 169 { |
170 CCRenderingStats ccStats; | 170 RenderingStats ccStats; |
171 m_layerTreeHost->renderingStats(&ccStats); | 171 m_layerTreeHost->renderingStats(&ccStats); |
172 | 172 |
173 stats.numAnimationFrames = ccStats.numAnimationFrames; | 173 stats.numAnimationFrames = ccStats.numAnimationFrames; |
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::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) | 184 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) |
185 { | 185 { |
186 IntRect asciiToRectTable[128]; | 186 IntRect asciiToRectTable[128]; |
187 for (int i = 0; i < 128; ++i) | 187 for (int i = 0; i < 128; ++i) |
188 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); | 188 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); |
189 scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectT
able, fontHeight); | 189 scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable
, fontHeight); |
190 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); | 190 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); |
191 } | 191 } |
192 | 192 |
193 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) | 193 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) |
194 { | 194 { |
195 m_layerTreeHost->loseContext(numTimes); | 195 m_layerTreeHost->loseContext(numTimes); |
196 } | 196 } |
197 | 197 |
198 void WebLayerTreeViewImpl::willBeginFrame() | 198 void WebLayerTreeViewImpl::willBeginFrame() |
199 { | 199 { |
(...skipping 23 matching lines...) Expand all Loading... |
223 scoped_ptr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface
() | 223 scoped_ptr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface
() |
224 { | 224 { |
225 return scoped_ptr<WebCompositorOutputSurface>(m_client->createOutputSurface(
)); | 225 return scoped_ptr<WebCompositorOutputSurface>(m_client->createOutputSurface(
)); |
226 } | 226 } |
227 | 227 |
228 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) | 228 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) |
229 { | 229 { |
230 m_client->didRecreateOutputSurface(success); | 230 m_client->didRecreateOutputSurface(success); |
231 } | 231 } |
232 | 232 |
233 scoped_ptr<CCInputHandler> WebLayerTreeViewImpl::createInputHandler() | 233 scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler() |
234 { | 234 { |
235 scoped_ptr<CCInputHandler> ret; | 235 scoped_ptr<InputHandler> ret; |
236 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler()); | 236 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler()); |
237 if (handler) | 237 if (handler) |
238 ret = WebToCCInputHandlerAdapter::create(handler.Pass()); | 238 ret = WebToCCInputHandlerAdapter::create(handler.Pass()); |
239 return ret.Pass(); | 239 return ret.Pass(); |
240 } | 240 } |
241 | 241 |
242 void WebLayerTreeViewImpl::willCommit() | 242 void WebLayerTreeViewImpl::willCommit() |
243 { | 243 { |
244 m_client->willCommit(); | 244 m_client->willCommit(); |
245 } | 245 } |
(...skipping 12 matching lines...) Expand all Loading... |
258 { | 258 { |
259 m_client->didCompleteSwapBuffers(); | 259 m_client->didCompleteSwapBuffers(); |
260 } | 260 } |
261 | 261 |
262 void WebLayerTreeViewImpl::scheduleComposite() | 262 void WebLayerTreeViewImpl::scheduleComposite() |
263 { | 263 { |
264 m_client->scheduleComposite(); | 264 m_client->scheduleComposite(); |
265 } | 265 } |
266 | 266 |
267 } // namespace WebKit | 267 } // namespace WebKit |
OLD | NEW |