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

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

Issue 1881563003: Implement OffscreenCanvas.getContext('webgl') (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and remove static_cast Created 4 years, 7 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 virtual unsigned version() const = 0; 146 virtual unsigned version() const = 0;
147 virtual String contextName() const = 0; 147 virtual String contextName() const = 0;
148 virtual void registerContextExtensions() = 0; 148 virtual void registerContextExtensions() = 0;
149 149
150 virtual void initializeNewContext(); 150 virtual void initializeNewContext();
151 151
152 static unsigned getWebGLVersion(const CanvasRenderingContext*); 152 static unsigned getWebGLVersion(const CanvasRenderingContext*);
153 153
154 static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DPr ovider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); 154 static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DPr ovider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion);
155 static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DPr ovider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion);
155 static void forceNextWebGLContextCreationToFail(); 156 static void forceNextWebGLContextCreationToFail();
156 157
157 int drawingBufferWidth() const; 158 int drawingBufferWidth() const;
158 int drawingBufferHeight() const; 159 int drawingBufferHeight() const;
159 160
160 void activeTexture(GLenum texture); 161 void activeTexture(GLenum texture);
161 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*); 162 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*);
162 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); 163 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name);
163 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*); 164 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*);
164 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*) ; 165 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*) ;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 friend class WebGLCompressedTextureATC; 437 friend class WebGLCompressedTextureATC;
437 friend class WebGLCompressedTextureETC1; 438 friend class WebGLCompressedTextureETC1;
438 friend class WebGLCompressedTexturePVRTC; 439 friend class WebGLCompressedTexturePVRTC;
439 friend class WebGLCompressedTextureS3TC; 440 friend class WebGLCompressedTextureS3TC;
440 friend class WebGLRenderingContextErrorMessageCallback; 441 friend class WebGLRenderingContextErrorMessageCallback;
441 friend class WebGLVertexArrayObjectBase; 442 friend class WebGLVertexArrayObjectBase;
442 friend class ScopedTexture2DRestorer; 443 friend class ScopedTexture2DRestorer;
443 friend class ScopedFramebufferRestorer; 444 friend class ScopedFramebufferRestorer;
444 445
445 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3 DProvider>, const WebGLContextAttributes&); 446 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3 DProvider>, const WebGLContextAttributes&);
447 WebGLRenderingContextBase(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DP rovider>, const WebGLContextAttributes&);
446 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3 DProvider>); 448 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3 DProvider>);
447 void setupFlags(); 449 void setupFlags();
448 450
449 // CanvasRenderingContext implementation. 451 // CanvasRenderingContext implementation.
450 bool is3d() const override { return true; } 452 bool is3d() const override { return true; }
451 bool isAccelerated() const override { return true; } 453 bool isAccelerated() const override { return true; }
452 void setIsHidden(bool) override; 454 void setIsHidden(bool) override;
453 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; 455 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override;
454 WebLayer* platformLayer() const override; 456 WebLayer* platformLayer() const override;
455 void stop() override; 457 void stop() override;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 static void addToEvictedList(WebGLRenderingContextBase*); 1069 static void addToEvictedList(WebGLRenderingContextBase*);
1068 static void removeFromEvictedList(WebGLRenderingContextBase*); 1070 static void removeFromEvictedList(WebGLRenderingContextBase*);
1069 static void willDestroyContext(WebGLRenderingContextBase*); 1071 static void willDestroyContext(WebGLRenderingContextBase*);
1070 static void forciblyLoseOldestContext(const String& reason); 1072 static void forciblyLoseOldestContext(const String& reason);
1071 // Return the least recently used context's position in the active context v ector. 1073 // Return the least recently used context's position in the active context v ector.
1072 // If the vector is empty, return the maximum allowed active context number. 1074 // If the vector is empty, return the maximum allowed active context number.
1073 static WebGLRenderingContextBase* oldestContext(); 1075 static WebGLRenderingContextBase* oldestContext();
1074 static WebGLRenderingContextBase* oldestEvictedContext(); 1076 static WebGLRenderingContextBase* oldestEvictedContext();
1075 1077
1076 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); } 1078 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); }
1079
1080 private:
1081 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1077 }; 1082 };
1078 1083
1079 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1084 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1080 1085
1081 } // namespace blink 1086 } // namespace blink
1082 1087
1083 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1088 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1084 1089
1085 #endif // WebGLRenderingContextBase_h 1090 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698