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

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

Issue 163773007: WebGL: Transfer ownership of WebGraphicsContext3D from WebGLRenderingContext to DrawingBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@correct_webgl_destroy
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLRenderingContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 String getShaderSource(WebGLShader*); 192 String getShaderSource(WebGLShader*);
193 Vector<String> getSupportedExtensions(); 193 Vector<String> getSupportedExtensions();
194 WebGLGetInfo getTexParameter(GLenum target, GLenum pname); 194 WebGLGetInfo getTexParameter(GLenum target, GLenum pname);
195 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*); 195 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*);
196 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str ing&); 196 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str ing&);
197 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname); 197 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname);
198 long long getVertexAttribOffset(GLuint index, GLenum pname); 198 long long getVertexAttribOffset(GLuint index, GLenum pname);
199 199
200 void hint(GLenum target, GLenum mode); 200 void hint(GLenum target, GLenum mode);
201 GLboolean isBuffer(WebGLBuffer*); 201 GLboolean isBuffer(WebGLBuffer*);
202 bool isContextLost(); 202 bool isContextLost() const;
203 GLboolean isEnabled(GLenum cap); 203 GLboolean isEnabled(GLenum cap);
204 GLboolean isFramebuffer(WebGLFramebuffer*); 204 GLboolean isFramebuffer(WebGLFramebuffer*);
205 GLboolean isProgram(WebGLProgram*); 205 GLboolean isProgram(WebGLProgram*);
206 GLboolean isRenderbuffer(WebGLRenderbuffer*); 206 GLboolean isRenderbuffer(WebGLRenderbuffer*);
207 GLboolean isShader(WebGLShader*); 207 GLboolean isShader(WebGLShader*);
208 GLboolean isTexture(WebGLTexture*); 208 GLboolean isTexture(WebGLTexture*);
209 209
210 void lineWidth(GLfloat); 210 void lineWidth(GLfloat);
211 void linkProgram(WebGLProgram*); 211 void linkProgram(WebGLProgram*);
212 void pixelStorei(GLenum pname, GLint param); 212 void pixelStorei(GLenum pname, GLint param);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Lost context provoked by WEBKIT_lose_context. 311 // Lost context provoked by WEBKIT_lose_context.
312 SyntheticLostContext, 312 SyntheticLostContext,
313 313
314 // A synthetic lost context that should attempt to recover automatically 314 // A synthetic lost context that should attempt to recover automatically
315 AutoRecoverSyntheticLostContext 315 AutoRecoverSyntheticLostContext
316 }; 316 };
317 void forceLostContext(LostContextMode); 317 void forceLostContext(LostContextMode);
318 void forceRestoreContext(); 318 void forceRestoreContext();
319 void loseContextImpl(LostContextMode); 319 void loseContextImpl(LostContextMode);
320 320
321 blink::WebGraphicsContext3D* webGraphicsContext3D() const { return m_context .get(); } 321 blink::WebGraphicsContext3D* webGraphicsContext3D() const { return m_context ; }
322 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } 322 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
323 virtual blink::WebLayer* platformLayer() const OVERRIDE; 323 virtual blink::WebLayer* platformLayer() const OVERRIDE;
324 Extensions3DUtil* extensionsUtil(); 324 Extensions3DUtil* extensionsUtil();
325 325
326 void reshape(int width, int height); 326 void reshape(int width, int height);
327 327
328 void markLayerComposited(); 328 void markLayerComposited();
329 virtual void paintRenderingResultsToCanvas() OVERRIDE; 329 virtual void paintRenderingResultsToCanvas() OVERRIDE;
330 PassRefPtr<ImageData> paintRenderingResultsToImageData(); 330 PassRefPtr<ImageData> paintRenderingResultsToImageData();
331 331
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Adds a compressed texture format. 378 // Adds a compressed texture format.
379 void addCompressedTextureFormat(GLenum); 379 void addCompressedTextureFormat(GLenum);
380 void removeAllCompressedTextureFormats(); 380 void removeAllCompressedTextureFormats();
381 381
382 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height); 382 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height);
383 383
384 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy); 384 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy);
385 385
386 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf fer*); 386 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf fer*);
387 387
388 OwnPtr<blink::WebGraphicsContext3D> m_context;
389 RefPtr<WebGLContextGroup> m_contextGroup;
390
391 // Structure for rendering to a DrawingBuffer, instead of directly 388 // Structure for rendering to a DrawingBuffer, instead of directly
392 // to the back-buffer of m_context. 389 // to the back-buffer of m_context.
393 RefPtr<DrawingBuffer> m_drawingBuffer; 390 RefPtr<DrawingBuffer> m_drawingBuffer;
391 // m_drawingBuffer owns m_context.
392 blink::WebGraphicsContext3D* m_context;
Justin Novosad 2014/02/24 15:25:56 Having m_context is fragile because future code ch
393 RefPtr<WebGLContextGroup> m_contextGroup;
394 394
395 // Dispatches a context lost event once it is determined that one is needed. 395 // Dispatches a context lost event once it is determined that one is needed.
396 // This is used both for synthetic and real context losses. For real ones, i t's 396 // This is used both for synthetic and real context losses. For real ones, i t's
397 // likely that there's no JavaScript on the stack, but that might be depende nt 397 // likely that there's no JavaScript on the stack, but that might be depende nt
398 // on how exactly the platform discovers that the context was lost. For bett er 398 // on how exactly the platform discovers that the context was lost. For bett er
399 // portability we always defer the dispatch of the event. 399 // portability we always defer the dispatch of the event.
400 Timer<WebGLRenderingContext> m_dispatchContextLostEventTimer; 400 Timer<WebGLRenderingContext> m_dispatchContextLostEventTimer;
401 bool m_restoreAllowed; 401 bool m_restoreAllowed;
402 Timer<WebGLRenderingContext> m_restoreTimer; 402 Timer<WebGLRenderingContext> m_restoreTimer;
403 403
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 // If the vector is empty, return the maximum allowed active context number. 917 // If the vector is empty, return the maximum allowed active context number.
918 static size_t oldestContextIndex(); 918 static size_t oldestContextIndex();
919 static IntSize oldestContextSize(); 919 static IntSize oldestContextSize();
920 }; 920 };
921 921
922 DEFINE_TYPE_CASTS(WebGLRenderingContext, CanvasRenderingContext, context, contex t->is3d(), context.is3d()); 922 DEFINE_TYPE_CASTS(WebGLRenderingContext, CanvasRenderingContext, context, contex t->is3d(), context.is3d());
923 923
924 } // namespace WebCore 924 } // namespace WebCore
925 925
926 #endif 926 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698