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

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

Issue 2879773002: Replace remaining ASSERT with DCHECK|DCHECK_FOO in modules (Closed)
Patch Set: Replace remaining ASSERT with DCHECK|DCHECK_FOO in modules Created 3 years, 7 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 2857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 if (!attachment_object) { 2868 if (!attachment_object) {
2869 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) 2869 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
2870 return WebGLAny(script_state, GL_NONE); 2870 return WebGLAny(script_state, GL_NONE);
2871 // OpenGL ES 2.0 specifies INVALID_ENUM in this case, while desktop GL 2871 // OpenGL ES 2.0 specifies INVALID_ENUM in this case, while desktop GL
2872 // specifies INVALID_OPERATION. 2872 // specifies INVALID_OPERATION.
2873 SynthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", 2873 SynthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter",
2874 "invalid parameter name"); 2874 "invalid parameter name");
2875 return ScriptValue::CreateNull(script_state); 2875 return ScriptValue::CreateNull(script_state);
2876 } 2876 }
2877 2877
2878 ASSERT(attachment_object->IsTexture() || attachment_object->IsRenderbuffer()); 2878 DCHECK(attachment_object->IsTexture() || attachment_object->IsRenderbuffer());
2879 if (attachment_object->IsTexture()) { 2879 if (attachment_object->IsTexture()) {
2880 switch (pname) { 2880 switch (pname) {
2881 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2881 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2882 return WebGLAny(script_state, GL_TEXTURE); 2882 return WebGLAny(script_state, GL_TEXTURE);
2883 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2883 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2884 return WebGLAny(script_state, attachment_object); 2884 return WebGLAny(script_state, attachment_object);
2885 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 2885 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
2886 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: { 2886 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: {
2887 GLint value = 0; 2887 GLint value = 0;
2888 ContextGL()->GetFramebufferAttachmentParameteriv(target, attachment, 2888 ContextGL()->GetFramebufferAttachmentParameteriv(target, attachment,
(...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after
6259 context_group_->LoseContextGroup(mode, auto_recovery_method); 6259 context_group_->LoseContextGroup(mode, auto_recovery_method);
6260 } 6260 }
6261 6261
6262 void WebGLRenderingContextBase::LoseContextImpl( 6262 void WebGLRenderingContextBase::LoseContextImpl(
6263 WebGLRenderingContextBase::LostContextMode mode, 6263 WebGLRenderingContextBase::LostContextMode mode,
6264 AutoRecoveryMethod auto_recovery_method) { 6264 AutoRecoveryMethod auto_recovery_method) {
6265 if (isContextLost()) 6265 if (isContextLost())
6266 return; 6266 return;
6267 6267
6268 context_lost_mode_ = mode; 6268 context_lost_mode_ = mode;
6269 ASSERT(context_lost_mode_ != kNotLostContext); 6269 DCHECK_NE(context_lost_mode_, kNotLostContext);
6270 auto_recovery_method_ = auto_recovery_method; 6270 auto_recovery_method_ = auto_recovery_method;
6271 6271
6272 // Lose all the extensions. 6272 // Lose all the extensions.
6273 for (size_t i = 0; i < extensions_.size(); ++i) { 6273 for (size_t i = 0; i < extensions_.size(); ++i) {
6274 ExtensionTracker* tracker = extensions_[i]; 6274 ExtensionTracker* tracker = extensions_[i];
6275 tracker->LoseExtension(false); 6275 tracker->LoseExtension(false);
6276 } 6276 }
6277 6277
6278 for (size_t i = 0; i < kWebGLExtensionNameCount; ++i) 6278 for (size_t i = 0; i < kWebGLExtensionNameCount; ++i)
6279 extension_enabled_[i] = false; 6279 extension_enabled_[i] = false;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6332 GetDrawingBuffer()->SetFilterQuality(filter_quality); 6332 GetDrawingBuffer()->SetFilterQuality(filter_quality);
6333 } 6333 }
6334 } 6334 }
6335 6335
6336 Extensions3DUtil* WebGLRenderingContextBase::ExtensionsUtil() { 6336 Extensions3DUtil* WebGLRenderingContextBase::ExtensionsUtil() {
6337 if (!extensions_util_) { 6337 if (!extensions_util_) {
6338 gpu::gles2::GLES2Interface* gl = ContextGL(); 6338 gpu::gles2::GLES2Interface* gl = ContextGL();
6339 extensions_util_ = Extensions3DUtil::Create(gl); 6339 extensions_util_ = Extensions3DUtil::Create(gl);
6340 // The only reason the ExtensionsUtil should be invalid is if the gl context 6340 // The only reason the ExtensionsUtil should be invalid is if the gl context
6341 // is lost. 6341 // is lost.
6342 ASSERT(extensions_util_->IsValid() || 6342 DCHECK(extensions_util_->IsValid() ||
6343 gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR); 6343 gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR);
6344 } 6344 }
6345 return extensions_util_.get(); 6345 return extensions_util_.get();
6346 } 6346 }
6347 6347
6348 void WebGLRenderingContextBase::Stop() { 6348 void WebGLRenderingContextBase::Stop() {
6349 if (!isContextLost()) { 6349 if (!isContextLost()) {
6350 // Never attempt to restore the context because the page is being torn down. 6350 // Never attempt to restore the context because the page is being torn down.
6351 ForceLostContext(kSyntheticLostContext, kManual); 6351 ForceLostContext(kSyntheticLostContext, kManual);
6352 } 6352 }
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
7826 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7826 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7827 HTMLCanvasElementOrOffscreenCanvas& result) const { 7827 HTMLCanvasElementOrOffscreenCanvas& result) const {
7828 if (canvas()) { 7828 if (canvas()) {
7829 result.setHTMLCanvasElement(static_cast<HTMLCanvasElement*>(host())); 7829 result.setHTMLCanvasElement(static_cast<HTMLCanvasElement*>(host()));
7830 } else { 7830 } else {
7831 result.setOffscreenCanvas(static_cast<OffscreenCanvas*>(host())); 7831 result.setOffscreenCanvas(static_cast<OffscreenCanvas*>(host()));
7832 } 7832 }
7833 } 7833 }
7834 7834
7835 } // namespace blink 7835 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698