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

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

Issue 2361183002: Respect setLibraryDebuggable (Closed)
Patch Set: Respect setLibraryDebuggable Created 4 years, 2 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/object.cc ('k') | no next file » | 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
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 235
236 static void PrintInvalidParamError(JSONStream* js, 236 static void PrintInvalidParamError(JSONStream* js,
237 const char* param) { 237 const char* param) {
238 js->PrintError(kInvalidParams, 238 js->PrintError(kInvalidParams,
239 "%s: invalid '%s' parameter: %s", 239 "%s: invalid '%s' parameter: %s",
240 js->method(), param, js->LookupParam(param)); 240 js->method(), param, js->LookupParam(param));
241 } 241 }
242 242
243 243
244 static void PrintIllegalParamError(JSONStream* js,
245 const char* param) {
246 js->PrintError(kInvalidParams,
247 "%s: illegal '%s' parameter: %s",
248 js->method(), param, js->LookupParam(param));
249 }
250
251
244 static void PrintUnrecognizedMethodError(JSONStream* js) { 252 static void PrintUnrecognizedMethodError(JSONStream* js) {
245 js->PrintError(kMethodNotFound, NULL); 253 js->PrintError(kMethodNotFound, NULL);
246 } 254 }
247 255
248 256
249 static void PrintSuccess(JSONStream* js) { 257 static void PrintSuccess(JSONStream* js) {
250 JSONObject jsobj(js); 258 JSONObject jsobj(js);
251 jsobj.AddProperty("type", "Success"); 259 jsobj.AddProperty("type", "Success");
252 } 260 }
253 261
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 3978
3971 static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) { 3979 static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) {
3972 const char* lib_id = js->LookupParam("libraryId"); 3980 const char* lib_id = js->LookupParam("libraryId");
3973 ObjectIdRing::LookupResult lookup_result; 3981 ObjectIdRing::LookupResult lookup_result;
3974 Object& obj = Object::Handle(LookupHeapObject(thread, lib_id, 3982 Object& obj = Object::Handle(LookupHeapObject(thread, lib_id,
3975 &lookup_result)); 3983 &lookup_result));
3976 const bool is_debuggable = 3984 const bool is_debuggable =
3977 BoolParameter::Parse(js->LookupParam("isDebuggable"), false); 3985 BoolParameter::Parse(js->LookupParam("isDebuggable"), false);
3978 if (obj.IsLibrary()) { 3986 if (obj.IsLibrary()) {
3979 const Library& lib = Library::Cast(obj); 3987 const Library& lib = Library::Cast(obj);
3988 if (lib.is_dart_scheme()) {
3989 const String& url = String::Handle(lib.url());
3990 if (url.StartsWith(Symbols::DartSchemePrivate())) {
3991 PrintIllegalParamError(js, "libraryId");
3992 return true;
3993 }
3994 }
3980 lib.set_debuggable(is_debuggable); 3995 lib.set_debuggable(is_debuggable);
3981 PrintSuccess(js); 3996 PrintSuccess(js);
3982 return true; 3997 return true;
3983 } 3998 }
3984 PrintInvalidParamError(js, "libraryId"); 3999 PrintInvalidParamError(js, "libraryId");
3985 return true; 4000 return true;
3986 } 4001 }
3987 4002
3988 4003
3989 static const MethodParameter* set_name_params[] = { 4004 static const MethodParameter* set_name_params[] = {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 if (strcmp(method_name, method.name) == 0) { 4194 if (strcmp(method_name, method.name) == 0) {
4180 return &method; 4195 return &method;
4181 } 4196 }
4182 } 4197 }
4183 return NULL; 4198 return NULL;
4184 } 4199 }
4185 4200
4186 #endif // !PRODUCT 4201 #endif // !PRODUCT
4187 4202
4188 } // namespace dart 4203 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698