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

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

Issue 1756633002: Defer WebGL lost context restore until visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void viewport(GLint x, GLint y, GLsizei width, GLsizei height); 361 void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
362 362
363 // WEBGL_lose_context support 363 // WEBGL_lose_context support
364 enum AutoRecoveryMethod { 364 enum AutoRecoveryMethod {
365 // Don't restore automatically. 365 // Don't restore automatically.
366 Manual, 366 Manual,
367 367
368 // Restore when resources are available. 368 // Restore when resources are available.
369 WhenAvailable, 369 WhenAvailable,
370 370
371 // Restore as soon as possible. 371 // Restore as soon as possible, but only when
372 // the canvas is visible.
372 Auto 373 Auto
373 }; 374 };
374 void loseContext(LostContextMode) override; 375 void loseContext(LostContextMode) override;
375 void forceLostContext(LostContextMode, AutoRecoveryMethod); 376 void forceLostContext(LostContextMode, AutoRecoveryMethod);
376 void forceRestoreContext(); 377 void forceRestoreContext();
377 void loseContextImpl(LostContextMode, AutoRecoveryMethod); 378 void loseContextImpl(LostContextMode, AutoRecoveryMethod);
378 379
379 WebGraphicsContext3D* webContext() const { return drawingBuffer()->context() ; } 380 WebGraphicsContext3D* webContext() const { return drawingBuffer()->context() ; }
380 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } 381 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
381 Extensions3DUtil* extensionsUtil(); 382 Extensions3DUtil* extensionsUtil();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 487
487 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*); 488 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*);
488 489
489 // Structure for rendering to a DrawingBuffer, instead of directly 490 // Structure for rendering to a DrawingBuffer, instead of directly
490 // to the back-buffer of m_context. 491 // to the back-buffer of m_context.
491 RefPtr<DrawingBuffer> m_drawingBuffer; 492 RefPtr<DrawingBuffer> m_drawingBuffer;
492 DrawingBuffer* drawingBuffer() const; 493 DrawingBuffer* drawingBuffer() const;
493 494
494 RefPtr<WebGLContextGroup> m_contextGroup; 495 RefPtr<WebGLContextGroup> m_contextGroup;
495 496
497 bool m_isHidden;
496 LostContextMode m_contextLostMode; 498 LostContextMode m_contextLostMode;
497 AutoRecoveryMethod m_autoRecoveryMethod; 499 AutoRecoveryMethod m_autoRecoveryMethod;
498 // Dispatches a context lost event once it is determined that one is needed. 500 // Dispatches a context lost event once it is determined that one is needed.
499 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's 501 // This is used for synthetic, WEBGL_lose_context and real context losses. F or real ones, it's
500 // likely that there's no JavaScript on the stack, but that might be depende nt 502 // likely that there's no JavaScript on the stack, but that might be depende nt
501 // on how exactly the platform discovers that the context was lost. For bett er 503 // on how exactly the platform discovers that the context was lost. For bett er
502 // portability we always defer the dispatch of the event. 504 // portability we always defer the dispatch of the event.
503 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; 505 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer;
504 bool m_restoreAllowed; 506 bool m_restoreAllowed;
505 Timer<WebGLRenderingContextBase> m_restoreTimer; 507 Timer<WebGLRenderingContextBase> m_restoreTimer;
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 #endif 1095 #endif
1094 }; 1096 };
1095 1097
1096 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1098 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1097 1099
1098 } // namespace blink 1100 } // namespace blink
1099 1101
1100 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1102 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1101 1103
1102 #endif // WebGLRenderingContextBase_h 1104 #endif // WebGLRenderingContextBase_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698