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

Side by Side Diff: base/android/jni_array.cc

Issue 10696025: Upstream ChildProcessLauncher changes for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add additional assert and comments Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « base/android/jni_array.h ('k') | content/app/android/sandboxed_process_service.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/android/jni_array.h" 5 #include "base/android/jni_array.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/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 void JavaByteArrayToByteVector(JNIEnv* env, 109 void JavaByteArrayToByteVector(JNIEnv* env,
110 jbyteArray byte_array, 110 jbyteArray byte_array,
111 std::vector<uint8>* out) { 111 std::vector<uint8>* out) {
112 DCHECK(out); 112 DCHECK(out);
113 out->clear(); 113 out->clear();
114 AppendJavaByteArrayToByteVector(env, byte_array, out); 114 AppendJavaByteArrayToByteVector(env, byte_array, out);
115 } 115 }
116 116
117 void JavaIntArrayToIntVector(JNIEnv* env,
118 jintArray array,
119 std::vector<int>* out) {
120 DCHECK(out);
121 out->clear();
122 jsize len = env->GetArrayLength(array);
123 jint* ints = env->GetIntArrayElements(array, NULL);
124 for (jsize i = 0; i < len; ++i) {
125 out->push_back(static_cast<int>(ints[i]));
126 }
127 env->ReleaseIntArrayElements(array, ints, JNI_ABORT);
128 }
129
117 } // namespace android 130 } // namespace android
118 } // namespace base 131 } // namespace base
OLDNEW
« no previous file with comments | « base/android/jni_array.h ('k') | content/app/android/sandboxed_process_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698