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

Unified Diff: runtime/vm/dart_api_message.h

Issue 1523013002: Fold ApiObjectConverter use into ApiMessageReader (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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_api_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.h
diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h
index de1b5c3c5b53da215395c7f375e5c59db4a2bd2d..f4675c4b3841022a7df1ee469b11957bda16e974 100644
--- a/runtime/vm/dart_api_message.h
+++ b/runtime/vm/dart_api_message.h
@@ -9,6 +9,7 @@
#include "platform/utils.h"
#include "vm/allocation.h"
#include "vm/dart_api_state.h"
+#include "vm/message.h"
#include "vm/raw_object.h"
#include "vm/snapshot.h"
@@ -48,6 +49,7 @@ class ApiMessageReader : public BaseReader {
// Allocation of all C Heap objects is done in the zone associated with
// the enclosing ApiNativeScope.
ApiMessageReader(const uint8_t* buffer, intptr_t length);
+ explicit ApiMessageReader(Message* message);
~ApiMessageReader() { }
Dart_CObject* ReadMessage();
@@ -212,13 +214,13 @@ class ApiMessageWriter : public BaseWriter {
// as well.
class ApiObjectConverter : public AllStatic {
public:
- static bool CanConvert(RawObject* raw_obj) {
+ static bool CanConvert(const RawObject* raw_obj) {
return !raw_obj->IsHeapObject() || (raw_obj == Object::null());
}
- static bool Convert(RawObject* raw_obj, Dart_CObject* c_obj) {
+ static bool Convert(const RawObject* raw_obj, Dart_CObject* c_obj) {
if (!raw_obj->IsHeapObject()) {
- ConvertSmi(reinterpret_cast<RawSmi*>(raw_obj), c_obj);
+ ConvertSmi(reinterpret_cast<const RawSmi*>(raw_obj), c_obj);
} else if (raw_obj == Object::null()) {
ConvertNull(c_obj);
} else {
@@ -228,7 +230,7 @@ class ApiObjectConverter : public AllStatic {
}
private:
- static void ConvertSmi(RawSmi* raw_smi, Dart_CObject* c_obj) {
+ static void ConvertSmi(const RawSmi* raw_smi, Dart_CObject* c_obj) {
ASSERT(!raw_smi->IsHeapObject());
intptr_t value = Smi::Value(raw_smi);
if (Utils::IsInt(31, value)) {
« no previous file with comments | « no previous file | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698