Revert "Make the default framebuffer owned by Surface"

Seems to be causing failures on the Mac GPU FYI bots.
SurfaceTest.DestructionDeletesImpl seems to crash.

BUG=angleproject:891
BUG=522557

This reverts commit 264ab56f2e70431e8310f9353952acd3b22b466f.

Change-Id: I80aeecb8e191de011d9afe6534d0285dcffa82a3
Reviewed-on: https://chromium-review.googlesource.com/294540
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index afc1630..0880984 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -20,7 +20,6 @@
 #include "libANGLE/renderer/FramebufferImpl.h"
 #include "libANGLE/renderer/ImplFactory.h"
 #include "libANGLE/renderer/RenderbufferImpl.h"
-#include "libANGLE/renderer/SurfaceImpl.h"
 
 namespace gl
 {
@@ -38,14 +37,6 @@
 }
 }
 
-Framebuffer::Data::Data()
-    : mColorAttachments(1),
-      mDrawBufferStates(1, GL_NONE),
-      mReadBufferState(GL_COLOR_ATTACHMENT0_EXT)
-{
-    mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
-}
-
 Framebuffer::Data::Data(const Caps &caps)
     : mColorAttachments(caps.maxColorAttachments),
       mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
@@ -92,7 +83,7 @@
     return nullptr;
 }
 
-const FramebufferAttachment *Framebuffer::Data::getColorAttachment(size_t colorAttachment) const
+const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
 {
     ASSERT(colorAttachment < mColorAttachments.size());
     return mColorAttachments[colorAttachment].isAttached() ?
@@ -125,15 +116,18 @@
 }
 
 Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id)
-    : mData(caps), mImpl(factory->createFramebuffer(mData)), mId(id)
+    : mData(caps),
+      mImpl(nullptr),
+      mId(id)
 {
-    ASSERT(mId != 0);
-    ASSERT(mImpl != nullptr);
-}
-
-Framebuffer::Framebuffer(rx::SurfaceImpl *surface)
-    : mData(), mImpl(surface->createDefaultFramebuffer(mData)), mId(0)
-{
+    if (mId == 0)
+    {
+        mImpl = factory->createDefaultFramebuffer(mData);
+    }
+    else
+    {
+        mImpl = factory->createFramebuffer(mData);
+    }
     ASSERT(mImpl != nullptr);
 }
 
@@ -163,7 +157,7 @@
     DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId);
 }
 
-const FramebufferAttachment *Framebuffer::getColorbuffer(size_t colorAttachment) const
+const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
 {
     return mData.getColorAttachment(colorAttachment);
 }
@@ -263,7 +257,7 @@
     mImpl->setReadBuffer(buffer);
 }
 
-bool Framebuffer::isEnabledColorAttachment(size_t colorAttachment) const
+bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
 {
     ASSERT(colorAttachment < mData.mColorAttachments.size());
     return (mData.mColorAttachments[colorAttachment].isAttached() &&
@@ -283,11 +277,6 @@
     return false;
 }
 
-size_t Framebuffer::getNumColorBuffers() const
-{
-    return mData.mColorAttachments.size();
-}
-
 bool Framebuffer::hasStencil() const
 {
     return (mData.mStencilAttachment.isAttached() && mData.mStencilAttachment.getStencilSize() > 0);