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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 189833009: Trace where timers were scheduled in Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/MediaController.cpp ('k') | Source/core/html/forms/SearchInputType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4140 4140
4141 ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInCons ole: DontDisplayInConsole; 4141 ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInCons ole: DontDisplayInConsole;
4142 synthesizeGLError(GC3D_CONTEXT_LOST_WEBGL, "loseContext", "context lost", di splay); 4142 synthesizeGLError(GC3D_CONTEXT_LOST_WEBGL, "loseContext", "context lost", di splay);
4143 4143
4144 // Don't allow restoration unless the context lost event has both been 4144 // Don't allow restoration unless the context lost event has both been
4145 // dispatched and its default behavior prevented. 4145 // dispatched and its default behavior prevented.
4146 m_restoreAllowed = false; 4146 m_restoreAllowed = false;
4147 4147
4148 // Always defer the dispatch of the context lost event, to implement 4148 // Always defer the dispatch of the context lost event, to implement
4149 // the spec behavior of queueing a task. 4149 // the spec behavior of queueing a task.
4150 m_dispatchContextLostEventTimer.startOneShot(0); 4150 m_dispatchContextLostEventTimer.startOneShot(0, FROM_HERE);
4151 } 4151 }
4152 4152
4153 void WebGLRenderingContextBase::forceRestoreContext() 4153 void WebGLRenderingContextBase::forceRestoreContext()
4154 { 4154 {
4155 if (!isContextLost()) { 4155 if (!isContextLost()) {
4156 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context not l ost"); 4156 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context not l ost");
4157 return; 4157 return;
4158 } 4158 }
4159 4159
4160 if (!m_restoreAllowed) { 4160 if (!m_restoreAllowed) {
4161 if (m_contextLostMode == SyntheticLostContext) 4161 if (m_contextLostMode == SyntheticLostContext)
4162 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context r estoration not allowed"); 4162 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context r estoration not allowed");
4163 return; 4163 return;
4164 } 4164 }
4165 4165
4166 if (!m_restoreTimer.isActive()) 4166 if (!m_restoreTimer.isActive())
4167 m_restoreTimer.startOneShot(0); 4167 m_restoreTimer.startOneShot(0, FROM_HERE);
4168 } 4168 }
4169 4169
4170 blink::WebLayer* WebGLRenderingContextBase::platformLayer() const 4170 blink::WebLayer* WebGLRenderingContextBase::platformLayer() const
4171 { 4171 {
4172 return m_drawingBuffer->platformLayer(); 4172 return m_drawingBuffer->platformLayer();
4173 } 4173 }
4174 4174
4175 Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil() 4175 Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil()
4176 { 4176 {
4177 if (!m_extensionsUtil) 4177 if (!m_extensionsUtil)
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5305 attribValue.value[ii] = v[ii]; 5305 attribValue.value[ii] = v[ii];
5306 } 5306 }
5307 5307
5308 void WebGLRenderingContextBase::dispatchContextLostEvent(Timer<WebGLRenderingCon textBase>*) 5308 void WebGLRenderingContextBase::dispatchContextLostEvent(Timer<WebGLRenderingCon textBase>*)
5309 { 5309 {
5310 RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(EventTypeNames:: webglcontextlost, false, true, ""); 5310 RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(EventTypeNames:: webglcontextlost, false, true, "");
5311 canvas()->dispatchEvent(event); 5311 canvas()->dispatchEvent(event);
5312 m_restoreAllowed = event->defaultPrevented(); 5312 m_restoreAllowed = event->defaultPrevented();
5313 deactivateContext(this, m_contextLostMode != RealLostContext && m_restoreAll owed); 5313 deactivateContext(this, m_contextLostMode != RealLostContext && m_restoreAll owed);
5314 if ((m_contextLostMode == RealLostContext || m_contextLostMode == AutoRecove rSyntheticLostContext) && m_restoreAllowed) 5314 if ((m_contextLostMode == RealLostContext || m_contextLostMode == AutoRecove rSyntheticLostContext) && m_restoreAllowed)
5315 m_restoreTimer.startOneShot(0); 5315 m_restoreTimer.startOneShot(0, FROM_HERE);
5316 } 5316 }
5317 5317
5318 void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextB ase>*) 5318 void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextB ase>*)
5319 { 5319 {
5320 ASSERT(isContextLost()); 5320 ASSERT(isContextLost());
5321 5321
5322 // The rendering context is not restored unless the default behavior of the 5322 // The rendering context is not restored unless the default behavior of the
5323 // webglcontextlost event was prevented earlier. 5323 // webglcontextlost event was prevented earlier.
5324 // 5324 //
5325 // Because of the way m_restoreTimer is set up for real vs. synthetic lost 5325 // Because of the way m_restoreTimer is set up for real vs. synthetic lost
5326 // context events, we don't have to worry about this test short-circuiting 5326 // context events, we don't have to worry about this test short-circuiting
5327 // the retry loop for real context lost events. 5327 // the retry loop for real context lost events.
5328 if (!m_restoreAllowed) 5328 if (!m_restoreAllowed)
5329 return; 5329 return;
5330 5330
5331 LocalFrame* frame = canvas()->document().frame(); 5331 LocalFrame* frame = canvas()->document().frame();
5332 if (!frame) 5332 if (!frame)
5333 return; 5333 return;
5334 5334
5335 Settings* settings = frame->settings(); 5335 Settings* settings = frame->settings();
5336 5336
5337 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) 5337 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ()))
5338 return; 5338 return;
5339 5339
5340 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes-> attributes(canvas()->document().topDocument().url().string(), settings); 5340 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes-> attributes(canvas()->document().topDocument().url().string(), settings);
5341 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes)); 5341 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes));
5342 if (!context) { 5342 if (!context) {
5343 if (m_contextLostMode == RealLostContext) { 5343 if (m_contextLostMode == RealLostContext) {
5344 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts); 5344 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts, FROM_HERE );
5345 } else { 5345 } else {
5346 // This likely shouldn't happen but is the best way to report it to the WebGL app. 5346 // This likely shouldn't happen but is the best way to report it to the WebGL app.
5347 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context "); 5347 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context ");
5348 } 5348 }
5349 return; 5349 return;
5350 } 5350 }
5351 5351
5352 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager()); 5352 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager());
5353 5353
5354 // Construct a new drawing buffer with the new WebGraphicsContext3D. 5354 // Construct a new drawing buffer with the new WebGraphicsContext3D.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 if (m_textureUnits[i].m_texture2DBinding 5558 if (m_textureUnits[i].m_texture2DBinding
5559 || m_textureUnits[i].m_textureCubeMapBinding) { 5559 || m_textureUnits[i].m_textureCubeMapBinding) {
5560 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5560 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5561 return; 5561 return;
5562 } 5562 }
5563 } 5563 }
5564 m_onePlusMaxNonDefaultTextureUnit = 0; 5564 m_onePlusMaxNonDefaultTextureUnit = 0;
5565 } 5565 }
5566 5566
5567 } // namespace WebCore 5567 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/MediaController.cpp ('k') | Source/core/html/forms/SearchInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698