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

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

Issue 251023004: WebGL: Free temporary GPU resources held by inactive or hidden WebGL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ASSERT instead of 'if' in prepareMailbox() Created 6 years, 5 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 class WebGLVertexArrayObjectOES; 95 class WebGLVertexArrayObjectOES;
96 96
97 class WebGLRenderingContextLostCallback; 97 class WebGLRenderingContextLostCallback;
98 class WebGLRenderingContextErrorMessageCallback; 98 class WebGLRenderingContextErrorMessageCallback;
99 99
100 class WebGLRenderingContextBase: public CanvasRenderingContext, public ActiveDOM Object, public Page::MultisamplingChangedObserver { 100 class WebGLRenderingContextBase: public CanvasRenderingContext, public ActiveDOM Object, public Page::MultisamplingChangedObserver {
101 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); 101 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase);
102 public: 102 public:
103 virtual ~WebGLRenderingContextBase(); 103 virtual ~WebGLRenderingContextBase();
104 104
105 virtual bool is3d() const OVERRIDE { return true; }
106 virtual bool isAccelerated() const OVERRIDE { return true; }
107 virtual unsigned version() const = 0; 105 virtual unsigned version() const = 0;
108 virtual String contextName() const = 0; 106 virtual String contextName() const = 0;
109 virtual void registerContextExtensions() = 0; 107 virtual void registerContextExtensions() = 0;
110 108
111 static unsigned getWebGLVersion(const CanvasRenderingContext*); 109 static unsigned getWebGLVersion(const CanvasRenderingContext*);
112 110
113 int drawingBufferWidth() const; 111 int drawingBufferWidth() const;
114 int drawingBufferHeight() const; 112 int drawingBufferHeight() const;
115 113
116 void activeTexture(GLenum texture); 114 void activeTexture(GLenum texture);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 321
324 // A synthetic lost context that should attempt to recover automatically 322 // A synthetic lost context that should attempt to recover automatically
325 AutoRecoverSyntheticLostContext 323 AutoRecoverSyntheticLostContext
326 }; 324 };
327 void forceLostContext(LostContextMode); 325 void forceLostContext(LostContextMode);
328 void forceRestoreContext(); 326 void forceRestoreContext();
329 void loseContextImpl(LostContextMode); 327 void loseContextImpl(LostContextMode);
330 328
331 blink::WebGraphicsContext3D* webContext() const { return m_drawingBuffer->co ntext(); } 329 blink::WebGraphicsContext3D* webContext() const { return m_drawingBuffer->co ntext(); }
332 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } 330 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
333 virtual blink::WebLayer* platformLayer() const OVERRIDE;
334 Extensions3DUtil* extensionsUtil(); 331 Extensions3DUtil* extensionsUtil();
335 332
336 void reshape(int width, int height); 333 void reshape(int width, int height);
337 334
338 void markLayerComposited(); 335 void markLayerComposited();
339 virtual void paintRenderingResultsToCanvas() OVERRIDE;
340 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData(); 336 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData();
341 337
342 void removeSharedObject(WebGLSharedObject*); 338 void removeSharedObject(WebGLSharedObject*);
343 void removeContextObject(WebGLContextObject*); 339 void removeContextObject(WebGLContextObject*);
344 340
345 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; } 341 unsigned maxVertexAttribs() const { return m_maxVertexAttribs; }
346 342
347 // ActiveDOMObject notifications 343 // ActiveDOMObject notifications
348 virtual bool hasPendingActivity() const OVERRIDE; 344 virtual bool hasPendingActivity() const OVERRIDE;
349 virtual void stop() OVERRIDE; 345 virtual void stop() OVERRIDE;
(...skipping 11 matching lines...) Expand all
361 friend class WebGLCompressedTextureS3TC; 357 friend class WebGLCompressedTextureS3TC;
362 friend class WebGLRenderingContextErrorMessageCallback; 358 friend class WebGLRenderingContextErrorMessageCallback;
363 friend class WebGLVertexArrayObjectOES; 359 friend class WebGLVertexArrayObjectOES;
364 friend class ScopedTexture2DRestorer; 360 friend class ScopedTexture2DRestorer;
365 361
366 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsC ontext3D>, WebGLContextAttributes*); 362 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphicsC ontext3D>, WebGLContextAttributes*);
367 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<blink::WebGraphicsC ontext3D>); 363 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<blink::WebGraphicsC ontext3D>);
368 void initializeNewContext(); 364 void initializeNewContext();
369 void setupFlags(); 365 void setupFlags();
370 366
367 // CanvasRenderingContext implementation.
368 virtual bool is3d() const OVERRIDE { return true; }
369 virtual bool isAccelerated() const OVERRIDE { return true; }
370 virtual void setIsHidden(bool) OVERRIDE;
371 virtual void paintRenderingResultsToCanvas() OVERRIDE;
372 virtual blink::WebLayer* platformLayer() const OVERRIDE;
373
371 void addSharedObject(WebGLSharedObject*); 374 void addSharedObject(WebGLSharedObject*);
372 void addContextObject(WebGLContextObject*); 375 void addContextObject(WebGLContextObject*);
373 void detachAndRemoveAllObjects(); 376 void detachAndRemoveAllObjects();
374 377
375 void destroyContext(); 378 void destroyContext();
376 void markContextChanged(ContentChangeType); 379 void markContextChanged(ContentChangeType);
377 380
378 // Query if the GL implementation is NPOT strict. 381 // Query if the GL implementation is NPOT strict.
379 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; } 382 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; }
380 // Query if depth_stencil buffer is supported. 383 // Query if depth_stencil buffer is supported.
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 // If the vector is empty, return the maximum allowed active context number. 905 // If the vector is empty, return the maximum allowed active context number.
903 static size_t oldestContextIndex(); 906 static size_t oldestContextIndex();
904 static IntSize oldestContextSize(); 907 static IntSize oldestContextSize();
905 }; 908 };
906 909
907 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 910 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
908 911
909 } // namespace WebCore 912 } // namespace WebCore
910 913
911 #endif // WebGLRenderingContextBase_h 914 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698