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

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

Issue 2142223002: webgl: Handle null context provider when trying to restore context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 6134 matching lines...) Expand 10 before | Expand all | Expand 10 after
6145 if (drawingBuffer()) { 6145 if (drawingBuffer()) {
6146 m_drawingBuffer->beginDestruction(); 6146 m_drawingBuffer->beginDestruction();
6147 m_drawingBuffer.clear(); 6147 m_drawingBuffer.clear();
6148 } 6148 }
6149 6149
6150 Platform::ContextAttributes attributes = toPlatformContextAttributes(m_reque stedAttributes, version()); 6150 Platform::ContextAttributes attributes = toPlatformContextAttributes(m_reque stedAttributes, version());
6151 Platform::GraphicsInfo glInfo; 6151 Platform::GraphicsInfo glInfo;
6152 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P latform::current()->createOffscreenGraphicsContext3DProvider( 6152 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P latform::current()->createOffscreenGraphicsContext3DProvider(
6153 attributes, canvas()->document().topDocument().url(), 0, &glInfo)); 6153 attributes, canvas()->document().topDocument().url(), 0, &glInfo));
6154 RefPtr<DrawingBuffer> buffer; 6154 RefPtr<DrawingBuffer> buffer;
6155 if (contextProvider->bindToCurrentThread()) { 6155 if (contextProvider && contextProvider->bindToCurrentThread()) {
6156 // Construct a new drawing buffer with the new GL context. 6156 // Construct a new drawing buffer with the new GL context.
6157 buffer = createDrawingBuffer(std::move(contextProvider)); 6157 buffer = createDrawingBuffer(std::move(contextProvider));
6158 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i s set to null. 6158 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i s set to null.
6159 } 6159 }
6160 if (!buffer) { 6160 if (!buffer) {
6161 if (m_contextLostMode == RealLostContext) { 6161 if (m_contextLostMode == RealLostContext) {
6162 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts, BLINK_FRO M_HERE); 6162 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts, BLINK_FRO M_HERE);
6163 } else { 6163 } else {
6164 // This likely shouldn't happen but is the best way to report it to the WebGL app. 6164 // This likely shouldn't happen but is the best way to report it to the WebGL app.
6165 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context "); 6165 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context ");
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
6483 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6483 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6484 } 6484 }
6485 6485
6486 void WebGLRenderingContextBase::restoreUnpackParameters() 6486 void WebGLRenderingContextBase::restoreUnpackParameters()
6487 { 6487 {
6488 if (m_unpackAlignment != 1) 6488 if (m_unpackAlignment != 1)
6489 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6489 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6490 } 6490 }
6491 6491
6492 } // namespace blink 6492 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698