| OLD | NEW |
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 void markLayerComposited(); | 350 void markLayerComposited(); |
| 351 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData(); | 351 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData(); |
| 352 | 352 |
| 353 void removeSharedObject(WebGLSharedObject*); | 353 void removeSharedObject(WebGLSharedObject*); |
| 354 void removeContextObject(WebGLContextObject*); | 354 void removeContextObject(WebGLContextObject*); |
| 355 | 355 |
| 356 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } | 356 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } |
| 357 | 357 |
| 358 // ActiveDOMObject notifications | 358 // ActiveDOMObject notifications |
| 359 virtual bool hasPendingActivity() const OVERRIDE; | 359 virtual bool hasPendingActivity() const override; |
| 360 virtual void stop() OVERRIDE; | 360 virtual void stop() override; |
| 361 | 361 |
| 362 void setSavingImage(bool isSaving) { m_savingImage = isSaving; } | 362 void setSavingImage(bool isSaving) { m_savingImage = isSaving; } |
| 363 | 363 |
| 364 virtual void trace(Visitor*) OVERRIDE; | 364 virtual void trace(Visitor*) override; |
| 365 | 365 |
| 366 class TextureUnitState { | 366 class TextureUnitState { |
| 367 ALLOW_ONLY_INLINE_ALLOCATION(); | 367 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 368 public: | 368 public: |
| 369 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding; | 369 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding; |
| 370 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding; | 370 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding; |
| 371 | 371 |
| 372 void trace(Visitor*); | 372 void trace(Visitor*); |
| 373 }; | 373 }; |
| 374 | 374 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 390 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsC
ontext3D>, WebGLContextAttributes*); | 390 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsC
ontext3D>, WebGLContextAttributes*); |
| 391 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<blink::WebGraphicsC
ontext3D>); | 391 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<blink::WebGraphicsC
ontext3D>); |
| 392 void initializeNewContext(); | 392 void initializeNewContext(); |
| 393 void setupFlags(); | 393 void setupFlags(); |
| 394 | 394 |
| 395 #if ENABLE(OILPAN) | 395 #if ENABLE(OILPAN) |
| 396 PassRefPtr<WebGLSharedWebGraphicsContext3D> sharedWebGraphicsContext3D() con
st; | 396 PassRefPtr<WebGLSharedWebGraphicsContext3D> sharedWebGraphicsContext3D() con
st; |
| 397 #endif | 397 #endif |
| 398 | 398 |
| 399 // CanvasRenderingContext implementation. | 399 // CanvasRenderingContext implementation. |
| 400 virtual bool is3d() const OVERRIDE { return true; } | 400 virtual bool is3d() const override { return true; } |
| 401 virtual bool isAccelerated() const OVERRIDE { return true; } | 401 virtual bool isAccelerated() const override { return true; } |
| 402 virtual void setIsHidden(bool) OVERRIDE; | 402 virtual void setIsHidden(bool) override; |
| 403 virtual void paintRenderingResultsToCanvas() OVERRIDE; | 403 virtual void paintRenderingResultsToCanvas() override; |
| 404 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 404 virtual blink::WebLayer* platformLayer() const override; |
| 405 | 405 |
| 406 void addSharedObject(WebGLSharedObject*); | 406 void addSharedObject(WebGLSharedObject*); |
| 407 void addContextObject(WebGLContextObject*); | 407 void addContextObject(WebGLContextObject*); |
| 408 void detachAndRemoveAllObjects(); | 408 void detachAndRemoveAllObjects(); |
| 409 | 409 |
| 410 void destroyContext(); | 410 void destroyContext(); |
| 411 void markContextChanged(ContentChangeType); | 411 void markContextChanged(ContentChangeType); |
| 412 | 412 |
| 413 // Query if the GL implementation is NPOT strict. | 413 // Query if the GL implementation is NPOT strict. |
| 414 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; } | 414 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 virtual void loseExtension() = 0; | 608 virtual void loseExtension() = 0; |
| 609 | 609 |
| 610 virtual void trace(Visitor*) { } | 610 virtual void trace(Visitor*) { } |
| 611 | 611 |
| 612 private: | 612 private: |
| 613 bool m_draft; | 613 bool m_draft; |
| 614 const char* const* m_prefixes; | 614 const char* const* m_prefixes; |
| 615 }; | 615 }; |
| 616 | 616 |
| 617 template <typename T> | 617 template <typename T> |
| 618 class TypedExtensionTracker FINAL : public ExtensionTracker { | 618 class TypedExtensionTracker final : public ExtensionTracker { |
| 619 public: | 619 public: |
| 620 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T> > create(RefPtrWi
llBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes
) | 620 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T> > create(RefPtrWi
llBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes
) |
| 621 { | 621 { |
| 622 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel
d, flags, prefixes)); | 622 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel
d, flags, prefixes)); |
| 623 } | 623 } |
| 624 | 624 |
| 625 #if !ENABLE(OILPAN) | 625 #if !ENABLE(OILPAN) |
| 626 virtual ~TypedExtensionTracker() | 626 virtual ~TypedExtensionTracker() |
| 627 { | 627 { |
| 628 if (m_extension) { | 628 if (m_extension) { |
| 629 m_extension->lose(true); | 629 m_extension->lose(true); |
| 630 m_extension = nullptr; | 630 m_extension = nullptr; |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 #endif | 633 #endif |
| 634 | 634 |
| 635 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi
ngContextBase* context) OVERRIDE | 635 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi
ngContextBase* context) override |
| 636 { | 636 { |
| 637 if (!m_extension) { | 637 if (!m_extension) { |
| 638 m_extension = T::create(context); | 638 m_extension = T::create(context); |
| 639 m_extensionField = m_extension; | 639 m_extensionField = m_extension; |
| 640 } | 640 } |
| 641 | 641 |
| 642 return m_extension; | 642 return m_extension; |
| 643 } | 643 } |
| 644 | 644 |
| 645 virtual bool supported(WebGLRenderingContextBase* context) const OVERRID
E | 645 virtual bool supported(WebGLRenderingContextBase* context) const overrid
e |
| 646 { | 646 { |
| 647 return T::supported(context); | 647 return T::supported(context); |
| 648 } | 648 } |
| 649 | 649 |
| 650 virtual const char* extensionName() const OVERRIDE | 650 virtual const char* extensionName() const override |
| 651 { | 651 { |
| 652 return T::extensionName(); | 652 return T::extensionName(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 virtual void loseExtension() OVERRIDE | 655 virtual void loseExtension() override |
| 656 { | 656 { |
| 657 if (m_extension) { | 657 if (m_extension) { |
| 658 m_extension->lose(false); | 658 m_extension->lose(false); |
| 659 if (m_extension->isLost()) | 659 if (m_extension->isLost()) |
| 660 m_extension = nullptr; | 660 m_extension = nullptr; |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 | 663 |
| 664 virtual void trace(Visitor* visitor) OVERRIDE | 664 virtual void trace(Visitor* visitor) override |
| 665 { | 665 { |
| 666 visitor->trace(m_extension); | 666 visitor->trace(m_extension); |
| 667 ExtensionTracker::trace(visitor); | 667 ExtensionTracker::trace(visitor); |
| 668 } | 668 } |
| 669 | 669 |
| 670 private: | 670 private: |
| 671 TypedExtensionTracker(RefPtrWillBeMember<T>& extensionField, ExtensionFl
ags flags, const char* const* prefixes) | 671 TypedExtensionTracker(RefPtrWillBeMember<T>& extensionField, ExtensionFl
ags flags, const char* const* prefixes) |
| 672 : ExtensionTracker(flags, prefixes) | 672 : ExtensionTracker(flags, prefixes) |
| 673 , m_extensionField(extensionField) | 673 , m_extensionField(extensionField) |
| 674 { | 674 { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 // First time called, if EXT_draw_buffers is supported, query the value; oth
erwise return 0. | 928 // First time called, if EXT_draw_buffers is supported, query the value; oth
erwise return 0. |
| 929 // Later, return the cached value. | 929 // Later, return the cached value. |
| 930 GLint maxDrawBuffers(); | 930 GLint maxDrawBuffers(); |
| 931 GLint maxColorAttachments(); | 931 GLint maxColorAttachments(); |
| 932 | 932 |
| 933 void setBackDrawBuffer(GLenum); | 933 void setBackDrawBuffer(GLenum); |
| 934 | 934 |
| 935 void restoreCurrentFramebuffer(); | 935 void restoreCurrentFramebuffer(); |
| 936 void restoreCurrentTexture2D(); | 936 void restoreCurrentTexture2D(); |
| 937 | 937 |
| 938 virtual void multisamplingChanged(bool) OVERRIDE; | 938 virtual void multisamplingChanged(bool) override; |
| 939 | 939 |
| 940 void findNewMaxNonDefaultTextureUnit(); | 940 void findNewMaxNonDefaultTextureUnit(); |
| 941 | 941 |
| 942 friend class WebGLStateRestorer; | 942 friend class WebGLStateRestorer; |
| 943 friend class WebGLRenderingContextEvictionManager; | 943 friend class WebGLRenderingContextEvictionManager; |
| 944 | 944 |
| 945 static Vector<WebGLRenderingContextBase*>& activeContexts(); | 945 static Vector<WebGLRenderingContextBase*>& activeContexts(); |
| 946 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); | 946 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); |
| 947 | 947 |
| 948 static void activateContext(WebGLRenderingContextBase*); | 948 static void activateContext(WebGLRenderingContextBase*); |
| 949 static void deactivateContext(WebGLRenderingContextBase*); | 949 static void deactivateContext(WebGLRenderingContextBase*); |
| 950 static void addToEvictedList(WebGLRenderingContextBase*); | 950 static void addToEvictedList(WebGLRenderingContextBase*); |
| 951 static void removeFromEvictedList(WebGLRenderingContextBase*); | 951 static void removeFromEvictedList(WebGLRenderingContextBase*); |
| 952 static void willDestroyContext(WebGLRenderingContextBase*); | 952 static void willDestroyContext(WebGLRenderingContextBase*); |
| 953 static void forciblyLoseOldestContext(const String& reason); | 953 static void forciblyLoseOldestContext(const String& reason); |
| 954 // Return the least recently used context's position in the active context v
ector. | 954 // Return the least recently used context's position in the active context v
ector. |
| 955 // If the vector is empty, return the maximum allowed active context number. | 955 // If the vector is empty, return the maximum allowed active context number. |
| 956 static size_t oldestContextIndex(); | 956 static size_t oldestContextIndex(); |
| 957 static IntSize oldestContextSize(); | 957 static IntSize oldestContextSize(); |
| 958 }; | 958 }; |
| 959 | 959 |
| 960 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 960 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 961 | 961 |
| 962 } // namespace blink | 962 } // namespace blink |
| 963 | 963 |
| 964 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 964 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 965 | 965 |
| 966 #endif // WebGLRenderingContextBase_h | 966 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |