<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200451] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200451">200451</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2016-05-04 23:42:32 -0700 (Wed, 04 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[TexMap] Clean up TextureMapperShaderProgram
https://bugs.webkit.org/show_bug.cgi?id=157302

Reviewed by Carlos Garcia Campos.

Clean up the header and the implementation file of the
TextureMapperShaderProgram class. Reference the GraphicsContext3D
object through a Ref&lt;&gt;, and have the context() return a reference,
not a pointer.

Sort the parts of the implementation file into something more
sensible. StringBuilder usage in create() is improved. getLocation()
only needs to do one lookup in the m_variables map by using ensure().

No new tests -- no change in behavior.

* platform/graphics/surfaces/GLTransportSurface.cpp:
(WebCore::GLTransportSurface::initializeShaderProgram):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGLData::SharedGLData::getShaderProgram):
(WebCore::prepareFilterProgram):
* platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
(WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
(WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
(WebCore::TextureMapperShaderProgram::setMatrix):
(WebCore::TextureMapperShaderProgram::getLocation):
* platform/graphics/texmap/TextureMapperShaderProgram.h:
(WebCore::TextureMapperShaderProgram::context):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesGLTransportSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLcpp">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramcpp">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramh">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200450 => 200451)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-05 06:13:28 UTC (rev 200450)
+++ trunk/Source/WebCore/ChangeLog        2016-05-05 06:42:32 UTC (rev 200451)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-05-04  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        [TexMap] Clean up TextureMapperShaderProgram
+        https://bugs.webkit.org/show_bug.cgi?id=157302
+
+        Reviewed by Carlos Garcia Campos.
+
+        Clean up the header and the implementation file of the
+        TextureMapperShaderProgram class. Reference the GraphicsContext3D
+        object through a Ref&lt;&gt;, and have the context() return a reference,
+        not a pointer.
+
+        Sort the parts of the implementation file into something more
+        sensible. StringBuilder usage in create() is improved. getLocation()
+        only needs to do one lookup in the m_variables map by using ensure().
+
+        No new tests -- no change in behavior.
+
+        * platform/graphics/surfaces/GLTransportSurface.cpp:
+        (WebCore::GLTransportSurface::initializeShaderProgram):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGLData::SharedGLData::getShaderProgram):
+        (WebCore::prepareFilterProgram):
+        * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
+        (WebCore::TextureMapperShaderProgram::create):
+        (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
+        (WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
+        (WebCore::TextureMapperShaderProgram::setMatrix):
+        (WebCore::TextureMapperShaderProgram::getLocation):
+        * platform/graphics/texmap/TextureMapperShaderProgram.h:
+        (WebCore::TextureMapperShaderProgram::context):
+
</ins><span class="cx"> 2016-05-03  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Start on dictionary support for IDL, getting enough to work for one dictionary
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesGLTransportSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp (200450 => 200451)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp        2016-05-05 06:13:28 UTC (rev 200450)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp        2016-05-05 06:42:32 UTC (rev 200451)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">     vertexArrayObjectSupported = m_context3D-&gt;getExtensions()-&gt;supports(&quot;GL_OES_vertex_array_object&quot;);
</span><span class="cx"> 
</span><span class="cx">     TextureMapperShaderProgram::Options options = TextureMapperShaderProgram::Texture;
</span><del>-    m_shaderProgram = TextureMapperShaderProgram::create(m_context3D, options);
</del><ins>+    m_shaderProgram = TextureMapperShaderProgram::create(*m_context3D, options);
</ins><span class="cx"> 
</span><span class="cx">     ::glUseProgram(m_shaderProgram-&gt;programID());
</span><span class="cx">     ::glUniform1i(m_shaderProgram-&gt;samplerLocation(), 0);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (200450 => 200451)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp        2016-05-05 06:13:28 UTC (rev 200450)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp        2016-05-05 06:42:32 UTC (rev 200451)
</span><span class="lines">@@ -347,7 +347,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void prepareFilterProgram(TextureMapperShaderProgram* program, const FilterOperation&amp; operation, unsigned pass, const IntSize&amp; size, GC3Duint contentTexture)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;GraphicsContext3D&gt; context = program-&gt;context();
</del><ins>+    Ref&lt;GraphicsContext3D&gt; context = program-&gt;context();
</ins><span class="cx">     context-&gt;useProgram(program-&gt;programID());
</span><span class="cx"> 
</span><span class="cx">     switch (operation.type()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp (200450 => 200451)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp        2016-05-05 06:13:28 UTC (rev 200450)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp        2016-05-05 06:42:32 UTC (rev 200451)
</span><span class="lines">@@ -24,14 +24,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL)
</span><span class="cx"> 
</span><del>-#include &quot;LengthFunctions.h&quot;
</del><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;TextureMapperGL.h&quot;
</span><del>-
</del><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><del>-#define STRINGIFY(...) #__VA_ARGS__
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static inline bool compositingLogEnabled()
</span><span class="lines">@@ -43,77 +39,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TextureMapperShaderProgram::TextureMapperShaderProgram(PassRefPtr&lt;GraphicsContext3D&gt; context, const String&amp; vertex, const String&amp; fragment)
-    : m_context(context)
-{
-    m_vertexShader = m_context-&gt;createShader(GraphicsContext3D::VERTEX_SHADER);
-    m_fragmentShader = m_context-&gt;createShader(GraphicsContext3D::FRAGMENT_SHADER);
-    m_context-&gt;shaderSource(m_vertexShader, vertex);
-    m_context-&gt;shaderSource(m_fragmentShader, fragment);
-    m_id = m_context-&gt;createProgram();
-    m_context-&gt;compileShader(m_vertexShader);
-    m_context-&gt;compileShader(m_fragmentShader);
-    m_context-&gt;attachShader(m_id, m_vertexShader);
-    m_context-&gt;attachShader(m_id, m_fragmentShader);
-    m_context-&gt;linkProgram(m_id);
</del><ins>+#define STRINGIFY(...) #__VA_ARGS__
</ins><span class="cx"> 
</span><del>-    if (!compositingLogEnabled())
-        return;
-
-    if (m_context-&gt;getError() == GraphicsContext3D::NO_ERROR)
-        return;
-
-    String log = m_context-&gt;getShaderInfoLog(m_vertexShader);
-    LOG(Compositing, &quot;Vertex shader log: %s\n&quot;, log.utf8().data());
-    log = m_context-&gt;getShaderInfoLog(m_fragmentShader);
-    LOG(Compositing, &quot;Fragment shader log: %s\n&quot;, log.utf8().data());
-    log = m_context-&gt;getProgramInfoLog(m_id);
-    LOG(Compositing, &quot;Program log: %s\n&quot;, log.utf8().data());
-}
-
-void TextureMapperShaderProgram::setMatrix(GC3Duint location, const TransformationMatrix&amp; matrix)
-{
-    TransformationMatrix::FloatMatrix4 floatMatrix;
-    matrix.toColumnMajorFloatArray(floatMatrix);
-    m_context-&gt;uniformMatrix4fv(location, 1, false, floatMatrix);
-}
-
-GC3Duint TextureMapperShaderProgram::getLocation(const AtomicString&amp; name, VariableType type)
-{
-    HashMap&lt;AtomicString, GC3Duint&gt;::iterator it = m_variables.find(name);
-    if (it != m_variables.end())
-        return it-&gt;value;
-
-    GC3Duint location = 0;
-    switch (type) {
-    case UniformVariable:
-        location = m_context-&gt;getUniformLocation(m_id, name);
-        break;
-    case AttribVariable:
-        location = m_context-&gt;getAttribLocation(m_id, name);
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    m_variables.add(name, location);
-    return location;
-}
-
-TextureMapperShaderProgram::~TextureMapperShaderProgram()
-{
-    Platform3DObject programID = m_id;
-    if (!programID)
-        return;
-
-    m_context-&gt;detachShader(programID, m_vertexShader);
-    m_context-&gt;deleteShader(m_vertexShader);
-    m_context-&gt;detachShader(programID, m_fragmentShader);
-    m_context-&gt;deleteShader(m_fragmentShader);
-    m_context-&gt;deleteProgram(programID);
-}
-
</del><span class="cx"> #define GLSL_DIRECTIVE(...) &quot;#&quot;#__VA_ARGS__&quot;\n&quot;
</span><span class="cx"> 
</span><span class="cx"> #define TEXTURE_SPACE_MATRIX_PRECISION_DIRECTIVE \
</span><span class="lines">@@ -373,13 +300,13 @@
</span><span class="cx">         }
</span><span class="cx">     );
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;TextureMapperShaderProgram&gt; TextureMapperShaderProgram::create(PassRefPtr&lt;GraphicsContext3D&gt; context, TextureMapperShaderProgram::Options options)
</del><ins>+Ref&lt;TextureMapperShaderProgram&gt; TextureMapperShaderProgram::create(Ref&lt;GraphicsContext3D&gt;&amp;&amp; context, TextureMapperShaderProgram::Options options)
</ins><span class="cx"> {
</span><del>-    StringBuilder shaderBuilder;
</del><span class="cx"> #define SET_APPLIER_FROM_OPTIONS(Applier) \
</span><del>-    shaderBuilder.append(\
</del><ins>+    optionsApplierBuilder.append(\
</ins><span class="cx">         (options &amp; TextureMapperShaderProgram::Applier) ? ENABLE_APPLIER(Applier) : DISABLE_APPLIER(Applier))
</span><span class="cx"> 
</span><ins>+    StringBuilder optionsApplierBuilder;
</ins><span class="cx">     SET_APPLIER_FROM_OPTIONS(Texture);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(Rect);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(SolidColor);
</span><span class="lines">@@ -396,16 +323,83 @@
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(BlurFilter);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(AlphaBlur);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(ContentTexture);
</span><del>-    StringBuilder vertexBuilder;
-    vertexBuilder.append(shaderBuilder.toString());
-    vertexBuilder.append(vertexTemplate);
-    shaderBuilder.append(fragmentTemplate);
</del><span class="cx"> 
</span><del>-    String vertexSource = vertexBuilder.toString();
-    String fragmentSource = shaderBuilder.toString();
</del><ins>+    StringBuilder vertexShaderBuilder;
+    vertexShaderBuilder.append(optionsApplierBuilder.toString());
+    vertexShaderBuilder.append(vertexTemplate);
</ins><span class="cx"> 
</span><del>-    return adoptRef(new TextureMapperShaderProgram(context, vertexSource, fragmentSource));
</del><ins>+    StringBuilder fragmentShaderBuilder;
+    fragmentShaderBuilder.append(optionsApplierBuilder.toString());
+    fragmentShaderBuilder.append(fragmentTemplate);
+
+    return adoptRef(*new TextureMapperShaderProgram(WTFMove(context), vertexShaderBuilder.toString(), fragmentShaderBuilder.toString()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TextureMapperShaderProgram::TextureMapperShaderProgram(Ref&lt;GraphicsContext3D&gt;&amp;&amp; context, const String&amp; vertex, const String&amp; fragment)
+    : m_context(WTFMove(context))
+{
+    m_vertexShader = m_context-&gt;createShader(GraphicsContext3D::VERTEX_SHADER);
+    m_context-&gt;shaderSource(m_vertexShader, vertex);
+
+    m_fragmentShader = m_context-&gt;createShader(GraphicsContext3D::FRAGMENT_SHADER);
+    m_context-&gt;shaderSource(m_fragmentShader, fragment);
+
+    m_id = m_context-&gt;createProgram();
+    m_context-&gt;compileShader(m_vertexShader);
+    m_context-&gt;compileShader(m_fragmentShader);
+    m_context-&gt;attachShader(m_id, m_vertexShader);
+    m_context-&gt;attachShader(m_id, m_fragmentShader);
+    m_context-&gt;linkProgram(m_id);
+
+    if (!compositingLogEnabled())
+        return;
+
+    if (m_context-&gt;getError() == GraphicsContext3D::NO_ERROR)
+        return;
+
+    String log = m_context-&gt;getShaderInfoLog(m_vertexShader);
+    LOG(Compositing, &quot;Vertex shader log: %s\n&quot;, log.utf8().data());
+    log = m_context-&gt;getShaderInfoLog(m_fragmentShader);
+    LOG(Compositing, &quot;Fragment shader log: %s\n&quot;, log.utf8().data());
+    log = m_context-&gt;getProgramInfoLog(m_id);
+    LOG(Compositing, &quot;Program log: %s\n&quot;, log.utf8().data());
</ins><span class="cx"> }
</span><ins>+
+TextureMapperShaderProgram::~TextureMapperShaderProgram()
+{
+    if (!m_id)
+        return;
+
+    m_context-&gt;detachShader(m_id, m_vertexShader);
+    m_context-&gt;deleteShader(m_vertexShader);
+    m_context-&gt;detachShader(m_id, m_fragmentShader);
+    m_context-&gt;deleteShader(m_fragmentShader);
+    m_context-&gt;deleteProgram(m_id);
+}
+
+void TextureMapperShaderProgram::setMatrix(GC3Duint location, const TransformationMatrix&amp; matrix)
+{
+    TransformationMatrix::FloatMatrix4 floatMatrix;
+    matrix.toColumnMajorFloatArray(floatMatrix);
+    m_context-&gt;uniformMatrix4fv(location, 1, false, floatMatrix);
+}
+
+GC3Duint TextureMapperShaderProgram::getLocation(const AtomicString&amp; name, VariableType type)
+{
+    auto addResult = m_variables.ensure(name,
+        [this, &amp;name, type] {
+            switch (type) {
+            case UniformVariable:
+                return m_context-&gt;getUniformLocation(m_id, name);
+            case AttribVariable:
+                return m_context-&gt;getAttribLocation(m_id, name);
+            }
+            ASSERT_NOT_REACHED();
+            return 0;
+        });
+    return addResult.iterator-&gt;value;
+}
+
+} // namespace WebCore
+
</ins><span class="cx"> #endif // USE(TEXTURE_MAPPER_GL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h (200450 => 200451)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h        2016-05-05 06:13:28 UTC (rev 200450)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h        2016-05-05 06:42:32 UTC (rev 200451)
</span><span class="lines">@@ -22,14 +22,15 @@
</span><span class="cx"> #define TextureMapperShaderProgram_h
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL)
</span><ins>+
</ins><span class="cx"> #include &quot;GraphicsContext3D.h&quot;
</span><span class="cx"> #include &quot;TransformationMatrix.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
</del><ins>+#include &lt;wtf/Ref.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/AtomicStringHash.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><ins>+
</ins><span class="cx"> #define TEXMAP_DECLARE_VARIABLE(Accessor, Name, Type) GC3Duint Accessor##Location() { static const AtomicString name(Name); return getLocation(name, Type); }
</span><span class="cx"> #define TEXMAP_DECLARE_UNIFORM(Accessor) TEXMAP_DECLARE_VARIABLE(Accessor, &quot;u_&quot;#Accessor, UniformVariable)
</span><span class="cx"> #define TEXMAP_DECLARE_ATTRIBUTE(Accessor) TEXMAP_DECLARE_VARIABLE(Accessor, &quot;a_&quot;#Accessor, AttribVariable)
</span><span class="lines">@@ -58,10 +59,11 @@
</span><span class="cx"> 
</span><span class="cx">     typedef unsigned Options;
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;TextureMapperShaderProgram&gt; create(PassRefPtr&lt;GraphicsContext3D&gt;, Options);
</del><ins>+    static Ref&lt;TextureMapperShaderProgram&gt; create(Ref&lt;GraphicsContext3D&gt;&amp;&amp;, Options);
</ins><span class="cx">     virtual ~TextureMapperShaderProgram();
</span><ins>+
</ins><span class="cx">     Platform3DObject programID() const { return m_id; }
</span><del>-    GraphicsContext3D* context() { return m_context.get(); }
</del><ins>+    GraphicsContext3D&amp; context() { return m_context; }
</ins><span class="cx"> 
</span><span class="cx">     TEXMAP_DECLARE_ATTRIBUTE(vertex)
</span><span class="cx"> 
</span><span class="lines">@@ -83,14 +85,15 @@
</span><span class="cx">     void setMatrix(GC3Duint, const TransformationMatrix&amp;);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    TextureMapperShaderProgram(PassRefPtr&lt;GraphicsContext3D&gt;, const String&amp; vertexShaderSource, const String&amp; fragmentShaderSource);
</del><ins>+    TextureMapperShaderProgram(Ref&lt;GraphicsContext3D&gt;&amp;&amp;, const String&amp; vertexShaderSource, const String&amp; fragmentShaderSource);
+
</ins><span class="cx">     Platform3DObject m_vertexShader;
</span><span class="cx">     Platform3DObject m_fragmentShader;
</span><span class="cx"> 
</span><span class="cx">     enum VariableType { UniformVariable, AttribVariable };
</span><span class="cx">     GC3Duint getLocation(const AtomicString&amp;, VariableType);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;GraphicsContext3D&gt; m_context;
</del><ins>+    Ref&lt;GraphicsContext3D&gt; m_context;
</ins><span class="cx">     Platform3DObject m_id;
</span><span class="cx">     HashMap&lt;AtomicString, GC3Duint&gt; m_variables;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>