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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 6097 matching lines...) Expand 10 before | Expand all | Expand 10 after
6108 6108
6109 const char* reason = "framebuffer incomplete"; 6109 const char* reason = "framebuffer incomplete";
6110 if (m_framebufferBinding && m_framebufferBinding->checkDepthStencilStatus(&r eason) != GL_FRAMEBUFFER_COMPLETE) { 6110 if (m_framebufferBinding && m_framebufferBinding->checkDepthStencilStatus(&r eason) != GL_FRAMEBUFFER_COMPLETE) {
6111 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason ); 6111 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason );
6112 return false; 6112 return false;
6113 } 6113 }
6114 6114
6115 return true; 6115 return true;
6116 } 6116 }
6117 6117
6118 void WebGLRenderingContextBase::dispatchContextLostEvent(Timer<WebGLRenderingCon textBase>*) 6118 void WebGLRenderingContextBase::dispatchContextLostEvent(TimerBase*)
6119 { 6119 {
6120 WebGLContextEvent* event = WebGLContextEvent::create(EventTypeNames::webglco ntextlost, false, true, ""); 6120 WebGLContextEvent* event = WebGLContextEvent::create(EventTypeNames::webglco ntextlost, false, true, "");
6121 canvas()->dispatchEvent(event); 6121 canvas()->dispatchEvent(event);
6122 m_restoreAllowed = event->defaultPrevented(); 6122 m_restoreAllowed = event->defaultPrevented();
6123 if (m_restoreAllowed && !m_isHidden) { 6123 if (m_restoreAllowed && !m_isHidden) {
6124 if (m_autoRecoveryMethod == Auto) 6124 if (m_autoRecoveryMethod == Auto)
6125 m_restoreTimer.startOneShot(0, BLINK_FROM_HERE); 6125 m_restoreTimer.startOneShot(0, BLINK_FROM_HERE);
6126 } 6126 }
6127 } 6127 }
6128 6128
6129 void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextB ase>*) 6129 void WebGLRenderingContextBase::maybeRestoreContext(TimerBase*)
6130 { 6130 {
6131 ASSERT(isContextLost()); 6131 ASSERT(isContextLost());
6132 6132
6133 // The rendering context is not restored unless the default behavior of the 6133 // The rendering context is not restored unless the default behavior of the
6134 // webglcontextlost event was prevented earlier. 6134 // webglcontextlost event was prevented earlier.
6135 // 6135 //
6136 // Because of the way m_restoreTimer is set up for real vs. synthetic lost 6136 // Because of the way m_restoreTimer is set up for real vs. synthetic lost
6137 // context events, we don't have to worry about this test short-circuiting 6137 // context events, we don't have to worry about this test short-circuiting
6138 // the retry loop for real context lost events. 6138 // the retry loop for real context lost events.
6139 if (!m_restoreAllowed) 6139 if (!m_restoreAllowed)
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6490 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6490 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6491 } 6491 }
6492 6492
6493 void WebGLRenderingContextBase::restoreUnpackParameters() 6493 void WebGLRenderingContextBase::restoreUnpackParameters()
6494 { 6494 {
6495 if (m_unpackAlignment != 1) 6495 if (m_unpackAlignment != 1)
6496 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6496 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6497 } 6497 }
6498 6498
6499 } // namespace blink 6499 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698