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

Side by Side Diff: components/payments/content/android/payment_manifest_parser_android.cc

Issue 2809193002: Fix crash in release mode of payment manifest parser. (Closed)
Patch Set: Fix crash. 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
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 "components/payments/content/android/payment_manifest_parser_android.h" 5 #include "components/payments/content/android/payment_manifest_parser_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 23 matching lines...) Expand all
34 // Can trigger synchronous deletion of PaymentManifestParserAndroid. 34 // Can trigger synchronous deletion of PaymentManifestParserAndroid.
35 Java_ManifestParseCallback_onManifestParseFailure(env, jcallback_); 35 Java_ManifestParseCallback_onManifestParseFailure(env, jcallback_);
36 return; 36 return;
37 } 37 }
38 38
39 base::android::ScopedJavaLocalRef<jobjectArray> juris = 39 base::android::ScopedJavaLocalRef<jobjectArray> juris =
40 Java_PaymentManifestParser_createWebAppManifestUris( 40 Java_PaymentManifestParser_createWebAppManifestUris(
41 env, web_app_manifest_urls.size()); 41 env, web_app_manifest_urls.size());
42 42
43 for (size_t i = 0; i < web_app_manifest_urls.size(); ++i) { 43 for (size_t i = 0; i < web_app_manifest_urls.size(); ++i) {
44 DCHECK(Java_PaymentManifestParser_addUri( 44 bool is_valid_uri = Java_PaymentManifestParser_addUri(
45 env, juris.obj(), base::checked_cast<int>(i), 45 env, juris.obj(), base::checked_cast<int>(i),
46 base::android::ConvertUTF8ToJavaString( 46 base::android::ConvertUTF8ToJavaString(
47 env, web_app_manifest_urls[i].spec()))); 47 env, web_app_manifest_urls[i].spec()));
48 DCHECK(is_valid_uri);
48 } 49 }
49 50
50 // Can trigger synchronous deletion of PaymentManifestParserAndroid. 51 // Can trigger synchronous deletion of PaymentManifestParserAndroid.
51 Java_ManifestParseCallback_onPaymentMethodManifestParseSuccess( 52 Java_ManifestParseCallback_onPaymentMethodManifestParseSuccess(
52 env, jcallback_, juris.obj()); 53 env, jcallback_, juris.obj());
53 } 54 }
54 55
55 // Copies web app manifest into Java. 56 // Copies web app manifest into Java.
56 void OnWebAppManifestParsed( 57 void OnWebAppManifestParsed(
57 std::vector<mojom::WebAppManifestSectionPtr> manifest) { 58 std::vector<mojom::WebAppManifestSectionPtr> manifest) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 144
144 // Caller owns the result. 145 // Caller owns the result.
145 jlong CreatePaymentManifestParserAndroid( 146 jlong CreatePaymentManifestParserAndroid(
146 JNIEnv* env, 147 JNIEnv* env,
147 const base::android::JavaParamRef<jclass>& jcaller) { 148 const base::android::JavaParamRef<jclass>& jcaller) {
148 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid); 149 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid);
149 } 150 }
150 151
151 } // namespace payments 152 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698