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

Side by Side Diff: src/libplatform/tracing/trace-config.cc

Issue 2558193002: [Tracing] Support multi-categories group list. (Closed)
Patch Set: Add tests Created 4 years 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 | « no previous file | test/cctest/libplatform/test-tracing.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 <string.h> 5 #include <string.h>
6 6
7 #include "include/libplatform/v8-tracing.h" 7 #include "include/libplatform/v8-tracing.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 11
12 class Isolate; 12 class Isolate;
13 13
14 namespace platform { 14 namespace platform {
15 namespace tracing { 15 namespace tracing {
16 16
17 TraceConfig* TraceConfig::CreateDefaultTraceConfig() { 17 TraceConfig* TraceConfig::CreateDefaultTraceConfig() {
18 TraceConfig* trace_config = new TraceConfig(); 18 TraceConfig* trace_config = new TraceConfig();
19 trace_config->included_categories_.push_back("v8"); 19 trace_config->included_categories_.push_back("v8");
20 return trace_config; 20 return trace_config;
21 } 21 }
22 22
23 bool TraceConfig::IsCategoryGroupEnabled(const char* category_group) const { 23 bool TraceConfig::IsCategoryGroupEnabled(const char* category_group) const {
24 for (auto included_category : included_categories_) { 24 std::stringstream category_stream(category_group);
25 if (strcmp(included_category.data(), category_group) == 0) return true; 25 while (category_stream.good()) {
26 std::string category;
27 getline(category_stream, category, ',');
28 for (auto included_category : included_categories_) {
29 if (category == included_category) return true;
30 }
26 } 31 }
27 return false; 32 return false;
28 } 33 }
29 34
30 void TraceConfig::AddIncludedCategory(const char* included_category) { 35 void TraceConfig::AddIncludedCategory(const char* included_category) {
31 DCHECK(included_category != NULL && strlen(included_category) > 0); 36 DCHECK(included_category != NULL && strlen(included_category) > 0);
32 included_categories_.push_back(included_category); 37 included_categories_.push_back(included_category);
33 } 38 }
34 39
35 } // namespace tracing 40 } // namespace tracing
36 } // namespace platform 41 } // namespace platform
37 } // namespace v8 42 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/libplatform/test-tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698