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

Unified Diff: Source/wtf/ArrayBufferBuilder.h

Issue 206243002: Check if ArrayBuffer allocation in ArrayBufferBuilder is successful. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « Source/core/fileapi/FileReaderLoader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/ArrayBufferBuilder.h
diff --git a/Source/wtf/ArrayBufferBuilder.h b/Source/wtf/ArrayBufferBuilder.h
index 92b73c6877d1f425b57c9aacdc89a21ca3381898..38b285a0bf02dbec54bda02d7985b31e80899bda 100644
--- a/Source/wtf/ArrayBufferBuilder.h
+++ b/Source/wtf/ArrayBufferBuilder.h
@@ -38,7 +38,8 @@
namespace WTF {
-// A utility class to build an ArrayBuffer instance.
+// A utility class to build an ArrayBuffer instance. Validity must be checked
+// by isValid() before using an instance.
class WTF_EXPORT ArrayBufferBuilder {
// Disallow copying since it's expensive and we don't want code to do it by
// accident.
@@ -55,6 +56,12 @@ public:
m_buffer = ArrayBuffer::create(capacity, 1);
}
+ bool isValid() const
+ {
+ return m_buffer;
+ }
+
+ // Appending empty data is not allowed.
unsigned append(const char* data, unsigned length);
// Returns the accumulated data as an ArrayBuffer instance. If needed,
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698