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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

Issue 10690121: Merge 121076 - [chromium] LayerRendererChromium is not getting visibility messages in single thread… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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 /* 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ASSERT(context->hasOneRef()); 145 ASSERT(context->hasOneRef());
146 m_contextBeforeInitialization = context; 146 m_contextBeforeInitialization = context;
147 return true; 147 return true;
148 } 148 }
149 149
150 void CCSingleThreadProxy::setSurfaceReady() 150 void CCSingleThreadProxy::setSurfaceReady()
151 { 151 {
152 // Scheduling is controlled by the embedder in the single thread case, so no thing to do. 152 // Scheduling is controlled by the embedder in the single thread case, so no thing to do.
153 } 153 }
154 154
155 void CCSingleThreadProxy::setVisible(bool visible)
156 {
157 DebugScopedSetImplThread impl;
158 m_layerTreeHostImpl->setVisible(visible);
159 }
160
155 bool CCSingleThreadProxy::initializeLayerRenderer() 161 bool CCSingleThreadProxy::initializeLayerRenderer()
156 { 162 {
157 ASSERT(CCProxy::isMainThread()); 163 ASSERT(CCProxy::isMainThread());
158 ASSERT(m_contextBeforeInitialization); 164 ASSERT(m_contextBeforeInitialization);
159 { 165 {
160 DebugScopedSetImplThread impl; 166 DebugScopedSetImplThread impl;
161 bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeIn itialization.release(), UnthrottledUploader); 167 bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeIn itialization.release(), UnthrottledUploader);
162 if (ok) { 168 if (ok) {
163 m_layerRendererInitialized = true; 169 m_layerRendererInitialized = true;
164 m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->laye rRendererCapabilities(); 170 m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->laye rRendererCapabilities();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 m_layerTreeHost->commitComplete(); 256 m_layerTreeHost->commitComplete();
251 m_nextFrameIsNewlyCommittedFrame = true; 257 m_nextFrameIsNewlyCommittedFrame = true;
252 } 258 }
253 259
254 void CCSingleThreadProxy::setNeedsCommit() 260 void CCSingleThreadProxy::setNeedsCommit()
255 { 261 {
256 ASSERT(CCProxy::isMainThread()); 262 ASSERT(CCProxy::isMainThread());
257 m_layerTreeHost->scheduleComposite(); 263 m_layerTreeHost->scheduleComposite();
258 } 264 }
259 265
260 void CCSingleThreadProxy::setNeedsForcedCommit()
261 {
262 // This proxy doesn't block commits when not visible so use a normal commit.
263 setNeedsCommit();
264 }
265
266 void CCSingleThreadProxy::setNeedsRedraw() 266 void CCSingleThreadProxy::setNeedsRedraw()
267 { 267 {
268 // FIXME: Once we move render_widget scheduling into this class, we can 268 // FIXME: Once we move render_widget scheduling into this class, we can
269 // treat redraw requests more efficiently than commitAndRedraw requests. 269 // treat redraw requests more efficiently than commitAndRedraw requests.
270 m_layerTreeHostImpl->setFullRootLayerDamage(); 270 m_layerTreeHostImpl->setFullRootLayerDamage();
271 setNeedsCommit(); 271 setNeedsCommit();
272 } 272 }
273 273
274 bool CCSingleThreadProxy::commitRequested() const 274 bool CCSingleThreadProxy::commitRequested() const
275 { 275 {
276 return false; 276 return false;
277 } 277 }
278 278
279 void CCSingleThreadProxy::didAddAnimation() 279 void CCSingleThreadProxy::didAddAnimation()
280 { 280 {
281 m_animationTimer->startOneShot(animationTimerDelay()); 281 m_animationTimer->startOneShot(animationTimerDelay());
282 } 282 }
283 283
284 void CCSingleThreadProxy::stop() 284 void CCSingleThreadProxy::stop()
285 { 285 {
286 TRACE_EVENT("CCSingleThreadProxy::stop", this, 0); 286 TRACE_EVENT("CCSingleThreadProxy::stop", this, 0);
287 ASSERT(CCProxy::isMainThread()); 287 ASSERT(CCProxy::isMainThread());
288 { 288 {
289 DebugScopedSetMainThreadBlocked mainThreadBlocked; 289 DebugScopedSetMainThreadBlocked mainThreadBlocked;
290 DebugScopedSetImplThread impl; 290 DebugScopedSetImplThread impl;
291 291
292 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl- >contentsTextureAllocator()); 292 if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
293 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI mpl->contentsTextureAllocator());
293 m_layerTreeHostImpl.clear(); 294 m_layerTreeHostImpl.clear();
294 } 295 }
295 m_layerTreeHost = 0; 296 m_layerTreeHost = 0;
296 } 297 }
297 298
298 void CCSingleThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) 299 void CCSingleThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas)
299 { 300 {
300 ASSERT(isMainThread()); 301 ASSERT(isMainThread());
301 DebugScopedSetImplThread impl; 302 DebugScopedSetImplThread impl;
302 m_layerTreeHostImpl->setFontAtlas(fontAtlas); 303 m_layerTreeHostImpl->setFontAtlas(fontAtlas);
303 } 304 }
304 305
305 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr <CCAnimationEventsVector> events, double wallClockTime) 306 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr <CCAnimationEventsVector> events, double wallClockTime)
306 { 307 {
307 ASSERT(CCProxy::isImplThread()); 308 ASSERT(CCProxy::isImplThread());
308 DebugScopedSetMainThread main; 309 DebugScopedSetMainThread main;
309 m_layerTreeHost->setAnimationEvents(events, wallClockTime); 310 m_layerTreeHost->setAnimationEvents(events, wallClockTime);
310 } 311 }
311 312
312 void CCSingleThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadO nImplThread(size_t bytes)
313 {
314 ASSERT(CCProxy::isImplThread());
315 DebugScopedSetMainThread main;
316 ASSERT(m_layerTreeHost);
317 m_layerTreeHost->setContentsMemoryAllocationLimitBytes(bytes);
318 }
319
320 // Called by the legacy scheduling path (e.g. where render_widget does the sched uling) 313 // Called by the legacy scheduling path (e.g. where render_widget does the sched uling)
321 void CCSingleThreadProxy::compositeImmediately() 314 void CCSingleThreadProxy::compositeImmediately()
322 { 315 {
323 if (commitAndComposite()) { 316 if (commitAndComposite()) {
324 m_layerTreeHostImpl->swapBuffers(); 317 m_layerTreeHostImpl->swapBuffers();
325 didSwapFrame(); 318 didSwapFrame();
326 } 319 }
327 } 320 }
328 321
329 double CCSingleThreadProxy::animationTimerDelay() 322 double CCSingleThreadProxy::animationTimerDelay()
330 { 323 {
331 return 1 / 60.0; 324 return 1 / 60.0;
332 } 325 }
333 326
334 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() 327 void CCSingleThreadProxy::forceSerializeOnSwapBuffers()
335 { 328 {
336 { 329 {
337 DebugScopedSetImplThread impl; 330 DebugScopedSetImplThread impl;
338 if (m_layerRendererInitialized) 331 if (m_layerRendererInitialized)
339 m_layerTreeHostImpl->layerRenderer()->doNoOp(); 332 m_layerTreeHostImpl->layerRenderer()->doNoOp();
340 } 333 }
341 } 334 }
342 335
343 bool CCSingleThreadProxy::commitAndComposite() 336 bool CCSingleThreadProxy::commitAndComposite()
344 { 337 {
345 ASSERT(CCProxy::isMainThread()); 338 ASSERT(CCProxy::isMainThread());
346 339
340
347 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) 341 if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
348 return false; 342 return false;
349 343
344 if (m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
345 m_layerTreeHost->evictAllContentTextures();
346
350 CCTextureUpdater updater; 347 CCTextureUpdater updater;
351 m_layerTreeHost->updateLayers(updater); 348 m_layerTreeHost->updateLayers(updater, m_layerTreeHostImpl->memoryAllocation LimitBytes());
352 349
353 m_layerTreeHost->willCommit(); 350 m_layerTreeHost->willCommit();
354 doCommit(updater); 351 doCommit(updater);
355 bool result = doComposite(); 352 bool result = doComposite();
356 m_layerTreeHost->didBeginFrame(); 353 m_layerTreeHost->didBeginFrame();
357 return result; 354 return result;
358 } 355 }
359 356
360 bool CCSingleThreadProxy::doComposite() 357 bool CCSingleThreadProxy::doComposite()
361 { 358 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 390
394 void CCSingleThreadProxy::didSwapFrame() 391 void CCSingleThreadProxy::didSwapFrame()
395 { 392 {
396 if (m_nextFrameIsNewlyCommittedFrame) { 393 if (m_nextFrameIsNewlyCommittedFrame) {
397 m_nextFrameIsNewlyCommittedFrame = false; 394 m_nextFrameIsNewlyCommittedFrame = false;
398 m_layerTreeHost->didCommitAndDrawFrame(); 395 m_layerTreeHost->didCommitAndDrawFrame();
399 } 396 }
400 } 397 }
401 398
402 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698