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

Unified Diff: android_webview/native/aw_assets.cc

Issue 937863003: Add AwAssets into android_webview/native/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just move aw_assets to public totally Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/native/aw_assets.h ('k') | android_webview/native/aw_media_url_interceptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_assets.cc
diff --git a/android_webview/native/aw_assets.cc b/android_webview/native/aw_assets.cc
deleted file mode 100644
index ba734ae3971ceab84ae4a0f633c38e3805802368..0000000000000000000000000000000000000000
--- a/android_webview/native/aw_assets.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <jni.h>
-
-#include "android_webview/native/aw_assets.h"
-
-#include "base/android/jni_array.h"
-#include "base/android/jni_string.h"
-#include "base/android/scoped_java_ref.h"
-#include "jni/AwAssets_jni.h"
-
-namespace android_webview {
-namespace AwAssets {
-
-bool OpenAsset(const std::string& filename,
- int* fd,
- int64* offset,
- int64* size) {
- JNIEnv* env = base::android::AttachCurrentThread();
- ScopedJavaLocalRef<jlongArray> jarr = Java_AwAssets_openAsset(
- env,
- base::android::GetApplicationContext(),
- base::android::ConvertUTF8ToJavaString(env, filename).Release());
- std::vector<jlong> results;
- base::android::JavaLongArrayToLongVector(env, jarr.obj(), &results);
- DCHECK_EQ(3U, results.size());
- *fd = static_cast<int>(results[0]);
- *offset = results[1];
- *size = results[2];
- return *fd != -1;
-}
-
-bool RegisterAssetWithGlobalDescriptors(base::GlobalDescriptors::Key key,
- const std::string& asset_filename) {
- int asset_fd = 0;
- int64 asset_off = 0;
- int64 asset_len = 0;
- bool result =
- AwAssets::OpenAsset(asset_filename, &asset_fd, &asset_off, &asset_len);
- if (result) {
- base::GlobalDescriptors::GetInstance()->Set(
- key, asset_fd, base::MemoryMappedFile::Region(asset_off, asset_len));
- }
- return result;
-}
-
-} // namespace AwAssets
-
-bool RegisterAwAssets(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-} // namespace android_webview
« no previous file with comments | « android_webview/native/aw_assets.h ('k') | android_webview/native/aw_media_url_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698