summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess/BackingStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/BackingStore.cpp')
-rw-r--r--Source/WebKit2/UIProcess/BackingStore.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/WebKit2/UIProcess/BackingStore.cpp b/Source/WebKit2/UIProcess/BackingStore.cpp
index 06d66af..b468b6b 100644
--- a/Source/WebKit2/UIProcess/BackingStore.cpp
+++ b/Source/WebKit2/UIProcess/BackingStore.cpp
@@ -25,6 +25,9 @@
#include "BackingStore.h"
+#include "ShareableBitmap.h"
+#include "UpdateInfo.h"
+
using namespace WebCore;
#if !PLATFORM(MAC)
@@ -33,13 +36,15 @@ using namespace WebCore;
namespace WebKit {
-PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size)
+PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size, WebPageProxy* webPageProxy)
{
- return adoptPtr(new BackingStore(size));
+ return adoptPtr(new BackingStore(size, webPageProxy));
}
-BackingStore::BackingStore(const IntSize& size)
+BackingStore::BackingStore(const IntSize& size, WebPageProxy* webPageProxy)
: m_size(size)
+ , m_webPageProxy(webPageProxy)
+ , m_latestUpdateTimestamp(0)
{
ASSERT(!m_size.isEmpty());
}
@@ -48,4 +53,22 @@ BackingStore::~BackingStore()
{
}
+void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
+{
+ if (updateInfo.timestamp < m_latestUpdateTimestamp) {
+ // The update is too old, discard it.
+ return;
+ }
+
+ ASSERT(m_size == updateInfo.viewSize);
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
+ if (!bitmap)
+ return;
+
+ incorporateUpdate(bitmap.get(), updateInfo);
+
+ m_latestUpdateTimestamp = updateInfo.timestamp;
+}
+
} // namespace WebKit