Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 2385823002: Pass preallocation hints to SkRWBuffer (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
index ca65e9ced4dec0d05229fd3a47a0b151099289dc..44cc03621918fb73eed6523738d644b51dcc6e9a 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -165,7 +165,9 @@ void DeferredImageDecoder::setDataInternal(PassRefPtr<SharedBuffer> passData,
const char* segment = 0;
for (size_t length = data->getSomeData(segment, m_rwBuffer->size()); length;
length = data->getSomeData(segment, m_rwBuffer->size())) {
- m_rwBuffer->append(segment, length);
+ DCHECK_GE(data->size(), m_rwBuffer->size() + length);
+ const size_t remaining = data->size() - m_rwBuffer->size() - length;
+ m_rwBuffer->append(segment, length, remaining);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698