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

Unified Diff: runtime/vm/datastream.h

Issue 14273021: Report OOM errors instead of asserting on allocation failures when sending (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | runtime/vm/exceptions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/datastream.h
===================================================================
--- runtime/vm/datastream.h (revision 21956)
+++ runtime/vm/datastream.h (working copy)
@@ -8,6 +8,7 @@
#include "platform/assert.h"
#include "platform/utils.h"
#include "vm/allocation.h"
+#include "vm/exceptions.h"
#include "vm/globals.h"
namespace dart {
@@ -148,7 +149,9 @@
*buffer_ = reinterpret_cast<uint8_t*>(alloc_(NULL,
0,
initial_size_));
- ASSERT(*buffer_ != NULL);
+ if (*buffer_ == NULL) {
+ Exceptions::ThrowOOM();
+ }
current_ = *buffer_;
current_size_ = initial_size_;
end_ = *buffer_ + initial_size_;
@@ -243,7 +246,9 @@
*buffer_ = reinterpret_cast<uint8_t*>(alloc_(*buffer_,
current_size_,
new_size));
- ASSERT(*buffer_ != NULL);
+ if (*buffer_ == NULL) {
+ Exceptions::ThrowOOM();
+ }
current_ = *buffer_ + position;
current_size_ = new_size;
end_ = *buffer_ + new_size;
« no previous file with comments | « no previous file | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698