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

Unified Diff: samples/android_sample/jni/resource.h

Issue 11467028: Migrate files to embedder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review fixes Created 7 years, 11 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 | « samples/android_sample/jni/main.cc ('k') | samples/android_sample/jni/sound_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/android_sample/jni/resource.h
diff --git a/samples/android_sample/jni/resource.h b/samples/android_sample/jni/resource.h
deleted file mode 100644
index eeec42410a824d55d81c31295f65e46285d29074..0000000000000000000000000000000000000000
--- a/samples/android_sample/jni/resource.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifndef RESOURCE_H
-#define RESOURCE_H
-
-#include <android_native_app_glue.h>
-
-#include "jni/log.h"
-
-class Resource {
- public:
- Resource(android_app* application, const char* path)
- : asset_manager_(application->activity->assetManager),
- path_(path),
- asset_(NULL),
- descriptor_(-1),
- start_(0),
- length_(0) {
- }
-
- const char* path() {
- return path_;
- }
-
- int32_t descriptor() {
- return descriptor_;
- }
-
- off_t start() {
- return start_;
- }
-
- off_t length() {
- return length_;
- }
-
- int32_t open() {
- asset_ = AAssetManager_open(asset_manager_, path_, AASSET_MODE_UNKNOWN);
- if (asset_ != NULL) {
- descriptor_ = AAsset_openFileDescriptor(asset_, &start_, &length_);
- LOGI("%s has start %d, length %d, fd %d",
- path_, start_, length_, descriptor_);
- return 0;
- }
- return -1;
- }
-
- void close() {
- if (asset_ != NULL) {
- AAsset_close(asset_);
- asset_ = NULL;
- }
- }
-
- int32_t read(void* buffer, size_t count) {
- int32_t actual = AAsset_read(asset_, buffer, count);
- return (actual == count) ? 0 : -1;
- }
-
- private:
- const char* path_;
- AAssetManager* asset_manager_;
- AAsset* asset_;
- int32_t descriptor_;
- off_t start_;
- off_t length_;
-};
-
-#endif
« no previous file with comments | « samples/android_sample/jni/main.cc ('k') | samples/android_sample/jni/sound_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698