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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 30 matching lines...) Expand all
41 #include "modules/webgl/WebGLTexture.h" 41 #include "modules/webgl/WebGLTexture.h"
42 #include "modules/webgl/WebGLVertexArrayObjectBase.h" 42 #include "modules/webgl/WebGLVertexArrayObjectBase.h"
43 #include "platform/Timer.h" 43 #include "platform/Timer.h"
44 #include "platform/graphics/ImageBuffer.h" 44 #include "platform/graphics/ImageBuffer.h"
45 #include "platform/graphics/gpu/DrawingBuffer.h" 45 #include "platform/graphics/gpu/DrawingBuffer.h"
46 #include "platform/graphics/gpu/Extensions3DUtil.h" 46 #include "platform/graphics/gpu/Extensions3DUtil.h"
47 #include "platform/graphics/gpu/WebGLImageConversion.h" 47 #include "platform/graphics/gpu/WebGLImageConversion.h"
48 #include "public/platform/Platform.h" 48 #include "public/platform/Platform.h"
49 #include "public/platform/WebGraphicsContext3DProvider.h" 49 #include "public/platform/WebGraphicsContext3DProvider.h"
50 #include "third_party/khronos/GLES2/gl2.h" 50 #include "third_party/khronos/GLES2/gl2.h"
51 #include "wtf/OwnPtr.h"
52 #include "wtf/text/WTFString.h" 51 #include "wtf/text/WTFString.h"
53 52 #include <memory>
54 #include <set> 53 #include <set>
55 54
56 namespace blink { 55 namespace blink {
57 class WebLayer; 56 class WebLayer;
58 } 57 }
59 58
60 namespace gpu { 59 namespace gpu {
61 namespace gles2 { 60 namespace gles2 {
62 class GLES2Interface; 61 class GLES2Interface;
63 } 62 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 ~WebGLRenderingContextBase() override; 132 ~WebGLRenderingContextBase() override;
134 133
135 virtual unsigned version() const = 0; 134 virtual unsigned version() const = 0;
136 virtual String contextName() const = 0; 135 virtual String contextName() const = 0;
137 virtual void registerContextExtensions() = 0; 136 virtual void registerContextExtensions() = 0;
138 137
139 virtual void initializeNewContext(); 138 virtual void initializeNewContext();
140 139
141 static unsigned getWebGLVersion(const CanvasRenderingContext*); 140 static unsigned getWebGLVersion(const CanvasRenderingContext*);
142 141
143 static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DPr ovider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); 142 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex t3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion);
144 static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DPr ovider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); 143 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex t3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion);
145 static void forceNextWebGLContextCreationToFail(); 144 static void forceNextWebGLContextCreationToFail();
146 145
147 int drawingBufferWidth() const; 146 int drawingBufferWidth() const;
148 int drawingBufferHeight() const; 147 int drawingBufferHeight() const;
149 148
150 void activeTexture(GLenum texture); 149 void activeTexture(GLenum texture);
151 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*); 150 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*);
152 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); 151 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name);
153 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*); 152 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*);
154 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*) ; 153 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*) ;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 friend class WebGLCompressedTextureASTC; 423 friend class WebGLCompressedTextureASTC;
425 friend class WebGLCompressedTextureATC; 424 friend class WebGLCompressedTextureATC;
426 friend class WebGLCompressedTextureETC1; 425 friend class WebGLCompressedTextureETC1;
427 friend class WebGLCompressedTexturePVRTC; 426 friend class WebGLCompressedTexturePVRTC;
428 friend class WebGLCompressedTextureS3TC; 427 friend class WebGLCompressedTextureS3TC;
429 friend class WebGLRenderingContextErrorMessageCallback; 428 friend class WebGLRenderingContextErrorMessageCallback;
430 friend class WebGLVertexArrayObjectBase; 429 friend class WebGLVertexArrayObjectBase;
431 friend class ScopedTexture2DRestorer; 430 friend class ScopedTexture2DRestorer;
432 friend class ScopedFramebufferRestorer; 431 friend class ScopedFramebufferRestorer;
433 432
434 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3 DProvider>, const WebGLContextAttributes&); 433 WebGLRenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsCon text3DProvider>, const WebGLContextAttributes&);
435 WebGLRenderingContextBase(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DP rovider>, const WebGLContextAttributes&); 434 WebGLRenderingContextBase(OffscreenCanvas*, std::unique_ptr<WebGraphicsConte xt3DProvider>, const WebGLContextAttributes&);
436 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3 DProvider>); 435 PassRefPtr<DrawingBuffer> createDrawingBuffer(std::unique_ptr<WebGraphicsCon text3DProvider>);
437 void setupFlags(); 436 void setupFlags();
438 437
439 // CanvasRenderingContext implementation. 438 // CanvasRenderingContext implementation.
440 bool is3d() const override { return true; } 439 bool is3d() const override { return true; }
441 bool isAccelerated() const override { return true; } 440 bool isAccelerated() const override { return true; }
442 void setIsHidden(bool) override; 441 void setIsHidden(bool) override;
443 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; 442 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override;
444 WebLayer* platformLayer() const override; 443 WebLayer* platformLayer() const override;
445 void stop() override; 444 void stop() override;
446 445
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 Vector<GLenum> m_compressedTextureFormats; 529 Vector<GLenum> m_compressedTextureFormats;
531 530
532 // Fixed-size cache of reusable image buffers for video texImage2D calls. 531 // Fixed-size cache of reusable image buffers for video texImage2D calls.
533 class LRUImageBufferCache { 532 class LRUImageBufferCache {
534 public: 533 public:
535 LRUImageBufferCache(int capacity); 534 LRUImageBufferCache(int capacity);
536 // The pointer returned is owned by the image buffer map. 535 // The pointer returned is owned by the image buffer map.
537 ImageBuffer* imageBuffer(const IntSize&); 536 ImageBuffer* imageBuffer(const IntSize&);
538 private: 537 private:
539 void bubbleToFront(int idx); 538 void bubbleToFront(int idx);
540 OwnPtr<OwnPtr<ImageBuffer>[]> m_buffers; 539 std::unique_ptr<std::unique_ptr<ImageBuffer>[]> m_buffers;
541 int m_capacity; 540 int m_capacity;
542 }; 541 };
543 LRUImageBufferCache m_generatedImageCache; 542 LRUImageBufferCache m_generatedImageCache;
544 543
545 GLint m_maxTextureSize; 544 GLint m_maxTextureSize;
546 GLint m_maxCubeMapTextureSize; 545 GLint m_maxCubeMapTextureSize;
547 GLint m_max3DTextureSize; 546 GLint m_max3DTextureSize;
548 GLint m_maxArrayTextureLayers; 547 GLint m_maxArrayTextureLayers;
549 GLint m_maxRenderbufferSize; 548 GLint m_maxRenderbufferSize;
550 GLint m_maxViewportDims[2]; 549 GLint m_maxViewportDims[2];
(...skipping 28 matching lines...) Expand all
579 GLint m_stencilFuncRef, m_stencilFuncRefBack; // Note that these are the use r specified values, not the internal clamped value. 578 GLint m_stencilFuncRef, m_stencilFuncRefBack; // Note that these are the use r specified values, not the internal clamped value.
580 GLuint m_stencilFuncMask, m_stencilFuncMaskBack; 579 GLuint m_stencilFuncMask, m_stencilFuncMaskBack;
581 580
582 bool m_isDepthStencilSupported; 581 bool m_isDepthStencilSupported;
583 582
584 bool m_synthesizedErrorsToConsole; 583 bool m_synthesizedErrorsToConsole;
585 int m_numGLErrorsToConsoleAllowed; 584 int m_numGLErrorsToConsoleAllowed;
586 585
587 unsigned long m_onePlusMaxNonDefaultTextureUnit; 586 unsigned long m_onePlusMaxNonDefaultTextureUnit;
588 587
589 OwnPtr<Extensions3DUtil> m_extensionsUtil; 588 std::unique_ptr<Extensions3DUtil> m_extensionsUtil;
590 589
591 enum ExtensionFlags { 590 enum ExtensionFlags {
592 ApprovedExtension = 0x00, 591 ApprovedExtension = 0x00,
593 // Extension that is behind the draft extensions runtime flag: 592 // Extension that is behind the draft extensions runtime flag:
594 DraftExtension = 0x01, 593 DraftExtension = 0x01,
595 }; 594 };
596 595
597 class ExtensionTracker : public GarbageCollected<ExtensionTracker> { 596 class ExtensionTracker : public GarbageCollected<ExtensionTracker> {
598 public: 597 public:
599 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes) 598 ExtensionTracker(ExtensionFlags flags, const char* const* prefixes)
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 // Helper functions for tex(Sub)Image2D && texSubImage3D 1096 // Helper functions for tex(Sub)Image2D && texSubImage3D
1098 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi nt, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMAr rayBufferView*); 1097 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi nt, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMAr rayBufferView*);
1099 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); 1098 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
1100 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); 1099 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
1101 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); 1100 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
1102 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); 1101 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
1103 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); 1102 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
1104 static const char* getTexImageFunctionName(TexImageFunctionID); 1103 static const char* getTexImageFunctionName(TexImageFunctionID);
1105 1104
1106 private: 1105 private:
1107 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&); 1106 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1108 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1107 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1109 }; 1108 };
1110 1109
1111 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1110 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1112 1111
1113 } // namespace blink 1112 } // namespace blink
1114 1113
1115 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1114 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1116 1115
1117 #endif // WebGLRenderingContextBase_h 1116 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698