OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 RecreateFailedAndGaveUp, | 162 RecreateFailedAndGaveUp, |
163 }; | 163 }; |
164 RecreateResult recreateContext(); | 164 RecreateResult recreateContext(); |
165 void willCommit() { m_client->willCommit(); } | 165 void willCommit() { m_client->willCommit(); } |
166 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } | 166 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } |
167 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } | 167 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } |
168 void deleteContentsTexturesOnImplThread(TextureAllocator*); | 168 void deleteContentsTexturesOnImplThread(TextureAllocator*); |
169 virtual void acquireLayerTextures(); | 169 virtual void acquireLayerTextures(); |
170 // Returns false if we should abort this frame due to initialization failure
. | 170 // Returns false if we should abort this frame due to initialization failure
. |
171 bool initializeLayerRendererIfNeeded(); | 171 bool initializeLayerRendererIfNeeded(); |
172 void updateLayers(CCTextureUpdater&); | 172 void updateLayers(CCTextureUpdater&, size_t contentsMemoryLimitBytes); |
173 | 173 |
174 CCLayerTreeHostClient* client() { return m_client; } | 174 CCLayerTreeHostClient* client() { return m_client; } |
175 | 175 |
176 int compositorIdentifier() const { return m_compositorIdentifier; } | 176 int compositorIdentifier() const { return m_compositorIdentifier; } |
177 | 177 |
178 // Only used when compositing on the main thread. | 178 // Only used when compositing on the main thread. |
179 void composite(); | 179 void composite(); |
180 void scheduleComposite(); | 180 void scheduleComposite(); |
181 | 181 |
182 // NOTE: The returned value can only be used to make GL calls or make the | 182 // NOTE: The returned value can only be used to make GL calls or make the |
(...skipping 10 matching lines...) Expand all Loading... |
193 int frameNumber() const { return m_frameNumber; } | 193 int frameNumber() const { return m_frameNumber; } |
194 | 194 |
195 const LayerRendererCapabilities& layerRendererCapabilities() const; | 195 const LayerRendererCapabilities& layerRendererCapabilities() const; |
196 | 196 |
197 // Test only hook | 197 // Test only hook |
198 void loseContext(int numTimes); | 198 void loseContext(int numTimes); |
199 | 199 |
200 void setNeedsAnimate(); | 200 void setNeedsAnimate(); |
201 // virtual for testing | 201 // virtual for testing |
202 virtual void setNeedsCommit(); | 202 virtual void setNeedsCommit(); |
203 void setNeedsForcedCommit(); | |
204 void setNeedsRedraw(); | 203 void setNeedsRedraw(); |
205 bool commitRequested() const; | 204 bool commitRequested() const; |
206 | 205 |
207 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc
kTime); | 206 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc
kTime); |
208 virtual void didAddAnimation(); | 207 virtual void didAddAnimation(); |
209 | 208 |
210 LayerChromium* rootLayer() { return m_rootLayer.get(); } | 209 LayerChromium* rootLayer() { return m_rootLayer.get(); } |
211 const LayerChromium* rootLayer() const { return m_rootLayer.get(); } | 210 const LayerChromium* rootLayer() const { return m_rootLayer.get(); } |
212 void setRootLayer(PassRefPtr<LayerChromium>); | 211 void setRootLayer(PassRefPtr<LayerChromium>); |
213 | 212 |
214 const CCLayerTreeSettings& settings() const { return m_settings; } | 213 const CCLayerTreeSettings& settings() const { return m_settings; } |
215 | 214 |
216 void setViewportSize(const IntSize&); | 215 void setViewportSize(const IntSize&); |
217 | 216 |
218 const IntSize& viewportSize() const { return m_viewportSize; } | 217 const IntSize& viewportSize() const { return m_viewportSize; } |
219 // Gives the viewport size in device/content space. | 218 // Gives the viewport size in device/content space. |
220 const IntSize& deviceViewportSize() const { return m_deviceViewportSize; } | 219 const IntSize& deviceViewportSize() const { return m_deviceViewportSize; } |
221 | 220 |
222 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 221 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
223 | 222 |
224 void setBackgroundColor(const Color& color) { m_backgroundColor = color; } | 223 void setBackgroundColor(const Color& color) { m_backgroundColor = color; } |
225 | 224 |
226 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 225 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
227 | 226 |
228 TextureManager* contentsTextureManager() const; | 227 TextureManager* contentsTextureManager() const; |
229 void setContentsMemoryAllocationLimitBytes(size_t); | 228 |
| 229 // This will cause contents texture manager to evict all textures, but |
| 230 // without deleting them. This happens after all content textures have |
| 231 // already been deleted on impl, after getting a 0 allocation limit. |
| 232 // Set during a commit, but before updateLayers. |
| 233 void evictAllContentTextures(); |
230 | 234 |
231 bool visible() const { return m_visible; } | 235 bool visible() const { return m_visible; } |
232 void setVisible(bool); | 236 void setVisible(bool); |
233 | 237 |
234 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, double durationSec); | 238 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, double durationSec); |
235 | 239 |
236 void applyScrollAndScale(const CCScrollAndScaleSet&); | 240 void applyScrollAndScale(const CCScrollAndScaleSet&); |
237 | 241 |
238 void startRateLimiter(WebKit::WebGraphicsContext3D*); | 242 void startRateLimiter(WebKit::WebGraphicsContext3D*); |
239 void stopRateLimiter(WebKit::WebGraphicsContext3D*); | 243 void stopRateLimiter(WebKit::WebGraphicsContext3D*); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromi
um*, double wallClockTime); | 276 void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromi
um*, double wallClockTime); |
273 | 277 |
274 int m_compositorIdentifier; | 278 int m_compositorIdentifier; |
275 | 279 |
276 bool m_animating; | 280 bool m_animating; |
277 bool m_needsAnimateLayers; | 281 bool m_needsAnimateLayers; |
278 | 282 |
279 CCLayerTreeHostClient* m_client; | 283 CCLayerTreeHostClient* m_client; |
280 | 284 |
281 int m_frameNumber; | 285 int m_frameNumber; |
282 bool m_frameIsForDisplay; | |
283 | 286 |
284 OwnPtr<CCProxy> m_proxy; | 287 OwnPtr<CCProxy> m_proxy; |
285 bool m_layerRendererInitialized; | 288 bool m_layerRendererInitialized; |
286 bool m_contextLost; | 289 bool m_contextLost; |
287 int m_numTimesRecreateShouldFail; | 290 int m_numTimesRecreateShouldFail; |
288 int m_numFailedRecreateAttempts; | 291 int m_numFailedRecreateAttempts; |
289 | 292 |
290 RefPtr<LayerChromium> m_rootLayer; | 293 RefPtr<LayerChromium> m_rootLayer; |
291 OwnPtr<TextureManager> m_contentsTextureManager; | 294 OwnPtr<TextureManager> m_contentsTextureManager; |
292 | 295 |
293 CCLayerTreeSettings m_settings; | 296 CCLayerTreeSettings m_settings; |
294 | 297 |
295 IntSize m_viewportSize; | 298 IntSize m_viewportSize; |
296 IntSize m_deviceViewportSize; | 299 IntSize m_deviceViewportSize; |
297 float m_deviceScaleFactor; | 300 float m_deviceScaleFactor; |
298 | 301 |
299 bool m_visible; | 302 bool m_visible; |
300 | 303 |
301 size_t m_memoryAllocationBytes; | |
302 bool m_memoryAllocationIsForDisplay; | |
303 | |
304 typedef HashMap<WebKit::WebGraphicsContext3D*, RefPtr<RateLimiter> > RateLim
iterMap; | 304 typedef HashMap<WebKit::WebGraphicsContext3D*, RefPtr<RateLimiter> > RateLim
iterMap; |
305 RateLimiterMap m_rateLimiters; | 305 RateLimiterMap m_rateLimiters; |
306 | 306 |
307 float m_pageScaleFactor; | 307 float m_pageScaleFactor; |
308 float m_minPageScaleFactor, m_maxPageScaleFactor; | 308 float m_minPageScaleFactor, m_maxPageScaleFactor; |
309 bool m_triggerIdlePaints; | 309 bool m_triggerIdlePaints; |
310 Color m_backgroundColor; | 310 Color m_backgroundColor; |
311 bool m_hasTransparentBackground; | 311 bool m_hasTransparentBackground; |
312 | 312 |
313 TextureList m_deleteTextureAfterCommitList; | 313 TextureList m_deleteTextureAfterCommitList; |
314 size_t m_partialTextureUpdateRequests; | 314 size_t m_partialTextureUpdateRequests; |
315 static bool s_needsFilterContext; | 315 static bool s_needsFilterContext; |
316 }; | 316 }; |
317 | 317 |
318 } | 318 } |
319 | 319 |
320 #endif | 320 #endif |
OLD | NEW |