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

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

Issue 205903004: WebGL: Return both unprefixed and prefixed supported names from getSupportedExtensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 bool m_multisamplingAllowed; 526 bool m_multisamplingAllowed;
527 bool m_multisamplingObserverRegistered; 527 bool m_multisamplingObserverRegistered;
528 528
529 GLuint m_onePlusMaxEnabledAttribIndex; 529 GLuint m_onePlusMaxEnabledAttribIndex;
530 unsigned long m_onePlusMaxNonDefaultTextureUnit; 530 unsigned long m_onePlusMaxNonDefaultTextureUnit;
531 531
532 OwnPtr<Extensions3DUtil> m_extensionsUtil; 532 OwnPtr<Extensions3DUtil> m_extensionsUtil;
533 533
534 enum ExtensionFlags { 534 enum ExtensionFlags {
535 ApprovedExtension = 0x00, 535 ApprovedExtension = 0x00,
536 DraftExtension = 0x01, 536 DraftExtension = 0x01, // Extension that is behind the draft extensions runtime flag.
537 PrivilegedExtension = 0x02, 537 PrivilegedExtension = 0x02,
538 PrefixedExtension = 0x04, 538 EnabledDraftExtension = 0x04, // Extension that is still in dr aft state, but has been selectively enabled by default.
Ken Russell (switch to Gerrit) 2014/03/25 18:21:11 Please update this comment to say something like
539 WebGLDebugRendererInfoExtension = 0x08, 539 WebGLDebugRendererInfoExtension = 0x08,
540 }; 540 };
541 541
542 class ExtensionTracker { 542 class ExtensionTracker {
543 public: 543 public:
544 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) 544 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes)
545 : m_privileged(flags & PrivilegedExtension) 545 : m_privileged(flags & PrivilegedExtension)
546 , m_draft(flags & DraftExtension) 546 , m_draft(flags & DraftExtension)
547 , m_prefixed(flags & PrefixedExtension)
548 , m_webglDebugRendererInfo(flags & WebGLDebugRendererInfoExtension) 547 , m_webglDebugRendererInfo(flags & WebGLDebugRendererInfoExtension)
549 , m_prefixes(prefixes) 548 , m_prefixes(prefixes)
550 { 549 {
551 } 550 }
552 551
553 virtual ~ExtensionTracker() 552 virtual ~ExtensionTracker()
554 { 553 {
555 } 554 }
556 555
557 bool prefixed() const
558 {
559 return m_prefixed;
560 }
561
562 bool privileged() const 556 bool privileged() const
563 { 557 {
564 return m_privileged; 558 return m_privileged;
565 } 559 }
566 560
567 bool draft() const 561 bool draft() const
568 { 562 {
569 return m_draft; 563 return m_draft;
570 } 564 }
571 565
572 bool webglDebugRendererInfo() const 566 bool webglDebugRendererInfo() const
573 { 567 {
574 return m_webglDebugRendererInfo; 568 return m_webglDebugRendererInfo;
575 } 569 }
576 570
571 const char* const* prefixes() const;
577 bool matchesNameWithPrefixes(const String&) const; 572 bool matchesNameWithPrefixes(const String&) const;
578 573
579 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e*) = 0; 574 virtual PassRefPtr<WebGLExtension> getExtension(WebGLRenderingContextBas e*) = 0;
580 virtual bool supported(WebGLRenderingContextBase*) const = 0; 575 virtual bool supported(WebGLRenderingContextBase*) const = 0;
581 virtual const char* extensionName() const = 0; 576 virtual const char* extensionName() const = 0;
582 virtual void loseExtension() = 0; 577 virtual void loseExtension() = 0;
583 578
584 private: 579 private:
585 bool m_privileged; 580 bool m_privileged;
586 bool m_draft; 581 bool m_draft;
587 bool m_prefixed;
588 bool m_webglDebugRendererInfo; 582 bool m_webglDebugRendererInfo;
589 const char* const* m_prefixes; 583 const char* const* m_prefixes;
590 }; 584 };
591 585
592 template <typename T> 586 template <typename T>
593 class TypedExtensionTracker FINAL : public ExtensionTracker { 587 class TypedExtensionTracker FINAL : public ExtensionTracker {
594 public: 588 public:
595 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c onst char* const* prefixes) 589 TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, c onst char* const* prefixes)
596 : ExtensionTracker(flags, prefixes) 590 : ExtensionTracker(flags, prefixes)
597 , m_extensionField(extensionField) 591 , m_extensionField(extensionField)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 639
646 bool m_extensionEnabled[WebGLExtensionNameCount]; 640 bool m_extensionEnabled[WebGLExtensionNameCount];
647 Vector<ExtensionTracker*> m_extensions; 641 Vector<ExtensionTracker*> m_extensions;
648 642
649 template <typename T> 643 template <typename T>
650 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro vedExtension, const char* const* prefixes = 0) 644 void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = Appro vedExtension, const char* const* prefixes = 0)
651 { 645 {
652 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr efixes)); 646 m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, pr efixes));
653 } 647 }
654 648
649 bool extensionSupportedAndAllowed(const ExtensionTracker*);
650
655 inline bool extensionEnabled(WebGLExtensionName name) 651 inline bool extensionEnabled(WebGLExtensionName name)
656 { 652 {
657 return m_extensionEnabled[name]; 653 return m_extensionEnabled[name];
658 } 654 }
659 655
660 // Errors raised by synthesizeGLError() while the context is lost. 656 // Errors raised by synthesizeGLError() while the context is lost.
661 Vector<GLenum> m_lostContextErrors; 657 Vector<GLenum> m_lostContextErrors;
662 658
663 // Helpers for getParameter and others 659 // Helpers for getParameter and others
664 WebGLGetInfo getBooleanParameter(GLenum); 660 WebGLGetInfo getBooleanParameter(GLenum);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // If the vector is empty, return the maximum allowed active context number. 912 // If the vector is empty, return the maximum allowed active context number.
917 static size_t oldestContextIndex(); 913 static size_t oldestContextIndex();
918 static IntSize oldestContextSize(); 914 static IntSize oldestContextSize();
919 }; 915 };
920 916
921 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 917 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
922 918
923 } // namespace WebCore 919 } // namespace WebCore
924 920
925 #endif // WebGLRenderingContextBase_h 921 #endif // WebGLRenderingContextBase_h
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/core/html/canvas/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698