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

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

Issue 1151163002: Oilpan: eagerly finalize WebGLRenderingContext objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add explanatory comment Created 5 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 class WebGLDrawBuffers; 90 class WebGLDrawBuffers;
91 class WebGLExtension; 91 class WebGLExtension;
92 class WebGLFramebuffer; 92 class WebGLFramebuffer;
93 class WebGLLoseContext; 93 class WebGLLoseContext;
94 class WebGLObject; 94 class WebGLObject;
95 class WebGLProgram; 95 class WebGLProgram;
96 class WebGLRenderbuffer; 96 class WebGLRenderbuffer;
97 class WebGLShader; 97 class WebGLShader;
98 class WebGLShaderPrecisionFormat; 98 class WebGLShaderPrecisionFormat;
99 class WebGLSharedObject; 99 class WebGLSharedObject;
100 class WebGLSharedWebGraphicsContext3D;
101 class WebGLUniformLocation; 100 class WebGLUniformLocation;
102 class WebGLVertexArrayObjectBase; 101 class WebGLVertexArrayObjectBase;
103 102
104 class WebGLRenderingContextLostCallback; 103 class WebGLRenderingContextLostCallback;
105 class WebGLRenderingContextErrorMessageCallback; 104 class WebGLRenderingContextErrorMessageCallback;
106 105
107 class CORE_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, pub lic Page::MultisamplingChangedObserver, public ScriptWrappable { 106 class CORE_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, pub lic Page::MultisamplingChangedObserver, public ScriptWrappable {
108 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); 107 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase);
109 public: 108 public:
110 virtual ~WebGLRenderingContextBase(); 109 virtual ~WebGLRenderingContextBase();
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 366
368 // GL_CHROMIUM_subscribe_uniform 367 // GL_CHROMIUM_subscribe_uniform
369 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> createValuebufferCHROMIUM(); 368 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> createValuebufferCHROMIUM();
370 void deleteValuebufferCHROMIUM(CHROMIUMValuebuffer*); 369 void deleteValuebufferCHROMIUM(CHROMIUMValuebuffer*);
371 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*); 370 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*);
372 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*); 371 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*);
373 void subscribeValueCHROMIUM(GLenum target, GLenum subscription); 372 void subscribeValueCHROMIUM(GLenum target, GLenum subscription);
374 void populateSubscribedValuesCHROMIUM(GLenum target); 373 void populateSubscribedValuesCHROMIUM(GLenum target);
375 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target, GLenum subscription); 374 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target, GLenum subscription);
376 375
376 // Eagerly finalize WebGLRenderingContextBase in order for it
377 // to (first) be able to detach its WebGLContextObjects, before
378 // they're later swept and finalized.
379 EAGERLY_FINALIZE();
377 DECLARE_VIRTUAL_TRACE(); 380 DECLARE_VIRTUAL_TRACE();
378 381
379 // Returns approximate gpu memory allocated per pixel. 382 // Returns approximate gpu memory allocated per pixel.
380 int externallyAllocatedBytesPerPixel(); 383 int externallyAllocatedBytesPerPixel();
381 384
382 class TextureUnitState { 385 class TextureUnitState {
383 ALLOW_ONLY_INLINE_ALLOCATION(); 386 ALLOW_ONLY_INLINE_ALLOCATION();
384 public: 387 public:
385 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding; 388 RefPtrWillBeMember<WebGLTexture> m_texture2DBinding;
386 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding; 389 RefPtrWillBeMember<WebGLTexture> m_textureCubeMapBinding;
(...skipping 19 matching lines...) Expand all
406 friend class WebGLCompressedTextureS3TC; 409 friend class WebGLCompressedTextureS3TC;
407 friend class WebGLRenderingContextErrorMessageCallback; 410 friend class WebGLRenderingContextErrorMessageCallback;
408 friend class WebGLVertexArrayObjectBase; 411 friend class WebGLVertexArrayObjectBase;
409 friend class ScopedTexture2DRestorer; 412 friend class ScopedTexture2DRestorer;
410 friend class ScopedFramebufferRestorer; 413 friend class ScopedFramebufferRestorer;
411 414
412 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3 D>, const WebGLContextAttributes&); 415 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3 D>, const WebGLContextAttributes&);
413 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3 D>); 416 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3 D>);
414 void setupFlags(); 417 void setupFlags();
415 418
416 #if ENABLE(OILPAN)
417 PassRefPtr<WebGLSharedWebGraphicsContext3D> sharedWebGraphicsContext3D() con st;
418 #endif
419
420 // CanvasRenderingContext implementation. 419 // CanvasRenderingContext implementation.
421 virtual bool is3d() const override { return true; } 420 virtual bool is3d() const override { return true; }
422 virtual bool isAccelerated() const override { return true; } 421 virtual bool isAccelerated() const override { return true; }
423 virtual void setIsHidden(bool) override; 422 virtual void setIsHidden(bool) override;
424 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; 423 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override;
425 virtual WebLayer* platformLayer() const override; 424 virtual WebLayer* platformLayer() const override;
426 void stop() override; 425 void stop() override;
427 426
428 void addSharedObject(WebGLSharedObject*); 427 void addSharedObject(WebGLSharedObject*);
429 void addContextObject(WebGLContextObject*); 428 void addContextObject(WebGLContextObject*);
(...skipping 21 matching lines...) Expand all
451 void removeAllCompressedTextureFormats(); 450 void removeAllCompressedTextureFormats();
452 451
453 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height, const c har* functionName); 452 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height, const c har* functionName);
454 453
455 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy); 454 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy);
456 455
457 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf fer*); 456 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf fer*);
458 457
459 // Structure for rendering to a DrawingBuffer, instead of directly 458 // Structure for rendering to a DrawingBuffer, instead of directly
460 // to the back-buffer of m_context. 459 // to the back-buffer of m_context.
461 #if ENABLE(OILPAN)
462 RefPtr<WebGLSharedWebGraphicsContext3D> m_sharedWebGraphicsContext3D;
463 #else
464 RefPtr<DrawingBuffer> m_drawingBuffer; 460 RefPtr<DrawingBuffer> m_drawingBuffer;
465 #endif
466 DrawingBuffer* drawingBuffer() const; 461 DrawingBuffer* drawingBuffer() const;
467 462
468 RefPtr<WebGLContextGroup> m_contextGroup; 463 RefPtr<WebGLContextGroup> m_contextGroup;
469 464
470 LostContextMode m_contextLostMode; 465 LostContextMode m_contextLostMode;
471 AutoRecoveryMethod m_autoRecoveryMethod; 466 AutoRecoveryMethod m_autoRecoveryMethod;
472 // Dispatches a context lost event once it is determined that one is needed. 467 // Dispatches a context lost event once it is determined that one is needed.
473 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's 468 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's
474 // likely that there's no JavaScript on the stack, but that might be depende nt 469 // likely that there's no JavaScript on the stack, but that might be depende nt
475 // on how exactly the platform discovers that the context was lost. For bett er 470 // on how exactly the platform discovers that the context was lost. For bett er
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 static IntSize oldestContextSize(); 1014 static IntSize oldestContextSize();
1020 }; 1015 };
1021 1016
1022 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1017 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1023 1018
1024 } // namespace blink 1019 } // namespace blink
1025 1020
1026 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1021 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1027 1022
1028 #endif // WebGLRenderingContextBase_h 1023 #endif // WebGLRenderingContextBase_h
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | Source/core/html/canvas/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698