 Chromium Code Reviews
 Chromium Code Reviews Issue 2328463004:
  Implement WebGL's commit on the main thread  (Closed)
    
  
    Issue 2328463004:
  Implement WebGL's commit on the main thread  (Closed) 
  | Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp | 
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp | 
| index fa89b61043337bef639bdfac0d77ade1298c2e68..89a4f71bb9226af6b83913b1586026971dc11bdb 100644 | 
| --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp | 
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp | 
| @@ -649,6 +649,22 @@ ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | 
| return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); | 
| } | 
| +void WebGLRenderingContextBase::commit(ExceptionState& exceptionState) | 
| +{ | 
| + if (!getOffscreenCanvas()) { | 
| + exceptionState.throwDOMException(InvalidStateError, "No OffscreenCanvas exists, abort commit()."); | 
| 
Justin Novosad
2016/09/12 13:53:25
Error message would be more readable like this "Co
 
xidachen
2016/09/14 01:33:12
Done.
 | 
| + return; | 
| + } | 
| + // no HTMLCanvas associated, thrown InvalidStateError | 
| + if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { | 
| + exceptionState.throwDOMException(InvalidStateError, "Commit() was called on a context whose OffscreenCanvas is not associated with a canvas element."); | 
| + return; | 
| + } | 
| + if (!drawingBuffer()) | 
| + return; | 
| + getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(drawingBuffer()->transferToStaticBitmapImage()); | 
| 
Justin Novosad
2016/09/12 13:53:25
Race condition right here. The return value of dra
 | 
| +} | 
| + | 
| PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, SnapshotReason reason) const | 
| { | 
| if (!drawingBuffer()) |