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

Side by Side Diff: chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.cc

Issue 2780983003: Reland: Avoid calling strlen() where possible in base/trace_config (Closed)
Patch Set: Created 3 years, 8 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/trace_event/trace_event_etw_export_win.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h" 5 #include "chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "components/arc/arc_bridge_service.h" 10 #include "components/arc/arc_bridge_service.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!tracing_instance) { 76 if (!tracing_instance) {
77 // Use PostTask as the convention of TracingAgent. The caller expects 77 // Use PostTask as the convention of TracingAgent. The caller expects
78 // callback to be called after this function returns. 78 // callback to be called after this function returns.
79 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 79 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
80 base::Bind(callback, false)); 80 base::Bind(callback, false));
81 return; 81 return;
82 } 82 }
83 83
84 std::vector<std::string> selected_categories; 84 std::vector<std::string> selected_categories;
85 for (const auto& category : categories_) { 85 for (const auto& category : categories_) {
86 if (trace_config.IsCategoryGroupEnabled(category.full_name.c_str())) 86 if (trace_config.IsCategoryGroupEnabled(category.full_name))
87 selected_categories.push_back(category.name); 87 selected_categories.push_back(category.name);
88 } 88 }
89 89
90 tracing_instance->StartTracing(selected_categories, callback); 90 tracing_instance->StartTracing(selected_categories, callback);
91 } 91 }
92 92
93 void ArcTracingBridge::StopTracing(const StopTracingCallback& callback) { 93 void ArcTracingBridge::StopTracing(const StopTracingCallback& callback) {
94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
95 95
96 mojom::TracingInstance* tracing_instance = 96 mojom::TracingInstance* tracing_instance =
97 ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->tracing(), StopTracing); 97 ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->tracing(), StopTracing);
98 if (!tracing_instance) { 98 if (!tracing_instance) {
99 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 99 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
100 base::Bind(callback, false)); 100 base::Bind(callback, false));
101 return; 101 return;
102 } 102 }
103 tracing_instance->StopTracing(callback); 103 tracing_instance->StopTracing(callback);
104 } 104 }
105 105
106 } // namespace arc 106 } // namespace arc
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_etw_export_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698