Fix windows build by not using strcasestr (issue 1692743003 by johnmccutchan@google.com)

391 views
Skip to first unread message

johnmc...@google.com

unread,
Feb 12, 2016, 5:01:51 PM2/12/16
to turn...@google.com, rev...@dartlang.org, turn...@google.com, rma...@google.com, vm-...@dartlang.org
Reviewers: turnidge
CL: https://codereview.chromium.org/1692743003/

Message:
TBR

Description:
Fix windows build by not using strcasestr

- Also fix no_support_timeline test.

Base URL: g...@github.com:dart-lang/sdk.git@master

Affected files (+18, -6 lines):
  M runtime/vm/service.cc
  M runtime/vm/timeline.cc


Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index ed5e89da31614cc00b06de8bfdcb0d31a1dd32db..c8912eb48c240e41cc2a646e40a21cbc6536d69c 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2878,8 +2878,8 @@ static const MethodParameter* set_vm_timeline_flags_params[] = {
 
 static bool HasStream(const char** recorded_streams, const char* stream) {
   while (*recorded_streams != NULL) {
-    if ((strcasestr(*recorded_streams, "all") != NULL) ||
-        (strcasestr(*recorded_streams, stream) != NULL)) {
+    if ((strstr(*recorded_streams, "all") != NULL) ||
+        (strstr(*recorded_streams, stream) != NULL)) {
       return true;
     }
     recorded_streams++;
@@ -2889,6 +2889,10 @@ static bool HasStream(const char** recorded_streams, const char* stream) {
 
 
 static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
+  if (!FLAG_support_timeline) {
+    PrintSuccess(js);
+    return true;
+  }
   Isolate* isolate = thread->isolate();
   ASSERT(isolate != NULL);
   StackZone zone(thread);
@@ -2919,6 +2923,11 @@ static const MethodParameter* get_vm_timeline_flags_params[] = {
 
 
 static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) {
+  if (!FLAG_support_timeline) {
+    JSONObject obj(js);
+    obj.AddProperty("type", "TimelineFlags");
+    return true;
+  }
   Isolate* isolate = thread->isolate();
   ASSERT(isolate != NULL);
   StackZone zone(thread);
Index: runtime/vm/timeline.cc
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index 43dd5656747684370b791bced2d27e2e3159fa23..be86154914c57b0f843030abd81bd19e5abb0456 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -29,8 +29,8 @@ DEFINE_FLAG(charp, timeline_dir, NULL,
             "into specified directory.");
 DEFINE_FLAG(charp, timeline_streams, NULL,
             "Comma separated list of timeline streams to record. "
-            "Valid values: all, api, compiler, dart, debugger, embedder, "
-            "gc, isolate, and vm.");
+            "Valid values: all, API, Compiler, Dart, Debugger, Embedder, "
+            "GC, Isolate, and VM.");
 
 // Implementation notes:
 //
@@ -115,8 +115,8 @@ static bool HasStream(MallocGrowableArray<char*>* streams, const char* stream) {
   }
   for (intptr_t i = 0; i < streams->length(); i++) {
     const char* checked_stream = (*streams)[i];
-    if ((strcasestr(checked_stream, "all") != NULL) ||
-        (strcasestr(checked_stream, stream) != NULL)) {
+    if ((strstr(checked_stream, "all") != NULL) ||
+        (strstr(checked_stream, stream) != NULL)) {
       return true;
     }
   }
@@ -181,6 +181,9 @@ TimelineEventRecorder* Timeline::recorder() {
 
 
 void Timeline::SetupIsolateStreams(Isolate* isolate) {
+  if (!FLAG_support_timeline) {
+    return;
+  }
 #define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default)                 \
   isolate->Get##name##Stream()->Init(                                          \
       #name,                                                                   \


johnmccutchan@google.com via codereview.chromium.org

unread,
Feb 12, 2016, 5:02:15 PM2/12/16
to turn...@google.com, johnmc...@google.com, rev...@dartlang.org, turn...@google.com, rma...@google.com, vm-...@dartlang.org
Committed patchset #2 (id:20001) manually as
87b1ead8f53ccb25b940250d69a699459ecc9203 (presubmit successful).

https://codereview.chromium.org/1692743003/

turn...@google.com

unread,
Feb 12, 2016, 5:03:20 PM2/12/16
to johnmc...@google.com, rev...@dartlang.org, rma...@google.com, vm-...@dartlang.org
Reply all
Reply to author
Forward
0 new messages