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

Side by Side Diff: base/debug/trace_event_impl.cc

Issue 443523003: Remove TraceOptions string based constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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 | « base/debug/trace_event_impl.h ('k') | base/debug/trace_event_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 977
978 TraceBucketData::~TraceBucketData() { 978 TraceBucketData::~TraceBucketData() {
979 } 979 }
980 980
981 //////////////////////////////////////////////////////////////////////////////// 981 ////////////////////////////////////////////////////////////////////////////////
982 // 982 //
983 // TraceOptions 983 // TraceOptions
984 // 984 //
985 //////////////////////////////////////////////////////////////////////////////// 985 ////////////////////////////////////////////////////////////////////////////////
986 986
987 TraceOptions::TraceOptions(const std::string& options_string) 987 bool TraceOptions::SetFromString(const std::string& options_string) {
988 : record_mode(RECORD_UNTIL_FULL), 988 record_mode = RECORD_UNTIL_FULL;
989 enable_sampling(false), 989 enable_sampling = false;
990 enable_systrace(false) { 990 enable_systrace = false;
991
991 std::vector<std::string> split; 992 std::vector<std::string> split;
992 std::vector<std::string>::iterator iter; 993 std::vector<std::string>::iterator iter;
993
994 base::SplitString(options_string, ',', &split); 994 base::SplitString(options_string, ',', &split);
995 for (iter = split.begin(); iter != split.end(); ++iter) { 995 for (iter = split.begin(); iter != split.end(); ++iter) {
996 if (*iter == kRecordUntilFull) { 996 if (*iter == kRecordUntilFull) {
997 record_mode = RECORD_UNTIL_FULL; 997 record_mode = RECORD_UNTIL_FULL;
998 } else if (*iter == kRecordContinuously) { 998 } else if (*iter == kRecordContinuously) {
999 record_mode = RECORD_CONTINUOUSLY; 999 record_mode = RECORD_CONTINUOUSLY;
1000 } else if (*iter == kTraceToConsole) { 1000 } else if (*iter == kTraceToConsole) {
1001 record_mode = ECHO_TO_CONSOLE; 1001 record_mode = ECHO_TO_CONSOLE;
1002 } else if (*iter == kRecordAsMuchAsPossible) { 1002 } else if (*iter == kRecordAsMuchAsPossible) {
1003 record_mode = RECORD_AS_MUCH_AS_POSSIBLE; 1003 record_mode = RECORD_AS_MUCH_AS_POSSIBLE;
1004 } else if (*iter == kEnableSampling) { 1004 } else if (*iter == kEnableSampling) {
1005 enable_sampling = true; 1005 enable_sampling = true;
1006 } else if (*iter == kEnableSystrace) { 1006 } else if (*iter == kEnableSystrace) {
1007 enable_systrace = true; 1007 enable_systrace = true;
1008 } else { 1008 } else {
1009 NOTREACHED(); 1009 return false;
1010 } 1010 }
1011 } 1011 }
1012 return true;
1012 } 1013 }
1013 1014
1014 std::string TraceOptions::ToString() const { 1015 std::string TraceOptions::ToString() const {
1015 std::string ret; 1016 std::string ret;
1016 switch (record_mode) { 1017 switch (record_mode) {
1017 case RECORD_UNTIL_FULL: 1018 case RECORD_UNTIL_FULL:
1018 ret = kRecordUntilFull; 1019 ret = kRecordUntilFull;
1019 break; 1020 break;
1020 case RECORD_CONTINUOUSLY: 1021 case RECORD_CONTINUOUSLY:
1021 ret = kRecordContinuously; 1022 ret = kRecordContinuously;
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 } 2562 }
2562 2563
2563 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 2564 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
2564 if (*category_group_enabled_) { 2565 if (*category_group_enabled_) {
2565 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, 2566 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_,
2566 name_, event_handle_); 2567 name_, event_handle_);
2567 } 2568 }
2568 } 2569 }
2569 2570
2570 } // namespace trace_event_internal 2571 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/debug/trace_event_impl.h ('k') | base/debug/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698