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

Side by Side Diff: content/browser/android/tracing_controller_android.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/android/tracing_controller_android.h" 5 #include "content/browser/android/tracing_controller_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!TracingController::GetInstance()->GetCategories( 84 if (!TracingController::GetInstance()->GetCategories(
85 base::Bind(&TracingControllerAndroid::OnKnownCategoriesReceived, 85 base::Bind(&TracingControllerAndroid::OnKnownCategoriesReceived,
86 weak_factory_.GetWeakPtr()))) { 86 weak_factory_.GetWeakPtr()))) {
87 return false; 87 return false;
88 } 88 }
89 return true; 89 return true;
90 } 90 }
91 91
92 void TracingControllerAndroid::OnKnownCategoriesReceived( 92 void TracingControllerAndroid::OnKnownCategoriesReceived(
93 const std::set<std::string>& categories_received) { 93 const std::set<std::string>& categories_received) {
94 scoped_ptr<base::ListValue> category_list(new base::ListValue()); 94 base::ListValue category_list;
95 for (std::set<std::string>::const_iterator it = categories_received.begin(); 95 for (std::set<std::string>::const_iterator it = categories_received.begin();
96 it != categories_received.end(); 96 it != categories_received.end();
97 ++it) { 97 ++it) {
98 category_list->AppendString(*it); 98 category_list.AppendString(*it);
99 } 99 }
100 std::string received_category_list; 100 std::string received_category_list;
101 base::JSONWriter::Write(category_list.get(), &received_category_list); 101 base::JSONWriter::Write(category_list, &received_category_list);
102 102
103 // This log is required by adb_profile_chrome.py. 103 // This log is required by adb_profile_chrome.py.
104 LOG(WARNING) << "{\"traceCategoriesList\": " << received_category_list << "}"; 104 LOG(WARNING) << "{\"traceCategoriesList\": " << received_category_list << "}";
105 } 105 }
106 106
107 static jstring GetDefaultCategories(JNIEnv* env, jobject obj) { 107 static jstring GetDefaultCategories(JNIEnv* env, jobject obj) {
108 return base::android::ConvertUTF8ToJavaString( 108 return base::android::ConvertUTF8ToJavaString(
109 env, 109 env,
110 base::trace_event::CategoryFilter::kDefaultCategoryFilterString) 110 base::trace_event::CategoryFilter::kDefaultCategoryFilterString)
111 .Release(); 111 .Release();
112 } 112 }
113 113
114 bool RegisterTracingControllerAndroid(JNIEnv* env) { 114 bool RegisterTracingControllerAndroid(JNIEnv* env) {
115 return RegisterNativesImpl(env); 115 return RegisterNativesImpl(env);
116 } 116 }
117 117
118 } // namespace content 118 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/devtools/devtools_agent_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698