Create DrawQuad in RenderPass and only give out raw pointer to layers

Instead of each layer calling Create function on DrawQuad and pass
ownership around, create DrawQuad in RenderPass and only pass the raw
pointer to layers.

BUG=344962
TEST=cc_unittests

Review URL: https://codereview.chromium.org/369623002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281306 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 1c62fb1f..de1e8ffc 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -647,13 +647,13 @@
     gfx::Rect visible_screen_space_rect = screen_space_rect;
     // Skip the quad culler and just append the quads directly to avoid
     // occlusion checks.
-    scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
+    SolidColorDrawQuad* quad =
+        target_render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
     quad->SetNew(shared_quad_state,
                  screen_space_rect,
                  visible_screen_space_rect,
                  screen_background_color,
                  false);
-    target_render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>());
   }
   for (Region::Iterator fill_rects(overhang_region);
        fill_rects.has_rect();
@@ -662,7 +662,8 @@
     gfx::Rect screen_space_rect = fill_rects.rect();
     gfx::Rect opaque_screen_space_rect = screen_space_rect;
     gfx::Rect visible_screen_space_rect = screen_space_rect;
-    scoped_ptr<TextureDrawQuad> tex_quad = TextureDrawQuad::Create();
+    TextureDrawQuad* tex_quad =
+        target_render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>();
     const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f};
     tex_quad->SetNew(
         shared_quad_state,
@@ -681,7 +682,6 @@
         screen_background_color,
         vertex_opacity,
         false);
-    target_render_pass->AppendDrawQuad(tex_quad.PassAs<DrawQuad>());
   }
 }