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

Side by Side Diff: runtime/vm/service.cc

Issue 2050393002: WIP: DevFS initial implementation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service_isolate.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/cpu.h" 12 #include "vm/cpu.h"
13 #include "vm/dart_api_impl.h" 13 #include "vm/dart_api_impl.h"
14 #include "vm/dart_api_state.h" 14 #include "vm/dart_api_state.h"
15 #include "vm/dart_entry.h" 15 #include "vm/dart_entry.h"
16 #include "vm/debugger.h" 16 #include "vm/debugger.h"
17 #include "vm/dev_fs.h"
17 #include "vm/isolate.h" 18 #include "vm/isolate.h"
18 #include "vm/lockers.h" 19 #include "vm/lockers.h"
19 #include "vm/message.h" 20 #include "vm/message.h"
20 #include "vm/message_handler.h" 21 #include "vm/message_handler.h"
21 #include "vm/native_entry.h" 22 #include "vm/native_entry.h"
22 #include "vm/native_arguments.h" 23 #include "vm/native_arguments.h"
23 #include "vm/native_symbol.h" 24 #include "vm/native_symbol.h"
24 #include "vm/object.h" 25 #include "vm/object.h"
25 #include "vm/object_graph.h" 26 #include "vm/object_graph.h"
26 #include "vm/object_id_ring.h" 27 #include "vm/object_id_ring.h"
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
3876 if (Service::isolate_stream.enabled()) { 3877 if (Service::isolate_stream.enabled()) {
3877 ServiceEvent event(isolate, ServiceEvent::kIsolateUpdate); 3878 ServiceEvent event(isolate, ServiceEvent::kIsolateUpdate);
3878 Service::HandleEvent(&event); 3879 Service::HandleEvent(&event);
3879 } 3880 }
3880 PrintSuccess(js); 3881 PrintSuccess(js);
3881 return true; 3882 return true;
3882 } 3883 }
3883 3884
3884 3885
3885 static const MethodParameter* set_vm_name_params[] = { 3886 static const MethodParameter* set_vm_name_params[] = {
3887 NO_ISOLATE_PARAMETER,
3886 new MethodParameter("name", true), 3888 new MethodParameter("name", true),
3887 NULL, 3889 NULL,
3888 }; 3890 };
3889 3891
3890 3892
3891 static bool SetVMName(Thread* thread, JSONStream* js) { 3893 static bool SetVMName(Thread* thread, JSONStream* js) {
3892 const char* name_param = js->LookupParam("name"); 3894 const char* name_param = js->LookupParam("name");
3893 free(vm_name); 3895 free(vm_name);
3894 vm_name = strdup(name_param); 3896 vm_name = strdup(name_param);
3895 if (Service::vm_stream.enabled()) { 3897 if (Service::vm_stream.enabled()) {
(...skipping 29 matching lines...) Expand all
3925 return true; 3927 return true;
3926 } 3928 }
3927 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); 3929 const Class& cls = Class::Handle(GetClassForId(isolate, cid));
3928 ASSERT(!cls.IsNull()); 3930 ASSERT(!cls.IsNull());
3929 cls.SetTraceAllocation(enable); 3931 cls.SetTraceAllocation(enable);
3930 PrintSuccess(js); 3932 PrintSuccess(js);
3931 return true; 3933 return true;
3932 } 3934 }
3933 3935
3934 3936
3937 static const MethodParameter* create_dev_fs_params[] = {
3938 NO_ISOLATE_PARAMETER,
3939 new MethodParameter("fsName", true),
3940 NULL,
3941 };
3942
3943
3944 static bool CreateDevFS(Thread* thread, JSONStream* js) {
3945 const char* fs_name = js->LookupParam("fsName");
3946 DevFS::CreateFileSystem(js, fs_name);
3947 return true;
3948 }
3949
3950
3951 static const MethodParameter* delete_dev_fs_params[] = {
3952 NO_ISOLATE_PARAMETER,
3953 new MethodParameter("fsName", true),
3954 NULL,
3955 };
3956
3957
3958 static bool DeleteDevFS(Thread* thread, JSONStream* js) {
3959 const char* fs_name = js->LookupParam("fsName");
3960 DevFS::DeleteFileSystem(js, fs_name);
3961 return true;
3962 }
3963
3964
3965 static const MethodParameter* list_dev_fs_params[] = {
3966 NO_ISOLATE_PARAMETER,
3967 NULL,
3968 };
3969
3970
3971 static bool ListDevFS(Thread* thread, JSONStream* js) {
3972 DevFS::ListFileSystems(js);
3973 return true;
3974 }
3975
3976
3977 static const MethodParameter* write_dev_fs_file_params[] = {
3978 NO_ISOLATE_PARAMETER,
3979 new MethodParameter("fsName", true),
3980 new MethodParameter("path", true),
3981 new MethodParameter("fileContents", true),
3982 NULL,
3983 };
3984
3985
3986 static bool WriteDevFSFile(Thread* thread, JSONStream* js) {
3987 const char* fs_name = js->LookupParam("fsName");
3988 const char* path_param = js->LookupParam("path");
3989 const char* contents_param = js->LookupParam("fileContents");
3990 DevFS::WriteFile(js, fs_name, path_param, contents_param);
3991 return true;
3992 }
3993
3994
3995 static const MethodParameter* read_dev_fs_file_params[] = {
3996 NO_ISOLATE_PARAMETER,
3997 new MethodParameter("fsName", true),
3998 new MethodParameter("path", true),
3999 NULL,
4000 };
4001
4002
4003 static bool ReadDevFSFile(Thread* thread, JSONStream* js) {
4004 const char* fs_name = js->LookupParam("fsName");
4005 const char* path_param = js->LookupParam("path");
4006 DevFS::ReadFile(js, fs_name, path_param);
4007 return true;
4008 }
4009
4010
3935 static const ServiceMethodDescriptor service_methods_[] = { 4011 static const ServiceMethodDescriptor service_methods_[] = {
3936 { "_dumpIdZone", DumpIdZone, NULL }, 4012 { "_dumpIdZone", DumpIdZone, NULL },
3937 { "_echo", Echo, 4013 { "_echo", Echo,
3938 NULL }, 4014 NULL },
3939 { "_respondWithMalformedJson", RespondWithMalformedJson, 4015 { "_respondWithMalformedJson", RespondWithMalformedJson,
3940 NULL }, 4016 NULL },
3941 { "_respondWithMalformedObject", RespondWithMalformedObject, 4017 { "_respondWithMalformedObject", RespondWithMalformedObject,
3942 NULL }, 4018 NULL },
3943 { "_triggerEchoEvent", TriggerEchoEvent, 4019 { "_triggerEchoEvent", TriggerEchoEvent,
3944 NULL }, 4020 NULL },
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4037 { "setLibraryDebuggable", SetLibraryDebuggable, 4113 { "setLibraryDebuggable", SetLibraryDebuggable,
4038 set_library_debuggable_params }, 4114 set_library_debuggable_params },
4039 { "setName", SetName, 4115 { "setName", SetName,
4040 set_name_params }, 4116 set_name_params },
4041 { "_setTraceClassAllocation", SetTraceClassAllocation, 4117 { "_setTraceClassAllocation", SetTraceClassAllocation,
4042 set_trace_class_allocation_params }, 4118 set_trace_class_allocation_params },
4043 { "setVMName", SetVMName, 4119 { "setVMName", SetVMName,
4044 set_vm_name_params }, 4120 set_vm_name_params },
4045 { "_setVMTimelineFlags", SetVMTimelineFlags, 4121 { "_setVMTimelineFlags", SetVMTimelineFlags,
4046 set_vm_timeline_flags_params }, 4122 set_vm_timeline_flags_params },
4123 { "_createDevFS", CreateDevFS,
4124 create_dev_fs_params },
4125 { "_deleteDevFS", DeleteDevFS,
4126 delete_dev_fs_params },
4127 { "_listDevFS", ListDevFS,
4128 list_dev_fs_params },
4129 { "_writeDevFSFile", WriteDevFSFile,
4130 write_dev_fs_file_params },
4131 { "_readDevFSFile", ReadDevFSFile,
4132 read_dev_fs_file_params },
4047 }; 4133 };
4048 4134
4049 4135
4050 const ServiceMethodDescriptor* FindMethod(const char* method_name) { 4136 const ServiceMethodDescriptor* FindMethod(const char* method_name) {
4051 intptr_t num_methods = sizeof(service_methods_) / 4137 intptr_t num_methods = sizeof(service_methods_) /
4052 sizeof(service_methods_[0]); 4138 sizeof(service_methods_[0]);
4053 for (intptr_t i = 0; i < num_methods; i++) { 4139 for (intptr_t i = 0; i < num_methods; i++) {
4054 const ServiceMethodDescriptor& method = service_methods_[i]; 4140 const ServiceMethodDescriptor& method = service_methods_[i];
4055 if (strcmp(method_name, method.name) == 0) { 4141 if (strcmp(method_name, method.name) == 0) {
4056 return &method; 4142 return &method;
4057 } 4143 }
4058 } 4144 }
4059 return NULL; 4145 return NULL;
4060 } 4146 }
4061 4147
4062 #endif // !PRODUCT 4148 #endif // !PRODUCT
4063 4149
4064 } // namespace dart 4150 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service_isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698