cc: Turn SharedQuadState into a struct-like class similar to DrawQuads.

SharedQuadState was a struct previously, but required all the data to be passed
to its create() method. This makes the Create() method take no parameters, as
DrawQuads work now. And we add a SetAll() method, similar again to DrawQuad.

We remove the "id" value from ShardQuadState. This shouldn't be needed for
serialization. We can instead just use the pointers in the quads as an id
directly, and compare them against each other to see when we need to create a
new shared quad state. This is sufficient since all quads that share an
instance of SharedQuadState are appended to be adjacent in the quad list.

Covered by existing tests.

TBR=aelias
BUG=152337
Depends on: https://codereview.chromium.org/11411050

Review URL: https://chromiumcodereview.appspot.com/11416088

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168960 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/shared_quad_state.cc b/cc/shared_quad_state.cc
index 94505bc..af47fd7 100644
--- a/cc/shared_quad_state.cc
+++ b/cc/shared_quad_state.cc
@@ -6,25 +6,25 @@
 
 namespace cc {
 
-scoped_ptr<SharedQuadState> SharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity)
-{
-    return make_scoped_ptr(new SharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
+SharedQuadState::SharedQuadState() : opacity(0) {}
+
+scoped_ptr<SharedQuadState> SharedQuadState::Create() {
+  return make_scoped_ptr(new SharedQuadState);
 }
 
-SharedQuadState::SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity)
-    : id(-1)
-    , quadTransform(quadTransform)
-    , visibleContentRect(visibleContentRect)
-    , clippedRectInTarget(clippedRectInTarget)
-    , opacity(opacity)
-{
+scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
+  return make_scoped_ptr(new SharedQuadState(*this));
 }
 
-scoped_ptr<SharedQuadState> SharedQuadState::copy() const
-{
-    scoped_ptr<SharedQuadState> copiedState(create(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
-    copiedState->id = id;
-    return copiedState.Pass();
+void SharedQuadState::SetAll(
+    const WebKit::WebTransformationMatrix& content_to_target_transform,
+    const gfx::Rect& visible_content_rect,
+    const gfx::Rect& clipped_rect_in_target,
+    float opacity) {
+  this->content_to_target_transform = content_to_target_transform;
+  this->visible_content_rect = visible_content_rect;
+  this->clipped_rect_in_target = clipped_rect_in_target;
+  this->opacity = opacity;
 }
 
 }  // namespace cc