Eliminate ResourceBuffer and use SharedBuffer directly instead
[WebKit-https.git] / Source / WebCore / loader / cache / CachedTextTrack.cpp
index 709fad8..7155922 100644 (file)
@@ -32,7 +32,6 @@
 #include "CachedResourceClient.h"
 #include "CachedResourceClientWalker.h"
 #include "CachedResourceLoader.h"
-#include "ResourceBuffer.h"
 #include "SharedBuffer.h"
 #include "TextResourceDecoder.h"
 #include <wtf/Vector.h>
@@ -44,24 +43,26 @@ CachedTextTrack::CachedTextTrack(const ResourceRequest& resourceRequest, Session
 {
 }
 
-CachedTextTrack::~CachedTextTrack()
+void CachedTextTrack::updateData(SharedBuffer* data)
 {
-}
-
-void CachedTextTrack::addDataBuffer(ResourceBuffer* data)
-{
-    ASSERT(m_options.dataBufferingPolicy() == BufferData);
+    ASSERT(dataBufferingPolicy() == BufferData);
     m_data = data;
-    setEncodedSize(m_data.get() ? m_data->size() : 0);
+    setEncodedSize(data ? data->size() : 0);
 
     CachedResourceClientWalker<CachedResourceClient> walker(m_clients);
-    while (CachedResourceClient *client = walker.next())
+    while (CachedResourceClientclient = walker.next())
         client->deprecatedDidReceiveCachedResource(this);
 }
 
-void CachedTextTrack::finishLoading(ResourceBuffer* data)
+void CachedTextTrack::addDataBuffer(SharedBuffer& data)
+{
+    updateData(&data);
+    CachedResource::addDataBuffer(data);
+}
+
+void CachedTextTrack::finishLoading(SharedBuffer* data)
 {
-    addDataBuffer(data);
+    updateData(data);
     CachedResource::finishLoading(data);
 }