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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/PluginDocument.cpp ('k') | Source/core/html/parser/HTMLConstructionSite.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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen t* canvas, WebGLContextAttributes* attrs) 517 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen t* canvas, WebGLContextAttributes* attrs)
518 { 518 {
519 Document& document = canvas->document(); 519 Document& document = canvas->document();
520 Frame* frame = document.frame(); 520 Frame* frame = document.frame();
521 if (!frame) 521 if (!frame)
522 return nullptr; 522 return nullptr;
523 Settings* settings = frame->settings(); 523 Settings* settings = frame->settings();
524 524
525 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in 525 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
526 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension. 526 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension.
527 if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnable d())) { 527 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) {
528 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext.")); 528 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext."));
529 return nullptr; 529 return nullptr;
530 } 530 }
531 531
532 GraphicsContext3D::Attributes requestedAttributes = attrs ? attrs->attribute s() : GraphicsContext3D::Attributes(); 532 GraphicsContext3D::Attributes requestedAttributes = attrs ? attrs->attribute s() : GraphicsContext3D::Attributes();
533 requestedAttributes.noExtensions = true; 533 requestedAttributes.noExtensions = true;
534 requestedAttributes.shareResources = true; 534 requestedAttributes.shareResources = true;
535 requestedAttributes.preferDiscreteGPU = true; 535 requestedAttributes.preferDiscreteGPU = true;
536 requestedAttributes.topDocumentURL = document.topDocument()->url(); 536 requestedAttributes.topDocumentURL = document.topDocument()->url();
537 537
(...skipping 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4150 if (isContextLost()) 4150 if (isContextLost())
4151 return; 4151 return;
4152 4152
4153 m_contextLost = true; 4153 m_contextLost = true;
4154 m_contextLostMode = mode; 4154 m_contextLostMode = mode;
4155 4155
4156 if (mode == RealLostContext) { 4156 if (mode == RealLostContext) {
4157 // Inform the embedder that a lost context was received. In response, th e embedder might 4157 // Inform the embedder that a lost context was received. In response, th e embedder might
4158 // decide to take action such as asking the user for permission to use W ebGL again. 4158 // decide to take action such as asking the user for permission to use W ebGL again.
4159 if (Frame* frame = canvas()->document().frame()) 4159 if (Frame* frame = canvas()->document().frame())
4160 frame->loader()->client()->didLoseWebGLContext(m_context->extensions ()->getGraphicsResetStatusARB()); 4160 frame->loader().client()->didLoseWebGLContext(m_context->extensions( )->getGraphicsResetStatusARB());
4161 } 4161 }
4162 4162
4163 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer. 4163 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer.
4164 m_drawingBuffer->setTexture2DBinding(0); 4164 m_drawingBuffer->setTexture2DBinding(0);
4165 m_drawingBuffer->setFramebufferBinding(0); 4165 m_drawingBuffer->setFramebufferBinding(0);
4166 4166
4167 detachAndRemoveAllObjects(); 4167 detachAndRemoveAllObjects();
4168 4168
4169 // Lose all the extensions. 4169 // Lose all the extensions.
4170 for (size_t i = 0; i < m_extensions.size(); ++i) { 4170 for (size_t i = 0; i < m_extensions.size(); ++i) {
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5382 // the retry loop for real context lost events. 5382 // the retry loop for real context lost events.
5383 if (!m_restoreAllowed) 5383 if (!m_restoreAllowed)
5384 return; 5384 return;
5385 5385
5386 Frame* frame = canvas()->document().frame(); 5386 Frame* frame = canvas()->document().frame();
5387 if (!frame) 5387 if (!frame)
5388 return; 5388 return;
5389 5389
5390 Settings* settings = frame->settings(); 5390 Settings* settings = frame->settings();
5391 5391
5392 if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnable d())) 5392 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ()))
5393 return; 5393 return;
5394 5394
5395 // Reset the context attributes back to the requested attributes and re-appl y restrictions 5395 // Reset the context attributes back to the requested attributes and re-appl y restrictions
5396 m_attributes = adjustAttributes(m_requestedAttributes, settings); 5396 m_attributes = adjustAttributes(m_requestedAttributes, settings);
5397 5397
5398 RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(m_attributes)); 5398 RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(m_attributes));
5399 5399
5400 if (!context) { 5400 if (!context) {
5401 if (m_contextLostMode == RealLostContext) 5401 if (m_contextLostMode == RealLostContext)
5402 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts); 5402 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5615 if (m_textureUnits[i].m_texture2DBinding 5615 if (m_textureUnits[i].m_texture2DBinding
5616 || m_textureUnits[i].m_textureCubeMapBinding) { 5616 || m_textureUnits[i].m_textureCubeMapBinding) {
5617 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5617 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5618 return; 5618 return;
5619 } 5619 }
5620 } 5620 }
5621 m_onePlusMaxNonDefaultTextureUnit = 0; 5621 m_onePlusMaxNonDefaultTextureUnit = 0;
5622 } 5622 }
5623 5623
5624 } // namespace WebCore 5624 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/PluginDocument.cpp ('k') | Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698