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

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

Issue 838663003: Make helper functions static to avoid accidental collision and potentially aid optimization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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/object_graph.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 "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(0)); 245 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(0));
246 Service::HandleRootMessage(message); 246 Service::HandleRootMessage(message);
247 } 247 }
248 248
249 249
250 void Service::SetEventMask(uint32_t mask) { 250 void Service::SetEventMask(uint32_t mask) {
251 event_mask_ = mask; 251 event_mask_ = mask;
252 } 252 }
253 253
254 254
255 void SetEventMask(Dart_NativeArguments args) { 255 static void SetEventMask(Dart_NativeArguments args) {
256 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 256 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
257 Isolate* isolate = arguments->isolate(); 257 Isolate* isolate = arguments->isolate();
258 StackZone zone(isolate); 258 StackZone zone(isolate);
259 HANDLESCOPE(isolate); 259 HANDLESCOPE(isolate);
260 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(0)); 260 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(0));
261 Service::SetEventMask(mask.AsTruncatedUint32Value()); 261 Service::SetEventMask(mask.AsTruncatedUint32Value());
262 } 262 }
263 263
264 264
265 // These must be kept in sync with service/constants.dart 265 // These must be kept in sync with service/constants.dart
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 jsobj.AddProperty("eventType", "_Echo"); 809 jsobj.AddProperty("eventType", "_Echo");
810 jsobj.AddProperty("isolate", isolate); 810 jsobj.AddProperty("isolate", isolate);
811 } 811 }
812 const String& message = String::Handle(String::New(js.ToCString())); 812 const String& message = String::Handle(String::New(js.ToCString()));
813 uint8_t data[] = {0, 128, 255}; 813 uint8_t data[] = {0, 128, 255};
814 // TODO(koda): Add 'testing' event family. 814 // TODO(koda): Add 'testing' event family.
815 SendEvent(kEventFamilyDebug, message, data, sizeof(data)); 815 SendEvent(kEventFamilyDebug, message, data, sizeof(data));
816 } 816 }
817 817
818 818
819 bool HandleIsolateEcho(Isolate* isolate, JSONStream* js) { 819 static bool HandleIsolateEcho(Isolate* isolate, JSONStream* js) {
820 JSONObject jsobj(js); 820 JSONObject jsobj(js);
821 jsobj.AddProperty("id", "_echo"); 821 jsobj.AddProperty("id", "_echo");
822 if (js->num_arguments() == 2 && strcmp(js->GetArgument(1), "event") == 0) { 822 if (js->num_arguments() == 2 && strcmp(js->GetArgument(1), "event") == 0) {
823 Service::SendEchoEvent(isolate); 823 Service::SendEchoEvent(isolate);
824 } 824 }
825 return HandleCommonEcho(&jsobj, js); 825 return HandleCommonEcho(&jsobj, js);
826 } 826 }
827 827
828 828
829 // Print an error message if there is no ID argument. 829 // Print an error message if there is no ID argument.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 if (end_ptr == s) { 903 if (end_ptr == s) {
904 // String was not advanced at all, cannot be valid. 904 // String was not advanced at all, cannot be valid.
905 return false; 905 return false;
906 } 906 }
907 *id = r; 907 *id = r;
908 return true; 908 return true;
909 } 909 }
910 910
911 // Scans the string until the '-' character. Returns pointer to string 911 // Scans the string until the '-' character. Returns pointer to string
912 // at '-' character. Returns NULL if not found. 912 // at '-' character. Returns NULL if not found.
913 const char* ScanUntilDash(const char* s) { 913 static const char* ScanUntilDash(const char* s) {
914 if ((s == NULL) || (*s == '\0')) { 914 if ((s == NULL) || (*s == '\0')) {
915 // Empty string. 915 // Empty string.
916 return NULL; 916 return NULL;
917 } 917 }
918 while (*s != '\0') { 918 while (*s != '\0') {
919 if (*s == '-') { 919 if (*s == '-') {
920 return s; 920 return s;
921 } 921 }
922 s++; 922 s++;
923 } 923 }
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 while (current != NULL) { 2780 while (current != NULL) {
2781 if (strcmp(name, current->name()) == 0) { 2781 if (strcmp(name, current->name()) == 0) {
2782 return current; 2782 return current;
2783 } 2783 }
2784 current = current->next(); 2784 current = current->next();
2785 } 2785 }
2786 return NULL; 2786 return NULL;
2787 } 2787 }
2788 2788
2789 } // namespace dart 2789 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698