Index: runtime/vm/service.cc |
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
index 50d1aa401c08cd99a4448253b331247189b2f6ac..454726c3fd936badb65c86e70f411c6fd457ef75 100644 |
--- a/runtime/vm/service.cc |
+++ b/runtime/vm/service.cc |
@@ -97,7 +97,7 @@ char* RingServiceIdZone::GetServiceId(const Object& obj) { |
EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL; |
EmbedderServiceHandler* Service::root_service_handler_head_ = NULL; |
struct ServiceMethodDescriptor; |
-ServiceMethodDescriptor* FindMethod(const char* method_name); |
+const ServiceMethodDescriptor* FindMethod(const char* method_name); |
// Support for streams defined in embedders. |
@@ -491,7 +491,7 @@ class IdParameter : public MethodParameter { |
class EnumParameter : public MethodParameter { |
public: |
- EnumParameter(const char* name, bool required, const char** enums) |
+ EnumParameter(const char* name, bool required, const char* const* enums) |
: MethodParameter(name, required), |
enums_(enums) { |
} |
@@ -509,14 +509,14 @@ class EnumParameter : public MethodParameter { |
} |
private: |
- const char** enums_; |
+ const char* const* enums_; |
}; |
// If the key is not found, this function returns the last element in the |
// values array. This can be used to encode the default value. |
template<typename T> |
-T EnumMapper(const char* value, const char** enums, T* values) { |
+T EnumMapper(const char* value, const char* const* enums, T* values) { |
ASSERT(value != NULL); |
intptr_t i = 0; |
for (i = 0; enums[i] != NULL; i++) { |
@@ -644,7 +644,7 @@ void Service::InvokeMethod(Isolate* I, const Array& msg) { |
} |
const char* c_method_name = method_name.ToCString(); |
- ServiceMethodDescriptor* method = FindMethod(c_method_name); |
+ const ServiceMethodDescriptor* method = FindMethod(c_method_name); |
if (method != NULL) { |
if (!ValidateParameters(method->parameters, &js)) { |
js.PostReply(); |
@@ -1385,12 +1385,12 @@ static RawObject* LookupHeapObjectCode(Isolate* isolate, |
return Object::sentinel().raw(); |
} |
uword pc; |
- static const char* kCollectedPrefix = "collected-"; |
+ static const char* const kCollectedPrefix = "collected-"; |
static intptr_t kCollectedPrefixLen = strlen(kCollectedPrefix); |
- static const char* kNativePrefix = "native-"; |
- static intptr_t kNativePrefixLen = strlen(kNativePrefix); |
- static const char* kReusedPrefix = "reused-"; |
- static intptr_t kReusedPrefixLen = strlen(kReusedPrefix); |
+ static const char* const kNativePrefix = "native-"; |
+ static const intptr_t kNativePrefixLen = strlen(kNativePrefix); |
+ static const char* const kReusedPrefix = "reused-"; |
+ static const intptr_t kReusedPrefixLen = strlen(kReusedPrefix); |
const char* id = parts[1]; |
if (strncmp(kCollectedPrefix, id, kCollectedPrefixLen) == 0) { |
if (!GetUnsignedIntegerId(&id[kCollectedPrefixLen], &pc, 16)) { |
@@ -2446,14 +2446,14 @@ static bool GetIsolateMetric(Thread* thread, JSONStream* js) { |
return true; |
} |
// Verify id begins with "metrics/". |
- static const char* kMetricIdPrefix = "metrics/"; |
+ static const char* const kMetricIdPrefix = "metrics/"; |
static intptr_t kMetricIdPrefixLen = strlen(kMetricIdPrefix); |
if (strncmp(metric_id, kMetricIdPrefix, kMetricIdPrefixLen) != 0) { |
PrintInvalidParamError(js, "metricId"); |
return true; |
} |
// Check if id begins with "metrics/native/". |
- static const char* kNativeMetricIdPrefix = "metrics/native/"; |
+ static const char* const kNativeMetricIdPrefix = "metrics/native/"; |
static intptr_t kNativeMetricIdPrefixLen = strlen(kNativeMetricIdPrefix); |
const bool native_metric = |
strncmp(metric_id, kNativeMetricIdPrefix, kNativeMetricIdPrefixLen) == 0; |
@@ -2662,7 +2662,7 @@ static bool GetTagProfile(Thread* thread, JSONStream* js) { |
} |
-static const char* tags_enum_names[] = { |
+static const char* const tags_enum_names[] = { |
"None", |
"UserVM", |
"UserOnly", |
@@ -2672,7 +2672,7 @@ static const char* tags_enum_names[] = { |
}; |
-static Profile::TagOrder tags_enum_values[] = { |
+static const Profile::TagOrder tags_enum_values[] = { |
Profile::kNoTags, |
Profile::kUserVM, |
Profile::kUser, |
@@ -3397,7 +3397,7 @@ static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) { |
} |
-static ServiceMethodDescriptor service_methods_[] = { |
+static const ServiceMethodDescriptor service_methods_[] = { |
{ "_dumpIdZone", DumpIdZone, NULL }, |
{ "_echo", Echo, |
NULL }, |
@@ -3504,11 +3504,11 @@ static ServiceMethodDescriptor service_methods_[] = { |
}; |
-ServiceMethodDescriptor* FindMethod(const char* method_name) { |
+const ServiceMethodDescriptor* FindMethod(const char* method_name) { |
intptr_t num_methods = sizeof(service_methods_) / |
sizeof(service_methods_[0]); |
for (intptr_t i = 0; i < num_methods; i++) { |
- ServiceMethodDescriptor& method = service_methods_[i]; |
+ const ServiceMethodDescriptor& method = service_methods_[i]; |
if (strcmp(method_name, method.name) == 0) { |
return &method; |
} |