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

Unified Diff: runtime/lib/isolate.cc

Issue 10829444: Avoid trusting the length encoded in the Snapshot if there is an (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/dart.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
===================================================================
--- runtime/lib/isolate.cc (revision 11409)
+++ runtime/lib/isolate.cc (working copy)
@@ -42,15 +42,6 @@
}
-static uint8_t* SerializeObject(const Instance& obj) {
- uint8_t* result = NULL;
- SnapshotWriter writer(Snapshot::kMessage, &result, &allocator);
- writer.WriteObject(obj.raw());
- writer.FinalizeBuffer();
- return result;
-}
-
-
static void StoreError(Isolate* isolate, const Object& obj) {
ASSERT(obj.IsError());
Error& error = Error::Handle();
@@ -144,11 +135,15 @@
GET_NATIVE_ARGUMENT(Smi, reply_id, arguments->At(1));
// TODO(iposva): Allow for arbitrary messages to be sent.
GET_NATIVE_ARGUMENT(Instance, obj, arguments->At(2));
- uint8_t* data = SerializeObject(obj);
+ uint8_t* data = NULL;
+ MessageWriter writer(&data, &allocator);
+ writer.WriteMessage(obj);
+
// TODO(turnidge): Throw an exception when the return value is false?
- PortMap::PostMessage(new Message(
- send_id.Value(), reply_id.Value(), data, Message::kNormalPriority));
+ PortMap::PostMessage(new Message(send_id.Value(), reply_id.Value(),
+ data, writer.BytesWritten(),
+ Message::kNormalPriority));
}
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698