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

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

Issue 2755673005: [Android] Trigger native event batching through Feature API (Closed)
Patch Set: Add back "abstract" Created 3 years, 9 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 | « content/browser/android/content_feature_list.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/android/content_feature_list.h"
6
7 #include "base/android/jni_string.h"
8 #include "base/feature_list.h"
9 #include "base/macros.h"
10 #include "jni/ContentFeatureList_jni.h"
11
12 using base::android::ConvertJavaStringToUTF8;
13 using base::android::JavaParamRef;
14
15 namespace content {
16 namespace android {
17
18 namespace {
19
20 // Array of features exposed through the Java ContentFeatureList API. Entries in
21 // this array may either refer to features defined in the header of this file or
22 // in other locations in the code base (e.g. content_features.h).
23 const base::Feature* kFeaturesExposedToJava[] = {
24 &kRequestUnbufferedDispatch,
25 };
26
27 const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) {
28 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) {
29 if (kFeaturesExposedToJava[i]->name == feature_name)
30 return kFeaturesExposedToJava[i];
31 }
32 NOTREACHED() << "Queried feature cannot be found in ContentFeatureList: "
33 << feature_name;
34 return nullptr;
35 }
36
37 } // namespace
38
39 // Alphabetical:
40 const base::Feature kRequestUnbufferedDispatch{
41 "RequestUnbufferedDispatch", base::FEATURE_DISABLED_BY_DEFAULT};
42
43 static jboolean IsEnabled(JNIEnv* env,
44 const JavaParamRef<jclass>& clazz,
45 const JavaParamRef<jstring>& jfeature_name) {
46 const base::Feature* feature =
47 FindFeatureExposedToJava(ConvertJavaStringToUTF8(env, jfeature_name));
48 return base::FeatureList::IsEnabled(*feature);
49 }
50
51 bool RegisterContentFeatureListJni(JNIEnv* env) {
52 return RegisterNativesImpl(env);
53 }
54
55 } // namespace android
56 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_feature_list.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698