Bug 30778

Summary: GraphicsContext3D should be using fastMalloc
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: WebGLAssignee: Chris Marrin <cmarrin>
Status: RESOLVED FIXED    
Severity: Normal CC: oliver, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: OS X 10.5   
Attachments:
Description Flags
Patch with updated test case
aroben: review-
Replacement patch aroben: review+

Description Simon Fraser (smfr) 2009-10-26 09:18:32 PDT
GraphicsContext3D has a bunch of malloc() calls that should be using fastMalloc.
Comment 1 Chris Marrin 2009-12-01 06:45:42 PST
Landed in http://trac.webkit.org/changeset/51535
Comment 2 Chris Marrin 2009-12-01 06:50:31 PST
Sorry, closed wrong bug. Ignore previous comment
Comment 3 Chris Marrin 2009-12-01 07:31:05 PST
Created attachment 44074 [details]
Patch with updated test case
Comment 4 WebKit Review Bot 2009-12-01 07:31:23 PST
style-queue ran check-webkit-style on attachment 44074 [details] without any errors.
Comment 5 Adam Roben (:aroben) 2009-12-01 07:47:19 PST
Comment on attachment 44074 [details]
Patch with updated test case

> -    GLchar* info = (GLchar*) malloc(length);
> +    GLchar* info = (GLchar*) fastMalloc(length);
> +    if (!info)
> +        return "";
> +
>      ::glGetProgramInfoLog((GLuint) program->object(), length, &size, info);
>      String s(info);
>      free(info);

If you use fastMalloc, you need to use fastFree, too.
Comment 6 Adam Roben (:aroben) 2009-12-01 07:49:50 PST
Comment on attachment 44074 [details]
Patch with updated test case

> +// Test program and shader gets
> +var parseError = "ERROR: 0:1: 'I' : syntax error syntax error\nERROR: Parser found no code to compile in source strings.\n";
> +var errorVertString = "I am a bad vertex shader\n";
> +var errorFragString = "I am a bad fragment shader\n";
> +shouldBe('gl.getProgramInfoLog(standardProgram)', '""');
> +shouldBe('gl.getShaderInfoLog(errorVert)', 'parseError');
> +shouldBe('gl.getShaderInfoLog(errorFrag)', 'parseError');
> +shouldBe('gl.getShaderSource(errorVert)', 'errorVertString');
> +shouldBe('gl.getShaderSource(errorFrag)', 'errorFragString');

If you don't quote the second parameter to these functions you'll see the actual error messages in the test output, which might be good. Maybe you should be using shouldBeEqualToString instead?
Comment 7 Chris Marrin 2009-12-01 08:05:40 PST
Created attachment 44079 [details]
Replacement patch

Adds fastFree
Comment 8 Adam Roben (:aroben) 2009-12-01 08:06:50 PST
Comment on attachment 44079 [details]
Replacement patch

r=me
Comment 9 Chris Marrin 2009-12-01 08:10:09 PST
Landed in http://trac.webkit.org/changeset/51537