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

Side by Side Diff: runtime/vm/dart_api_message.h

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, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DART_API_MESSAGE_H_ 5 #ifndef VM_DART_API_MESSAGE_H_
6 #define VM_DART_API_MESSAGE_H_ 6 #define VM_DART_API_MESSAGE_H_
7 7
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/snapshot.h" 9 #include "vm/snapshot.h"
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 forward_list_(NULL), forward_list_length_(0), forward_id_(0) { 117 forward_list_(NULL), forward_list_length_(0), forward_id_(0) {
118 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1); 118 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1);
119 } 119 }
120 ~ApiMessageWriter() { 120 ~ApiMessageWriter() {
121 ::free(forward_list_); 121 ::free(forward_list_);
122 } 122 }
123 123
124 // Writes a message of integers. 124 // Writes a message of integers.
125 void WriteMessage(intptr_t field_count, intptr_t *data); 125 void WriteMessage(intptr_t field_count, intptr_t *data);
126 126
127 // Writes a message with a single object.
127 void WriteCMessage(Dart_CObject* object); 128 void WriteCMessage(Dart_CObject* object);
128 129
129 void FinalizeBuffer() {
130 BaseWriter::FinalizeBuffer(Snapshot::kMessage);
131 }
132
133 private: 130 private:
134 static const intptr_t kDartCObjectTypeBits = 4; 131 static const intptr_t kDartCObjectTypeBits = 4;
135 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1; 132 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1;
136 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask; 133 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask;
137 static const intptr_t kDartCObjectMarkOffset = 1; 134 static const intptr_t kDartCObjectMarkOffset = 1;
138 135
139 void MarkCObject(Dart_CObject* object, intptr_t object_id); 136 void MarkCObject(Dart_CObject* object, intptr_t object_id);
140 void UnmarkCObject(Dart_CObject* object); 137 void UnmarkCObject(Dart_CObject* object);
141 bool IsCObjectMarked(Dart_CObject* object); 138 bool IsCObjectMarked(Dart_CObject* object);
142 intptr_t GetMarkedCObjectMark(Dart_CObject* object); 139 intptr_t GetMarkedCObjectMark(Dart_CObject* object);
(...skipping 15 matching lines...) Expand all
158 Dart_CObject** forward_list_; 155 Dart_CObject** forward_list_;
159 intptr_t forward_list_length_; 156 intptr_t forward_list_length_;
160 intptr_t forward_id_; 157 intptr_t forward_id_;
161 158
162 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); 159 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter);
163 }; 160 };
164 161
165 } // namespace dart 162 } // namespace dart
166 163
167 #endif // VM_DART_API_MESSAGE_H_ 164 #endif // VM_DART_API_MESSAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698