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/WebGLRenderingContextBase.cpp

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Round of improvements Created 6 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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "wtf/PassOwnPtr.h" 85 #include "wtf/PassOwnPtr.h"
86 #include "wtf/Uint32Array.h" 86 #include "wtf/Uint32Array.h"
87 #include "wtf/text/StringBuilder.h" 87 #include "wtf/text/StringBuilder.h"
88 88
89 namespace WebCore { 89 namespace WebCore {
90 90
91 const double secondsBetweenRestoreAttempts = 1.0; 91 const double secondsBetweenRestoreAttempts = 1.0;
92 const int maxGLErrorsAllowedToConsole = 256; 92 const int maxGLErrorsAllowedToConsole = 256;
93 const unsigned maxGLActiveContexts = 16; 93 const unsigned maxGLActiveContexts = 16;
94 94
95 // FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase obj ects
96 // are kept here. This relies on the WebGLRenderingContextBase finalization to
97 // explicitly retire themselves from these vectors, but it'd be preferable if
98 // the references were traced as per usual.
haraken 2014/07/03 04:40:29 An alternative would be to use PersistentHeapHashS
sof 2014/07/03 07:25:48 Who knows if a hash set preserves any assumed orde
95 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts() 99 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts()
96 { 100 {
97 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ()); 101 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ());
98 return activeContexts; 102 return activeContexts;
99 } 103 }
100 104
101 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo ntexts() 105 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo ntexts()
102 { 106 {
103 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte xts, ()); 107 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte xts, ());
104 return forciblyEvictedContexts; 108 return forciblyEvictedContexts;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void WebGLRenderingContextBase::willDestroyContext(WebGLRenderingContextBase* co ntext) 184 void WebGLRenderingContextBase::willDestroyContext(WebGLRenderingContextBase* co ntext)
181 { 185 {
182 size_t position = forciblyEvictedContexts().find(context); 186 size_t position = forciblyEvictedContexts().find(context);
183 if (position != WTF::kNotFound) 187 if (position != WTF::kNotFound)
184 forciblyEvictedContexts().remove(position); 188 forciblyEvictedContexts().remove(position);
185 189
186 deactivateContext(context, false); 190 deactivateContext(context, false);
187 191
188 // Try to re-enable the oldest inactive contexts. 192 // Try to re-enable the oldest inactive contexts.
189 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex ts().size()) { 193 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex ts().size()) {
190 WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().fi rst(); 194 WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().fi rst();
haraken 2014/07/03 04:40:29 Sorry for asking again, but how is it guaranteed t
sof 2014/07/03 07:25:48 _Each_ WebGLContextRenderingBase calls willDestroy
191 if (!evictedContext->m_restoreAllowed) { 195 if (!evictedContext->m_restoreAllowed) {
192 forciblyEvictedContexts().remove(0); 196 forciblyEvictedContexts().remove(0);
193 continue; 197 continue;
194 } 198 }
195 199
196 IntSize desiredSize = DrawingBuffer::adjustSize(evictedContext->clampedC anvasSize(), IntSize(), evictedContext->m_maxTextureSize); 200 IntSize desiredSize = DrawingBuffer::adjustSize(evictedContext->clampedC anvasSize(), IntSize(), evictedContext->m_maxTextureSize);
197 201
198 // If there's room in the pixel budget for this context, restore it. 202 // If there's room in the pixel budget for this context, restore it.
199 if (!desiredSize.isEmpty()) { 203 if (!desiredSize.isEmpty()) {
200 forciblyEvictedContexts().remove(0); 204 forciblyEvictedContexts().remove(0);
(...skipping 10 matching lines...) Expand all
211 WebGLRenderingContextBase::forciblyLoseOldestContext(reason); 215 WebGLRenderingContextBase::forciblyLoseOldestContext(reason);
212 }; 216 };
213 IntSize oldestContextSize() { 217 IntSize oldestContextSize() {
214 return WebGLRenderingContextBase::oldestContextSize(); 218 return WebGLRenderingContextBase::oldestContextSize();
215 }; 219 };
216 }; 220 };
217 221
218 namespace { 222 namespace {
219 223
220 class ScopedDrawingBufferBinder { 224 class ScopedDrawingBufferBinder {
225 STACK_ALLOCATED();
221 public: 226 public:
222 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding) 227 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding)
223 : m_drawingBuffer(drawingBuffer) 228 : m_drawingBuffer(drawingBuffer)
224 , m_framebufferBinding(framebufferBinding) 229 , m_framebufferBinding(framebufferBinding)
225 { 230 {
226 // Commit DrawingBuffer if needed (e.g., for multisampling) 231 // Commit DrawingBuffer if needed (e.g., for multisampling)
227 if (!m_framebufferBinding && m_drawingBuffer) 232 if (!m_framebufferBinding && m_drawingBuffer)
228 m_drawingBuffer->commit(); 233 m_drawingBuffer->commit();
229 } 234 }
230 235
231 ~ScopedDrawingBufferBinder() 236 ~ScopedDrawingBufferBinder()
232 { 237 {
233 // Restore DrawingBuffer if needed 238 // Restore DrawingBuffer if needed
234 if (!m_framebufferBinding && m_drawingBuffer) 239 if (!m_framebufferBinding && m_drawingBuffer)
235 m_drawingBuffer->bind(); 240 m_drawingBuffer->bind();
236 } 241 }
237 242
238 private: 243 private:
239 DrawingBuffer* m_drawingBuffer; 244 DrawingBuffer* m_drawingBuffer;
240 WebGLFramebuffer* m_framebufferBinding; 245 RawPtrWillBeMember<WebGLFramebuffer> m_framebufferBinding;
241 }; 246 };
242 247
243 Platform3DObject objectOrZero(WebGLObject* object) 248 Platform3DObject objectOrZero(WebGLObject* object)
244 { 249 {
245 return object ? object->object() : 0; 250 return object ? object->object() : 0;
246 } 251 }
247 252
248 GLint clamp(GLint value, GLint min, GLint max) 253 GLint clamp(GLint value, GLint min, GLint max)
249 { 254 {
250 if (value < min) 255 if (value < min)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 460
456 // Swallow all other characters. Unclear whether we may 461 // Swallow all other characters. Unclear whether we may
457 // want or need to just emit a space per character to try 462 // want or need to just emit a space per character to try
458 // to preserve column numbers for debugging purposes. 463 // to preserve column numbers for debugging purposes.
459 break; 464 break;
460 } 465 }
461 } 466 }
462 } // namespace anonymous 467 } // namespace anonymous
463 468
464 class ScopedTexture2DRestorer { 469 class ScopedTexture2DRestorer {
470 STACK_ALLOCATED();
465 public: 471 public:
466 ScopedTexture2DRestorer(WebGLRenderingContextBase* context) 472 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context)
467 : m_context(context) 473 : m_context(context)
468 { 474 {
469 } 475 }
470 476
471 ~ScopedTexture2DRestorer() 477 ~ScopedTexture2DRestorer()
472 { 478 {
473 m_context->restoreCurrentTexture2D(); 479 m_context->restoreCurrentTexture2D();
474 } 480 }
475 481
476 private: 482 private:
477 WebGLRenderingContextBase* m_context; 483 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
478 }; 484 };
479 485
480 class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::We bGraphicsContextLostCallback { 486 class WebGLRenderingContextLostCallback FINAL : public NoBaseWillBeGarbageCollec tedFinalized<WebGLRenderingContextLostCallback>, public blink::WebGraphicsContex t3D::WebGraphicsContextLostCallback {
481 WTF_MAKE_FAST_ALLOCATED; 487 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
482 public: 488 public:
483 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) : m_context(cb) { } 489 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG LRenderingContextBase* context)
490 {
491 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context) );
492 }
493
494 virtual ~WebGLRenderingContextLostCallback() {}
haraken 2014/07/03 04:40:29 Nit: One space needed between { and }.
sof 2014/07/03 07:25:48 Added.
495
484 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext); } 496 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext); }
485 virtual ~WebGLRenderingContextLostCallback() {} 497
498 void trace(Visitor* visitor)
499 {
500 visitor->trace(m_context);
501 }
502
486 private: 503 private:
487 WebGLRenderingContextBase* m_context; 504 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t)
505 : m_context(context) { }
506
507 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
488 }; 508 };
489 509
490 class WebGLRenderingContextErrorMessageCallback : public blink::WebGraphicsConte xt3D::WebGraphicsErrorMessageCallback { 510 class WebGLRenderingContextErrorMessageCallback FINAL : public NoBaseWillBeGarba geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public blink::W ebGraphicsContext3D::WebGraphicsErrorMessageCallback {
491 WTF_MAKE_FAST_ALLOCATED; 511 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
492 public: 512 public:
493 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * cb) : m_context(cb) { } 513 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre ate(WebGLRenderingContextBase* context)
514 {
515 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback( context));
516 }
517
518 virtual ~WebGLRenderingContextErrorMessageCallback() { }
519
494 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint ) 520 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint )
495 { 521 {
496 if (m_context->m_synthesizedErrorsToConsole) 522 if (m_context->m_synthesizedErrorsToConsole)
497 m_context->printGLErrorToConsole(message); 523 m_context->printGLErrorToConsole(message);
498 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); 524 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message);
499 } 525 }
500 virtual ~WebGLRenderingContextErrorMessageCallback() { } 526
527 void trace(Visitor* visitor)
528 {
529 visitor->trace(m_context);
530 }
531
501 private: 532 private:
502 WebGLRenderingContextBase* m_context; 533 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * context)
534 : m_context(context) { }
535
536 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
503 }; 537 };
504 538
505 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r equestedAttributes) 539 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r equestedAttributes)
506 : CanvasRenderingContext(passedCanvas) 540 : CanvasRenderingContext(passedCanvas)
507 , ActiveDOMObject(&passedCanvas->document()) 541 , ActiveDOMObject(&passedCanvas->document())
508 , m_drawingBuffer(nullptr) 542 , m_drawingBuffer(nullptr)
509 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent) 543 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent)
510 , m_restoreAllowed(false) 544 , m_restoreAllowed(false)
511 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) 545 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext)
512 , m_generatedImageCache(4) 546 , m_generatedImageCache(4)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 addContextObject(m_defaultVertexArrayObject.get()); 646 addContextObject(m_defaultVertexArrayObject.get());
613 m_boundVertexArrayObject = m_defaultVertexArrayObject; 647 m_boundVertexArrayObject = m_defaultVertexArrayObject;
614 648
615 m_vertexAttribValue.resize(m_maxVertexAttribs); 649 m_vertexAttribValue.resize(m_maxVertexAttribs);
616 650
617 createFallbackBlackTextures1x1(); 651 createFallbackBlackTextures1x1();
618 652
619 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); 653 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight());
620 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); 654 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight());
621 655
622 m_contextLostCallbackAdapter = adoptPtr(new WebGLRenderingContextLostCallbac k(this)); 656 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi s);
623 m_errorMessageCallbackAdapter = adoptPtr(new WebGLRenderingContextErrorMessa geCallback(this)); 657 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c reate(this);
624 658
625 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); 659 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get());
626 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); 660 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get());
627 661
628 // This ensures that the context has a valid "lastFlushID" and won't be mist akenly identified as the "least recently used" context. 662 // This ensures that the context has a valid "lastFlushID" and won't be mist akenly identified as the "least recently used" context.
629 webContext()->flush(); 663 webContext()->flush();
630 664
631 for (int i = 0; i < WebGLExtensionNameCount; ++i) 665 for (int i = 0; i < WebGLExtensionNameCount; ++i)
632 m_extensionEnabled[i] = false; 666 m_extensionEnabled[i] = false;
633 667
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen deringContext supports. 699 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen deringContext supports.
666 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext * context) 700 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext * context)
667 { 701 {
668 if (!context->is3d()) 702 if (!context->is3d())
669 return 0; 703 return 0;
670 return static_cast<const WebGLRenderingContextBase*>(context)->version(); 704 return static_cast<const WebGLRenderingContextBase*>(context)->version();
671 } 705 }
672 706
673 WebGLRenderingContextBase::~WebGLRenderingContextBase() 707 WebGLRenderingContextBase::~WebGLRenderingContextBase()
674 { 708 {
709 #if !ENABLE(OILPAN)
675 // Remove all references to WebGLObjects so if they are the last reference 710 // Remove all references to WebGLObjects so if they are the last reference
676 // they will be freed before the last context is removed from the context gr oup. 711 // they will be freed before the last context is removed from the context gr oup.
677 m_boundArrayBuffer = nullptr; 712 m_boundArrayBuffer = nullptr;
678 m_defaultVertexArrayObject = nullptr; 713 m_defaultVertexArrayObject = nullptr;
679 m_boundVertexArrayObject = nullptr; 714 m_boundVertexArrayObject = nullptr;
680 m_vertexAttrib0Buffer = nullptr; 715 m_vertexAttrib0Buffer = nullptr;
681 m_currentProgram = nullptr; 716 m_currentProgram = nullptr;
682 m_framebufferBinding = nullptr; 717 m_framebufferBinding = nullptr;
683 m_renderbufferBinding = nullptr; 718 m_renderbufferBinding = nullptr;
684 719
685 for (size_t i = 0; i < m_textureUnits.size(); ++i) { 720 for (size_t i = 0; i < m_textureUnits.size(); ++i) {
686 m_textureUnits[i].m_texture2DBinding = nullptr; 721 m_textureUnits[i].m_texture2DBinding = nullptr;
687 m_textureUnits[i].m_textureCubeMapBinding = nullptr; 722 m_textureUnits[i].m_textureCubeMapBinding = nullptr;
688 } 723 }
689 724
690 m_blackTexture2D = nullptr; 725 m_blackTexture2D = nullptr;
691 m_blackTextureCubeMap = nullptr; 726 m_blackTextureCubeMap = nullptr;
692 727
693 detachAndRemoveAllObjects(); 728 detachAndRemoveAllObjects();
haraken 2014/07/03 04:40:29 Again, is it OK not to call detachAndRemoveAllObje
sof 2014/07/03 07:25:48 It touches heap objects, so it cannot happen here.
729 #endif
694 730
695 // release all extensions 731 // Release all extensions now.
696 for (size_t i = 0; i < m_extensions.size(); ++i) 732 m_extensions.clear();
697 delete m_extensions[i];
698 733
699 // Context must be removed from the group prior to the destruction of the 734 // Context must be removed from the group prior to the destruction of the
700 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d. 735 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d.
701 m_contextGroup->removeContext(this); 736 m_contextGroup->removeContext(this);
702 737
703 destroyContext(); 738 destroyContext();
704 739
705 #if !ENABLE(OILPAN) 740 #if !ENABLE(OILPAN)
706 if (m_multisamplingObserverRegistered) { 741 if (m_multisamplingObserverRegistered)
707 Page* page = canvas()->document().page(); 742 if (Page* page = canvas()->document().page())
708 if (page)
709 page->removeMultisamplingChangedObserver(this); 743 page->removeMultisamplingChangedObserver(this);
710 }
711 #endif 744 #endif
712 745
713 willDestroyContext(this); 746 willDestroyContext(this);
714 } 747 }
715 748
716 void WebGLRenderingContextBase::destroyContext() 749 void WebGLRenderingContextBase::destroyContext()
717 { 750 {
718 m_contextLost = true; 751 m_contextLost = true;
719 752
720 if (!m_drawingBuffer) 753 if (!m_drawingBuffer)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 786
754 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) 787 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask)
755 { 788 {
756 if (isContextLost()) 789 if (isContextLost())
757 return false; 790 return false;
758 791
759 if (!m_drawingBuffer->layerComposited() || m_layerCleared 792 if (!m_drawingBuffer->layerComposited() || m_layerCleared
760 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf ferBinding)) 793 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf ferBinding))
761 return false; 794 return false;
762 795
763 RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes(); 796 RefPtrWillBeRawPtr<WebGLContextAttributes> contextAttributes = getContextAtt ributes();
764 797
765 // Determine if it's possible to combine the clear the user asked for and th is clear. 798 // Determine if it's possible to combine the clear the user asked for and th is clear.
766 bool combinedClear = mask && !m_scissorEnabled; 799 bool combinedClear = mask && !m_scissorEnabled;
767 800
768 webContext()->disable(GL_SCISSOR_TEST); 801 webContext()->disable(GL_SCISSOR_TEST);
769 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { 802 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) {
770 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, 803 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0,
771 m_colorMask[1] ? m_clearColor[1] : 0, 804 m_colorMask[1] ? m_clearColor[1] : 0,
772 m_colorMask[2] ? m_clearColor[2] : 0, 805 m_colorMask[2] ? m_clearColor[2] : 0,
773 m_colorMask[3] ? m_clearColor[3] : 0); 806 m_colorMask[3] ? m_clearColor[3] : 0);
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 const char* reason = "framebuffer incomplete"; 1513 const char* reason = "framebuffer incomplete";
1481 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r eason)) { 1514 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r eason)) {
1482 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason); 1515 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason);
1483 return; 1516 return;
1484 } 1517 }
1485 clearIfComposited(); 1518 clearIfComposited();
1486 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding .get()); 1519 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding .get());
1487 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); 1520 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height);
1488 } 1521 }
1489 1522
1490 PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() 1523 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
1491 { 1524 {
1492 if (isContextLost()) 1525 if (isContextLost())
1493 return nullptr; 1526 return nullptr;
1494 RefPtr<WebGLBuffer> o = WebGLBuffer::create(this); 1527 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this);
1495 addSharedObject(o.get()); 1528 addSharedObject(o.get());
1496 return o; 1529 return o.release();
1497 } 1530 }
1498 1531
1499 PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer() 1532 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb uffer()
1500 { 1533 {
1501 if (isContextLost()) 1534 if (isContextLost())
1502 return nullptr; 1535 return nullptr;
1503 RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); 1536 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
1504 addContextObject(o.get()); 1537 addContextObject(o.get());
1505 return o; 1538 return o.release();
1506 } 1539 }
1507 1540
1508 PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() 1541 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture()
1509 { 1542 {
1510 if (isContextLost()) 1543 if (isContextLost())
1511 return nullptr; 1544 return nullptr;
1512 RefPtr<WebGLTexture> o = WebGLTexture::create(this); 1545 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this);
1513 addSharedObject(o.get()); 1546 addSharedObject(o.get());
1514 return o; 1547 return o.release();
1515 } 1548 }
1516 1549
1517 PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() 1550 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
1518 { 1551 {
1519 if (isContextLost()) 1552 if (isContextLost())
1520 return nullptr; 1553 return nullptr;
1521 RefPtr<WebGLProgram> o = WebGLProgram::create(this); 1554 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this);
1522 addSharedObject(o.get()); 1555 addSharedObject(o.get());
1523 return o; 1556 return o.release();
1524 } 1557 }
1525 1558
1526 PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer() 1559 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende rbuffer()
1527 { 1560 {
1528 if (isContextLost()) 1561 if (isContextLost())
1529 return nullptr; 1562 return nullptr;
1530 RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); 1563 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
1531 addSharedObject(o.get()); 1564 addSharedObject(o.get());
1532 return o; 1565 return o.release();
1533 } 1566 }
1534 1567
1535 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) 1568 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer)
1536 { 1569 {
1537 if (isContextLost()) 1570 if (isContextLost())
1538 return 0; 1571 return 0;
1539 if (!renderbuffer->emulatedStencilBuffer()) { 1572 if (!renderbuffer->emulatedStencilBuffer()) {
1540 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); 1573 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer());
1541 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); 1574 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer()));
1542 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); 1575 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get()));
1543 } 1576 }
1544 return renderbuffer->emulatedStencilBuffer(); 1577 return renderbuffer->emulatedStencilBuffer();
1545 } 1578 }
1546 1579
1547 PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type) 1580 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen um type)
1548 { 1581 {
1549 if (isContextLost()) 1582 if (isContextLost())
1550 return nullptr; 1583 return nullptr;
1551 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { 1584 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) {
1552 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); 1585 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" );
1553 return nullptr; 1586 return nullptr;
1554 } 1587 }
1555 1588
1556 RefPtr<WebGLShader> o = WebGLShader::create(this, type); 1589 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type);
1557 addSharedObject(o.get()); 1590 addSharedObject(o.get());
1558 return o; 1591 return o.release();
1559 } 1592 }
1560 1593
1561 void WebGLRenderingContextBase::cullFace(GLenum mode) 1594 void WebGLRenderingContextBase::cullFace(GLenum mode)
1562 { 1595 {
1563 if (isContextLost()) 1596 if (isContextLost())
1564 return; 1597 return;
1565 switch (mode) { 1598 switch (mode) {
1566 case GL_FRONT_AND_BACK: 1599 case GL_FRONT_AND_BACK:
1567 case GL_FRONT: 1600 case GL_FRONT:
1568 case GL_BACK: 1601 case GL_BACK:
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 } 2027 }
1995 #endif 2028 #endif
1996 webContext()->generateMipmap(target); 2029 webContext()->generateMipmap(target);
1997 #if OS(MACOSX) 2030 #if OS(MACOSX)
1998 if (needToResetMinFilter) 2031 if (needToResetMinFilter)
1999 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); 2032 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter());
2000 #endif 2033 #endif
2001 tex->generateMipmapLevelInfo(); 2034 tex->generateMipmapLevelInfo();
2002 } 2035 }
2003 2036
2004 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProg ram* program, GLuint index) 2037 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index)
2005 { 2038 {
2006 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) 2039 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
2007 return nullptr; 2040 return nullptr;
2008 blink::WebGraphicsContext3D::ActiveInfo info; 2041 blink::WebGraphicsContext3D::ActiveInfo info;
2009 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) 2042 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
2010 return nullptr; 2043 return nullptr;
2011 return WebGLActiveInfo::create(info.name, info.type, info.size); 2044 return WebGLActiveInfo::create(info.name, info.type, info.size);
2012 } 2045 }
2013 2046
2014 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro gram* program, GLuint index) 2047 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index)
2015 { 2048 {
2016 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2049 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2017 return nullptr; 2050 return nullptr;
2018 blink::WebGraphicsContext3D::ActiveInfo info; 2051 blink::WebGraphicsContext3D::ActiveInfo info;
2019 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2052 if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
2020 return nullptr; 2053 return nullptr;
2021 return WebGLActiveInfo::create(info.name, info.type, info.size); 2054 return WebGLActiveInfo::create(info.name, info.type, info.size);
2022 } 2055 }
2023 2056
2024 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector <RefPtr<WebGLShader> >& shaderObjects) 2057 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, WillBe HeapVector<RefPtrWillBeMember<WebGLShader> >& shaderObjects)
2025 { 2058 {
2026 shaderObjects.clear(); 2059 shaderObjects.clear();
2027 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2060 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2028 return false; 2061 return false;
2029 2062
2030 const GLenum shaderType[] = { 2063 const GLenum shaderType[] = {
2031 GL_VERTEX_SHADER, 2064 GL_VERTEX_SHADER,
2032 GL_FRAGMENT_SHADER 2065 GL_FRAGMENT_SHADER
2033 }; 2066 };
2034 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { 2067 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 return WebGLGetInfo(); 2103 return WebGLGetInfo();
2071 } 2104 }
2072 2105
2073 GLint value = 0; 2106 GLint value = 0;
2074 webContext()->getBufferParameteriv(target, pname, &value); 2107 webContext()->getBufferParameteriv(target, pname, &value);
2075 if (pname == GL_BUFFER_SIZE) 2108 if (pname == GL_BUFFER_SIZE)
2076 return WebGLGetInfo(value); 2109 return WebGLGetInfo(value);
2077 return WebGLGetInfo(static_cast<unsigned>(value)); 2110 return WebGLGetInfo(static_cast<unsigned>(value));
2078 } 2111 }
2079 2112
2080 PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttribut es() 2113 PassRefPtrWillBeRawPtr<WebGLContextAttributes> WebGLRenderingContextBase::getCon textAttributes()
2081 { 2114 {
2082 if (isContextLost()) 2115 if (isContextLost())
2083 return nullptr; 2116 return nullptr;
2084 // We always need to return a new WebGLContextAttributes object to 2117 // We always need to return a new WebGLContextAttributes object to
2085 // prevent the user from mutating any cached version. 2118 // prevent the user from mutating any cached version.
2086 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt tributes(); 2119 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt tributes();
2087 RefPtr<WebGLContextAttributes> attributes = m_requestedAttributes->clone(); 2120 RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = m_requestedAttribute s->clone();
2088 // Some requested attributes may not be honored, so we need to query the und erlying 2121 // Some requested attributes may not be honored, so we need to query the und erlying
2089 // context/drawing buffer and adjust accordingly. 2122 // context/drawing buffer and adjust accordingly.
2090 if (m_requestedAttributes->depth() && !attrs.depth) 2123 if (m_requestedAttributes->depth() && !attrs.depth)
2091 attributes->setDepth(false); 2124 attributes->setDepth(false);
2092 if (m_requestedAttributes->stencil() && !attrs.stencil) 2125 if (m_requestedAttributes->stencil() && !attrs.stencil)
2093 attributes->setStencil(false); 2126 attributes->setStencil(false);
2094 attributes->setAntialias(m_drawingBuffer->multisample()); 2127 attributes->setAntialias(m_drawingBuffer->multisample());
2095 return attributes.release(); 2128 return attributes.release();
2096 } 2129 }
2097 2130
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac ker* tracker) 2163 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac ker* tracker)
2131 { 2164 {
2132 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) 2165 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ())
2133 return false; 2166 return false;
2134 if (!tracker->supported(this)) 2167 if (!tracker->supported(this))
2135 return false; 2168 return false;
2136 return true; 2169 return true;
2137 } 2170 }
2138 2171
2139 2172
2140 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String& name) 2173 PassRefPtrWillBeRawPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(c onst String& name)
2141 { 2174 {
2142 if (isContextLost()) 2175 if (isContextLost())
2143 return nullptr; 2176 return nullptr;
2144 2177
2145 for (size_t i = 0; i < m_extensions.size(); ++i) { 2178 for (size_t i = 0; i < m_extensions.size(); ++i) {
2146 ExtensionTracker* tracker = m_extensions[i]; 2179 ExtensionTracker* tracker = m_extensions[i].get();
2147 if (tracker->matchesNameWithPrefixes(name)) { 2180 if (tracker->matchesNameWithPrefixes(name)) {
2148 if (!extensionSupportedAndAllowed(tracker)) 2181 if (!extensionSupportedAndAllowed(tracker))
2149 return nullptr; 2182 return nullptr;
2150 2183
2151 RefPtr<WebGLExtension> extension = tracker->getExtension(this); 2184 RefPtrWillBeRawPtr<WebGLExtension> extension = tracker->getExtension (this);
2152 if (extension) 2185 if (extension)
2153 m_extensionEnabled[extension->name()] = true; 2186 m_extensionEnabled[extension->name()] = true;
2154 return extension.release(); 2187 return extension.release();
2155 } 2188 }
2156 } 2189 }
2157 2190
2158 return nullptr; 2191 return nullptr;
2159 } 2192 }
2160 2193
2161 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname) 2194 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname)
(...skipping 15 matching lines...) Expand all
2177 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); 2210 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name");
2178 return WebGLGetInfo(); 2211 return WebGLGetInfo();
2179 } 2212 }
2180 2213
2181 ASSERT(object->isTexture() || object->isRenderbuffer()); 2214 ASSERT(object->isTexture() || object->isRenderbuffer());
2182 if (object->isTexture()) { 2215 if (object->isTexture()) {
2183 switch (pname) { 2216 switch (pname) {
2184 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2217 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2185 return WebGLGetInfo(GL_TEXTURE); 2218 return WebGLGetInfo(GL_TEXTURE);
2186 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2219 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2187 return WebGLGetInfo(PassRefPtr<WebGLTexture>(static_cast<WebGLTextur e*>(object))); 2220 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(static_cast <WebGLTexture*>(object)));
2188 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 2221 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
2189 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 2222 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
2190 { 2223 {
2191 GLint value = 0; 2224 GLint value = 0;
2192 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2225 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2193 return WebGLGetInfo(value); 2226 return WebGLGetInfo(value);
2194 } 2227 }
2195 default: 2228 default:
2196 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); 2229 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment");
2197 return WebGLGetInfo(); 2230 return WebGLGetInfo();
2198 } 2231 }
2199 } else { 2232 } else {
2200 switch (pname) { 2233 switch (pname) {
2201 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2234 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2202 return WebGLGetInfo(GL_RENDERBUFFER); 2235 return WebGLGetInfo(GL_RENDERBUFFER);
2203 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2236 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2204 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(static_cast<WebGLR enderbuffer*>(object))); 2237 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(static _cast<WebGLRenderbuffer*>(object)));
2205 default: 2238 default:
2206 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2239 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
2207 return WebGLGetInfo(); 2240 return WebGLGetInfo();
2208 } 2241 }
2209 } 2242 }
2210 } 2243 }
2211 2244
2212 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) 2245 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
2213 { 2246 {
2214 if (isContextLost()) 2247 if (isContextLost())
2215 return WebGLGetInfo(); 2248 return WebGLGetInfo();
2216 const int intZero = 0; 2249 const int intZero = 0;
2217 switch (pname) { 2250 switch (pname) {
2218 case GL_ACTIVE_TEXTURE: 2251 case GL_ACTIVE_TEXTURE:
2219 return getUnsignedIntParameter(pname); 2252 return getUnsignedIntParameter(pname);
2220 case GL_ALIASED_LINE_WIDTH_RANGE: 2253 case GL_ALIASED_LINE_WIDTH_RANGE:
2221 return getWebGLFloatArrayParameter(pname); 2254 return getWebGLFloatArrayParameter(pname);
2222 case GL_ALIASED_POINT_SIZE_RANGE: 2255 case GL_ALIASED_POINT_SIZE_RANGE:
2223 return getWebGLFloatArrayParameter(pname); 2256 return getWebGLFloatArrayParameter(pname);
2224 case GL_ALPHA_BITS: 2257 case GL_ALPHA_BITS:
2225 return getIntParameter(pname); 2258 return getIntParameter(pname);
2226 case GL_ARRAY_BUFFER_BINDING: 2259 case GL_ARRAY_BUFFER_BINDING:
2227 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer)); 2260 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundArrayBuff er.get()));
2228 case GL_BLEND: 2261 case GL_BLEND:
2229 return getBooleanParameter(pname); 2262 return getBooleanParameter(pname);
2230 case GL_BLEND_COLOR: 2263 case GL_BLEND_COLOR:
2231 return getWebGLFloatArrayParameter(pname); 2264 return getWebGLFloatArrayParameter(pname);
2232 case GL_BLEND_DST_ALPHA: 2265 case GL_BLEND_DST_ALPHA:
2233 return getUnsignedIntParameter(pname); 2266 return getUnsignedIntParameter(pname);
2234 case GL_BLEND_DST_RGB: 2267 case GL_BLEND_DST_RGB:
2235 return getUnsignedIntParameter(pname); 2268 return getUnsignedIntParameter(pname);
2236 case GL_BLEND_EQUATION_ALPHA: 2269 case GL_BLEND_EQUATION_ALPHA:
2237 return getUnsignedIntParameter(pname); 2270 return getUnsignedIntParameter(pname);
2238 case GL_BLEND_EQUATION_RGB: 2271 case GL_BLEND_EQUATION_RGB:
2239 return getUnsignedIntParameter(pname); 2272 return getUnsignedIntParameter(pname);
2240 case GL_BLEND_SRC_ALPHA: 2273 case GL_BLEND_SRC_ALPHA:
2241 return getUnsignedIntParameter(pname); 2274 return getUnsignedIntParameter(pname);
2242 case GL_BLEND_SRC_RGB: 2275 case GL_BLEND_SRC_RGB:
2243 return getUnsignedIntParameter(pname); 2276 return getUnsignedIntParameter(pname);
2244 case GL_BLUE_BITS: 2277 case GL_BLUE_BITS:
2245 return getIntParameter(pname); 2278 return getIntParameter(pname);
2246 case GL_COLOR_CLEAR_VALUE: 2279 case GL_COLOR_CLEAR_VALUE:
2247 return getWebGLFloatArrayParameter(pname); 2280 return getWebGLFloatArrayParameter(pname);
2248 case GL_COLOR_WRITEMASK: 2281 case GL_COLOR_WRITEMASK:
2249 return getBooleanArrayParameter(pname); 2282 return getBooleanArrayParameter(pname);
2250 case GL_COMPRESSED_TEXTURE_FORMATS: 2283 case GL_COMPRESSED_TEXTURE_FORMATS:
2251 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data( ), m_compressedTextureFormats.size())); 2284 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data( ), m_compressedTextureFormats.size()));
2252 case GL_CULL_FACE: 2285 case GL_CULL_FACE:
2253 return getBooleanParameter(pname); 2286 return getBooleanParameter(pname);
2254 case GL_CULL_FACE_MODE: 2287 case GL_CULL_FACE_MODE:
2255 return getUnsignedIntParameter(pname); 2288 return getUnsignedIntParameter(pname);
2256 case GL_CURRENT_PROGRAM: 2289 case GL_CURRENT_PROGRAM:
2257 return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram)); 2290 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgra m.get()));
2258 case GL_DEPTH_BITS: 2291 case GL_DEPTH_BITS:
2259 if (!m_framebufferBinding && !m_requestedAttributes->depth()) 2292 if (!m_framebufferBinding && !m_requestedAttributes->depth())
2260 return WebGLGetInfo(intZero); 2293 return WebGLGetInfo(intZero);
2261 return getIntParameter(pname); 2294 return getIntParameter(pname);
2262 case GL_DEPTH_CLEAR_VALUE: 2295 case GL_DEPTH_CLEAR_VALUE:
2263 return getFloatParameter(pname); 2296 return getFloatParameter(pname);
2264 case GL_DEPTH_FUNC: 2297 case GL_DEPTH_FUNC:
2265 return getUnsignedIntParameter(pname); 2298 return getUnsignedIntParameter(pname);
2266 case GL_DEPTH_RANGE: 2299 case GL_DEPTH_RANGE:
2267 return getWebGLFloatArrayParameter(pname); 2300 return getWebGLFloatArrayParameter(pname);
2268 case GL_DEPTH_TEST: 2301 case GL_DEPTH_TEST:
2269 return getBooleanParameter(pname); 2302 return getBooleanParameter(pname);
2270 case GL_DEPTH_WRITEMASK: 2303 case GL_DEPTH_WRITEMASK:
2271 return getBooleanParameter(pname); 2304 return getBooleanParameter(pname);
2272 case GL_DITHER: 2305 case GL_DITHER:
2273 return getBooleanParameter(pname); 2306 return getBooleanParameter(pname);
2274 case GL_ELEMENT_ARRAY_BUFFER_BINDING: 2307 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
2275 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundVertexArrayObject->bo undElementArrayBuffer())); 2308 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundVertexArr ayObject->boundElementArrayBuffer()));
2276 case GL_FRAMEBUFFER_BINDING: 2309 case GL_FRAMEBUFFER_BINDING:
2277 return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding)); 2310 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer>(m_framebuff erBinding.get()));
2278 case GL_FRONT_FACE: 2311 case GL_FRONT_FACE:
2279 return getUnsignedIntParameter(pname); 2312 return getUnsignedIntParameter(pname);
2280 case GL_GENERATE_MIPMAP_HINT: 2313 case GL_GENERATE_MIPMAP_HINT:
2281 return getUnsignedIntParameter(pname); 2314 return getUnsignedIntParameter(pname);
2282 case GL_GREEN_BITS: 2315 case GL_GREEN_BITS:
2283 return getIntParameter(pname); 2316 return getIntParameter(pname);
2284 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: 2317 case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
2285 return getIntParameter(pname); 2318 return getIntParameter(pname);
2286 case GL_IMPLEMENTATION_COLOR_READ_TYPE: 2319 case GL_IMPLEMENTATION_COLOR_READ_TYPE:
2287 return getIntParameter(pname); 2320 return getIntParameter(pname);
(...skipping 28 matching lines...) Expand all
2316 return getIntParameter(pname); 2349 return getIntParameter(pname);
2317 case GL_POLYGON_OFFSET_FACTOR: 2350 case GL_POLYGON_OFFSET_FACTOR:
2318 return getFloatParameter(pname); 2351 return getFloatParameter(pname);
2319 case GL_POLYGON_OFFSET_FILL: 2352 case GL_POLYGON_OFFSET_FILL:
2320 return getBooleanParameter(pname); 2353 return getBooleanParameter(pname);
2321 case GL_POLYGON_OFFSET_UNITS: 2354 case GL_POLYGON_OFFSET_UNITS:
2322 return getFloatParameter(pname); 2355 return getFloatParameter(pname);
2323 case GL_RED_BITS: 2356 case GL_RED_BITS:
2324 return getIntParameter(pname); 2357 return getIntParameter(pname);
2325 case GL_RENDERBUFFER_BINDING: 2358 case GL_RENDERBUFFER_BINDING:
2326 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding) ); 2359 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(m_renderbu fferBinding.get()));
2327 case GL_RENDERER: 2360 case GL_RENDERER:
2328 return WebGLGetInfo(String("WebKit WebGL")); 2361 return WebGLGetInfo(String("WebKit WebGL"));
2329 case GL_SAMPLE_BUFFERS: 2362 case GL_SAMPLE_BUFFERS:
2330 return getIntParameter(pname); 2363 return getIntParameter(pname);
2331 case GL_SAMPLE_COVERAGE_INVERT: 2364 case GL_SAMPLE_COVERAGE_INVERT:
2332 return getBooleanParameter(pname); 2365 return getBooleanParameter(pname);
2333 case GL_SAMPLE_COVERAGE_VALUE: 2366 case GL_SAMPLE_COVERAGE_VALUE:
2334 return getFloatParameter(pname); 2367 return getFloatParameter(pname);
2335 case GL_SAMPLES: 2368 case GL_SAMPLES:
2336 return getIntParameter(pname); 2369 return getIntParameter(pname);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 return getIntParameter(pname); 2405 return getIntParameter(pname);
2373 case GL_STENCIL_TEST: 2406 case GL_STENCIL_TEST:
2374 return getBooleanParameter(pname); 2407 return getBooleanParameter(pname);
2375 case GL_STENCIL_VALUE_MASK: 2408 case GL_STENCIL_VALUE_MASK:
2376 return getUnsignedIntParameter(pname); 2409 return getUnsignedIntParameter(pname);
2377 case GL_STENCIL_WRITEMASK: 2410 case GL_STENCIL_WRITEMASK:
2378 return getUnsignedIntParameter(pname); 2411 return getUnsignedIntParameter(pname);
2379 case GL_SUBPIXEL_BITS: 2412 case GL_SUBPIXEL_BITS:
2380 return getIntParameter(pname); 2413 return getIntParameter(pname);
2381 case GL_TEXTURE_BINDING_2D: 2414 case GL_TEXTURE_BINDING_2D:
2382 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText ureUnit].m_texture2DBinding)); 2415 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[ m_activeTextureUnit].m_texture2DBinding.get()));
2383 case GL_TEXTURE_BINDING_CUBE_MAP: 2416 case GL_TEXTURE_BINDING_CUBE_MAP:
2384 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText ureUnit].m_textureCubeMapBinding)); 2417 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[ m_activeTextureUnit].m_textureCubeMapBinding.get()));
2385 case GL_UNPACK_ALIGNMENT: 2418 case GL_UNPACK_ALIGNMENT:
2386 return getIntParameter(pname); 2419 return getIntParameter(pname);
2387 case GC3D_UNPACK_FLIP_Y_WEBGL: 2420 case GC3D_UNPACK_FLIP_Y_WEBGL:
2388 return WebGLGetInfo(m_unpackFlipY); 2421 return WebGLGetInfo(m_unpackFlipY);
2389 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: 2422 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL:
2390 return WebGLGetInfo(m_unpackPremultiplyAlpha); 2423 return WebGLGetInfo(m_unpackPremultiplyAlpha);
2391 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: 2424 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL:
2392 return WebGLGetInfo(m_unpackColorspaceConversion); 2425 return WebGLGetInfo(m_unpackColorspaceConversion);
2393 case GL_VENDOR: 2426 case GL_VENDOR:
2394 return WebGLGetInfo(String("WebKit")); 2427 return WebGLGetInfo(String("WebKit"));
(...skipping 12 matching lines...) Expand all
2407 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); 2440 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled");
2408 return WebGLGetInfo(); 2441 return WebGLGetInfo();
2409 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: 2442 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL:
2410 if (extensionEnabled(WebGLDebugRendererInfoName)) 2443 if (extensionEnabled(WebGLDebugRendererInfoName))
2411 return WebGLGetInfo(webContext()->getString(GL_VENDOR)); 2444 return WebGLGetInfo(webContext()->getString(GL_VENDOR));
2412 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); 2445 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled");
2413 return WebGLGetInfo(); 2446 return WebGLGetInfo();
2414 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object 2447 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object
2415 if (extensionEnabled(OESVertexArrayObjectName)) { 2448 if (extensionEnabled(OESVertexArrayObjectName)) {
2416 if (!m_boundVertexArrayObject->isDefaultObject()) 2449 if (!m_boundVertexArrayObject->isDefaultObject())
2417 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boun dVertexArrayObject)); 2450 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLVertexArrayObjec tOES>(m_boundVertexArrayObject.get()));
2418 return WebGLGetInfo(); 2451 return WebGLGetInfo();
2419 } 2452 }
2420 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); 2453 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled");
2421 return WebGLGetInfo(); 2454 return WebGLGetInfo();
2422 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic 2455 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
2423 if (extensionEnabled(EXTTextureFilterAnisotropicName)) 2456 if (extensionEnabled(EXTTextureFilterAnisotropicName))
2424 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); 2457 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
2425 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); 2458 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled");
2426 return WebGLGetInfo(); 2459 return WebGLGetInfo();
2427 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN 2460 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 2580
2548 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) 2581 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader)
2549 { 2582 {
2550 if (isContextLost()) 2583 if (isContextLost())
2551 return String(); 2584 return String();
2552 if (!validateWebGLObject("getShaderInfoLog", shader)) 2585 if (!validateWebGLObject("getShaderInfoLog", shader))
2553 return ""; 2586 return "";
2554 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); 2587 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader)));
2555 } 2588 }
2556 2589
2557 PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPreci sionFormat(GLenum shaderType, GLenum precisionType) 2590 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType)
2558 { 2591 {
2559 if (isContextLost()) 2592 if (isContextLost())
2560 return nullptr; 2593 return nullptr;
2561 switch (shaderType) { 2594 switch (shaderType) {
2562 case GL_VERTEX_SHADER: 2595 case GL_VERTEX_SHADER:
2563 case GL_FRAGMENT_SHADER: 2596 case GL_FRAGMENT_SHADER:
2564 break; 2597 break;
2565 default: 2598 default:
2566 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); 2599 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type");
2567 return nullptr; 2600 return nullptr;
(...skipping 26 matching lines...) Expand all
2594 return ensureNotNull(shader->source()); 2627 return ensureNotNull(shader->source());
2595 } 2628 }
2596 2629
2597 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() 2630 Vector<String> WebGLRenderingContextBase::getSupportedExtensions()
2598 { 2631 {
2599 Vector<String> result; 2632 Vector<String> result;
2600 if (isContextLost()) 2633 if (isContextLost())
2601 return result; 2634 return result;
2602 2635
2603 for (size_t i = 0; i < m_extensions.size(); ++i) { 2636 for (size_t i = 0; i < m_extensions.size(); ++i) {
2604 ExtensionTracker* tracker = m_extensions[i]; 2637 ExtensionTracker* tracker = m_extensions[i].get();
2605 if (extensionSupportedAndAllowed(tracker)) { 2638 if (extensionSupportedAndAllowed(tracker)) {
2606 const char* const* prefixes = tracker->prefixes(); 2639 const char* const* prefixes = tracker->prefixes();
2607 for (; *prefixes; ++prefixes) { 2640 for (; *prefixes; ++prefixes) {
2608 String prefixedName = String(*prefixes) + tracker->extensionName (); 2641 String prefixedName = String(*prefixes) + tracker->extensionName ();
2609 result.append(prefixedName); 2642 result.append(prefixedName);
2610 } 2643 }
2611 } 2644 }
2612 } 2645 }
2613 2646
2614 return result; 2647 return result;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 notImplemented(); 2816 notImplemented();
2784 } 2817 }
2785 } 2818 }
2786 } 2819 }
2787 } 2820 }
2788 // If we get here, something went wrong in our unfortunately complex logic a bove 2821 // If we get here, something went wrong in our unfortunately complex logic a bove
2789 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); 2822 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error");
2790 return WebGLGetInfo(); 2823 return WebGLGetInfo();
2791 } 2824 }
2792 2825
2793 PassRefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(W ebGLProgram* program, const String& name) 2826 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo rmLocation(WebGLProgram* program, const String& name)
2794 { 2827 {
2795 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) 2828 if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
2796 return nullptr; 2829 return nullptr;
2797 if (!validateLocationLength("getUniformLocation", name)) 2830 if (!validateLocationLength("getUniformLocation", name))
2798 return nullptr; 2831 return nullptr;
2799 if (!validateString("getUniformLocation", name)) 2832 if (!validateString("getUniformLocation", name))
2800 return nullptr; 2833 return nullptr;
2801 if (isPrefixReserved(name)) 2834 if (isPrefixReserved(name))
2802 return nullptr; 2835 return nullptr;
2803 if (!program->linkStatus()) { 2836 if (!program->linkStatus()) {
(...skipping 16 matching lines...) Expand all
2820 } 2853 }
2821 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index); 2854 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index);
2822 2855
2823 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ ARRAY_DIVISOR_ANGLE) 2856 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ ARRAY_DIVISOR_ANGLE)
2824 return WebGLGetInfo(state.divisor); 2857 return WebGLGetInfo(state.divisor);
2825 2858
2826 switch (pname) { 2859 switch (pname) {
2827 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 2860 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
2828 if (!state.bufferBinding || !state.bufferBinding->object()) 2861 if (!state.bufferBinding || !state.bufferBinding->object())
2829 return WebGLGetInfo(); 2862 return WebGLGetInfo();
2830 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(state.bufferBinding)); 2863 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(state.bufferBind ing.get()));
2831 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: 2864 case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
2832 return WebGLGetInfo(state.enabled); 2865 return WebGLGetInfo(state.enabled);
2833 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: 2866 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
2834 return WebGLGetInfo(state.normalized); 2867 return WebGLGetInfo(state.normalized);
2835 case GL_VERTEX_ATTRIB_ARRAY_SIZE: 2868 case GL_VERTEX_ATTRIB_ARRAY_SIZE:
2836 return WebGLGetInfo(state.size); 2869 return WebGLGetInfo(state.size);
2837 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: 2870 case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
2838 return WebGLGetInfo(state.originalStride); 2871 return WebGLGetInfo(state.originalStride);
2839 case GL_VERTEX_ATTRIB_ARRAY_TYPE: 2872 case GL_VERTEX_ATTRIB_ARRAY_TYPE:
2840 return WebGLGetInfo(state.type); 2873 return WebGLGetInfo(state.type);
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4205 m_drawingBuffer->setFramebufferBinding(0); 4238 m_drawingBuffer->setFramebufferBinding(0);
4206 4239
4207 detachAndRemoveAllObjects(); 4240 detachAndRemoveAllObjects();
4208 4241
4209 #ifndef NDEBUG 4242 #ifndef NDEBUG
4210 printWarningToConsole("loseContextImpl(): after detachAndRemoveAllObjects()" ); 4243 printWarningToConsole("loseContextImpl(): after detachAndRemoveAllObjects()" );
4211 #endif 4244 #endif
4212 4245
4213 // Lose all the extensions. 4246 // Lose all the extensions.
4214 for (size_t i = 0; i < m_extensions.size(); ++i) { 4247 for (size_t i = 0; i < m_extensions.size(); ++i) {
4215 ExtensionTracker* tracker = m_extensions[i]; 4248 ExtensionTracker* tracker = m_extensions[i].get();
4216 tracker->loseExtension(); 4249 tracker->loseExtension();
4217 } 4250 }
4218 4251
4219 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) 4252 for (size_t i = 0; i < WebGLExtensionNameCount; ++i)
4220 m_extensionEnabled[i] = false; 4253 m_extensionEnabled[i] = false;
4221 4254
4222 removeAllCompressedTextureFormats(); 4255 removeAllCompressedTextureFormats();
4223 4256
4224 if (mode != RealLostContext) 4257 if (mode != RealLostContext)
4225 destroyContext(); 4258 destroyContext();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4292 4325
4293 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) 4326 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object)
4294 { 4327 {
4295 ASSERT(!isContextLost()); 4328 ASSERT(!isContextLost());
4296 m_contextObjects.add(object); 4329 m_contextObjects.add(object);
4297 } 4330 }
4298 4331
4299 void WebGLRenderingContextBase::detachAndRemoveAllObjects() 4332 void WebGLRenderingContextBase::detachAndRemoveAllObjects()
4300 { 4333 {
4301 while (m_contextObjects.size() > 0) { 4334 while (m_contextObjects.size() > 0) {
4302 HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin(); 4335 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject> >::iterator it = m_contextObjects.begin();
4303 (*it)->detachContext(); 4336 (*it)->detachContext();
4304 } 4337 }
4305 } 4338 }
4306 4339
4307 bool WebGLRenderingContextBase::hasPendingActivity() const 4340 bool WebGLRenderingContextBase::hasPendingActivity() const
4308 { 4341 {
4309 return false; 4342 return false;
4310 } 4343 }
4311 4344
4312 void WebGLRenderingContextBase::stop() 4345 void WebGLRenderingContextBase::stop()
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
5624 InspectorInstrumentation::didFireWebGLWarning(canvas()); 5657 InspectorInstrumentation::didFireWebGLWarning(canvas());
5625 } 5658 }
5626 5659
5627 void WebGLRenderingContextBase::applyStencilTest() 5660 void WebGLRenderingContextBase::applyStencilTest()
5628 { 5661 {
5629 bool haveStencilBuffer = false; 5662 bool haveStencilBuffer = false;
5630 5663
5631 if (m_framebufferBinding) 5664 if (m_framebufferBinding)
5632 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer(); 5665 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer();
5633 else { 5666 else {
5634 RefPtr<WebGLContextAttributes> attributes = getContextAttributes(); 5667 RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = getContextAttrib utes();
5635 haveStencilBuffer = attributes->stencil(); 5668 haveStencilBuffer = attributes->stencil();
5636 } 5669 }
5637 enableOrDisable(GL_STENCIL_TEST, 5670 enableOrDisable(GL_STENCIL_TEST,
5638 m_stencilEnabled && haveStencilBuffer); 5671 m_stencilEnabled && haveStencilBuffer);
5639 } 5672 }
5640 5673
5641 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) 5674 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable)
5642 { 5675 {
5643 if (isContextLost()) 5676 if (isContextLost())
5644 return; 5677 return;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
5718 for (int i = startIndex; i >= 0; --i) { 5751 for (int i = startIndex; i >= 0; --i) {
5719 if (m_textureUnits[i].m_texture2DBinding 5752 if (m_textureUnits[i].m_texture2DBinding
5720 || m_textureUnits[i].m_textureCubeMapBinding) { 5753 || m_textureUnits[i].m_textureCubeMapBinding) {
5721 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5754 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5722 return; 5755 return;
5723 } 5756 }
5724 } 5757 }
5725 m_onePlusMaxNonDefaultTextureUnit = 0; 5758 m_onePlusMaxNonDefaultTextureUnit = 0;
5726 } 5759 }
5727 5760
5761 void WebGLRenderingContextBase::TextureUnitState::trace(Visitor* visitor)
5762 {
5763 visitor->trace(m_texture2DBinding);
5764 visitor->trace(m_textureCubeMapBinding);
5765 }
5766
5767 void WebGLRenderingContextBase::trace(Visitor* visitor)
5768 {
5769 visitor->trace(m_contextObjects);
5770 visitor->trace(m_contextLostCallbackAdapter);
5771 visitor->trace(m_errorMessageCallbackAdapter);
5772 visitor->trace(m_boundArrayBuffer);
5773 visitor->trace(m_defaultVertexArrayObject);
5774 visitor->trace(m_boundVertexArrayObject);
5775 visitor->trace(m_vertexAttrib0Buffer);
5776 visitor->trace(m_currentProgram);
5777 visitor->trace(m_framebufferBinding);
5778 visitor->trace(m_renderbufferBinding);
5779 visitor->trace(m_textureUnits);
5780 visitor->trace(m_blackTexture2D);
5781 visitor->trace(m_blackTextureCubeMap);
5782 visitor->trace(m_requestedAttributes);
5783 visitor->trace(m_extensions);
5784 CanvasRenderingContext::trace(visitor);
5785 }
5786
5728 } // namespace WebCore 5787 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698