OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 namespace tracing { | 189 namespace tracing { |
190 | 190 |
191 namespace { | 191 namespace { |
192 | 192 |
193 // String options that can be used to initialize TraceOptions. | 193 // String options that can be used to initialize TraceOptions. |
194 const char kRecordUntilFull[] = "record-until-full"; | 194 const char kRecordUntilFull[] = "record-until-full"; |
195 const char kRecordContinuously[] = "record-continuously"; | 195 const char kRecordContinuously[] = "record-continuously"; |
196 const char kRecordAsMuchAsPossible[] = "record-as-much-as-possible"; | 196 const char kRecordAsMuchAsPossible[] = "record-as-much-as-possible"; |
197 | 197 |
198 const char kRecordModeParam[] = "record_mode"; | 198 const char kRecordModeParam[] = "record_mode"; |
199 const char kEnableSamplingParam[] = "enable_sampling"; | |
200 const char kEnableSystraceParam[] = "enable_systrace"; | 199 const char kEnableSystraceParam[] = "enable_systrace"; |
201 const char kEnableArgumentFilterParam[] = "enable_argument_filter"; | 200 const char kEnableArgumentFilterParam[] = "enable_argument_filter"; |
202 const char kIncludedCategoriesParam[] = "included_categories"; | 201 const char kIncludedCategoriesParam[] = "included_categories"; |
203 const char kExcludedCategoriesParam[] = "excluded_categories"; | 202 const char kExcludedCategoriesParam[] = "excluded_categories"; |
204 | 203 |
205 class TraceConfigParser { | 204 class TraceConfigParser { |
206 public: | 205 public: |
207 static void FillTraceConfig(v8::Isolate* isolate, | 206 static void FillTraceConfig(v8::Isolate* isolate, |
208 platform::tracing::TraceConfig* trace_config, | 207 platform::tracing::TraceConfig* trace_config, |
209 const char* json_str) { | 208 const char* json_str) { |
210 HandleScope outer_scope(isolate); | 209 HandleScope outer_scope(isolate); |
211 Local<Context> context = Context::New(isolate); | 210 Local<Context> context = Context::New(isolate); |
212 Context::Scope context_scope(context); | 211 Context::Scope context_scope(context); |
213 HandleScope inner_scope(isolate); | 212 HandleScope inner_scope(isolate); |
214 | 213 |
215 Local<String> source = | 214 Local<String> source = |
216 String::NewFromUtf8(isolate, json_str, NewStringType::kNormal) | 215 String::NewFromUtf8(isolate, json_str, NewStringType::kNormal) |
217 .ToLocalChecked(); | 216 .ToLocalChecked(); |
218 Local<Value> result = JSON::Parse(context, source).ToLocalChecked(); | 217 Local<Value> result = JSON::Parse(context, source).ToLocalChecked(); |
219 Local<v8::Object> trace_config_object = Local<v8::Object>::Cast(result); | 218 Local<v8::Object> trace_config_object = Local<v8::Object>::Cast(result); |
220 | 219 |
221 trace_config->SetTraceRecordMode( | 220 trace_config->SetTraceRecordMode( |
222 GetTraceRecordMode(isolate, context, trace_config_object)); | 221 GetTraceRecordMode(isolate, context, trace_config_object)); |
223 if (GetBoolean(isolate, context, trace_config_object, | 222 if (GetBoolean(isolate, context, trace_config_object, |
224 kEnableSamplingParam)) { | |
225 trace_config->EnableSampling(); | |
226 } | |
227 if (GetBoolean(isolate, context, trace_config_object, | |
228 kEnableSystraceParam)) { | 223 kEnableSystraceParam)) { |
229 trace_config->EnableSystrace(); | 224 trace_config->EnableSystrace(); |
230 } | 225 } |
231 if (GetBoolean(isolate, context, trace_config_object, | 226 if (GetBoolean(isolate, context, trace_config_object, |
232 kEnableArgumentFilterParam)) { | 227 kEnableArgumentFilterParam)) { |
233 trace_config->EnableArgumentFilter(); | 228 trace_config->EnableArgumentFilter(); |
234 } | 229 } |
235 UpdateCategoriesList(isolate, context, trace_config_object, | 230 UpdateCategoriesList(isolate, context, trace_config_object, |
236 kIncludedCategoriesParam, trace_config); | 231 kIncludedCategoriesParam, trace_config); |
237 UpdateCategoriesList(isolate, context, trace_config_object, | 232 UpdateCategoriesList(isolate, context, trace_config_object, |
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2752 } | 2747 } |
2753 | 2748 |
2754 } // namespace v8 | 2749 } // namespace v8 |
2755 | 2750 |
2756 | 2751 |
2757 #ifndef GOOGLE3 | 2752 #ifndef GOOGLE3 |
2758 int main(int argc, char* argv[]) { | 2753 int main(int argc, char* argv[]) { |
2759 return v8::Shell::Main(argc, argv); | 2754 return v8::Shell::Main(argc, argv); |
2760 } | 2755 } |
2761 #endif | 2756 #endif |
OLD | NEW |