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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.cc

Issue 1054363002: Update DataReductionProxyNetworkDelegate/BypassStats to post tasks safely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR comments Created 5 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 | « no previous file | components/data_reduction_proxy/core/browser/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
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 "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 9 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa ss_stats.h" 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr ics.h"
15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
16 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 16 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
17 #include "jni/DataReductionProxySettings_jni.h" 17 #include "jni/DataReductionProxySettings_jni.h"
18 #include "net/proxy/proxy_server.h" 18 #include "net/proxy/proxy_server.h"
19 19
20 20
21 using base::android::ConvertUTF8ToJavaString; 21 using base::android::ConvertUTF8ToJavaString;
22 using base::android::ScopedJavaLocalRef; 22 using base::android::ScopedJavaLocalRef;
23 using data_reduction_proxy::DataReductionProxyParams; 23 using data_reduction_proxy::DataReductionProxyParams;
24 using data_reduction_proxy::DataReductionProxySettings; 24 using data_reduction_proxy::DataReductionProxySettings;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool DataReductionProxySettingsAndroid::Register(JNIEnv* env) { 106 bool DataReductionProxySettingsAndroid::Register(JNIEnv* env) {
107 return RegisterNativesImpl(env); 107 return RegisterNativesImpl(env);
108 } 108 }
109 109
110 ScopedJavaLocalRef<jlongArray> 110 ScopedJavaLocalRef<jlongArray>
111 DataReductionProxySettingsAndroid::GetDailyContentLengths( 111 DataReductionProxySettingsAndroid::GetDailyContentLengths(
112 JNIEnv* env, const char* pref_name) { 112 JNIEnv* env, const char* pref_name) {
113 jlongArray result = env->NewLongArray( 113 jlongArray result = env->NewLongArray(
114 data_reduction_proxy::kNumDaysInHistory); 114 data_reduction_proxy::kNumDaysInHistory);
115 115
116 DataReductionProxySettings::ContentLengthList lengths = 116 data_reduction_proxy::ContentLengthList lengths =
117 Settings()->GetDailyContentLengths(pref_name); 117 Settings()->GetDailyContentLengths(pref_name);
118 118
119 if (!lengths.empty()) { 119 if (!lengths.empty()) {
120 DCHECK_EQ(lengths.size(), data_reduction_proxy::kNumDaysInHistory); 120 DCHECK_EQ(lengths.size(), data_reduction_proxy::kNumDaysInHistory);
121 env->SetLongArrayRegion(result, 0, lengths.size(), &lengths[0]); 121 env->SetLongArrayRegion(result, 0, lengths.size(), &lengths[0]);
122 return ScopedJavaLocalRef<jlongArray>(env, result); 122 return ScopedJavaLocalRef<jlongArray>(env, result);
123 } 123 }
124 124
125 return ScopedJavaLocalRef<jlongArray>(env, result); 125 return ScopedJavaLocalRef<jlongArray>(env, result);
126 } 126 }
127 127
128 DataReductionProxySettings* DataReductionProxySettingsAndroid::Settings() { 128 DataReductionProxySettings* DataReductionProxySettingsAndroid::Settings() {
129 DataReductionProxySettings* settings = 129 DataReductionProxySettings* settings =
130 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 130 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
131 ProfileManager::GetActiveUserProfile()); 131 ProfileManager::GetActiveUserProfile());
132 DCHECK(settings); 132 DCHECK(settings);
133 return settings; 133 return settings;
134 } 134 }
135 135
136 136
137 // Used by generated jni code. 137 // Used by generated jni code.
138 static jlong Init(JNIEnv* env, jobject obj) { 138 static jlong Init(JNIEnv* env, jobject obj) {
139 return reinterpret_cast<intptr_t>(new DataReductionProxySettingsAndroid()); 139 return reinterpret_cast<intptr_t>(new DataReductionProxySettingsAndroid());
140 } 140 }
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698