Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
c8dcec92
Kaydet (Commit)
c8dcec92
authored
Eki 21, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: remove the native DirectBufferAllocator
Change-Id: I41d25d288253f1b35c268ba70b8384812fa567e5
üst
03089170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
74 deletions
+5
-74
DirectBufferAllocator.java
...tstrap/src/org/libreoffice/kit/DirectBufferAllocator.java
+5
-46
lokandroid.cxx
desktop/source/lib/lokandroid.cxx
+0
-28
No files found.
android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java
Dosyayı görüntüle @
c8dcec92
...
@@ -5,14 +5,12 @@
...
@@ -5,14 +5,12 @@
package
org
.
libreoffice
.
kit
;
package
org
.
libreoffice
.
kit
;
//
// We must manually allocate direct buffers in JNI to work around a bug where Honeycomb's
// ByteBuffer.allocateDirect() grossly overallocates the direct buffer size.
// https://code.google.com/p/android/issues/detail?id=16941
//
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
/**
* This is the common code for allocation and freeing of memory. For this direct ByteBuffer is used but
* in the past it was possible to use a JNI version of allocation because of a bug in old Android version.
*/
public
final
class
DirectBufferAllocator
{
public
final
class
DirectBufferAllocator
{
private
static
final
String
LOGTAG
=
DirectBufferAllocator
.
class
.
getSimpleName
();
private
static
final
String
LOGTAG
=
DirectBufferAllocator
.
class
.
getSimpleName
();
...
@@ -20,46 +18,7 @@ public final class DirectBufferAllocator {
...
@@ -20,46 +18,7 @@ public final class DirectBufferAllocator {
private
DirectBufferAllocator
()
{
private
DirectBufferAllocator
()
{
}
}
private
static
native
ByteBuffer
allocateDirectBufferNative
(
int
size
);
private
static
native
void
freeDirectBufferNative
(
ByteBuffer
aBuffer
);
public
static
ByteBuffer
allocate
(
int
size
)
{
public
static
ByteBuffer
allocate
(
int
size
)
{
return
allocateVM
(
size
);
}
public
static
ByteBuffer
free
(
ByteBuffer
buffer
)
{
return
freeVM
(
buffer
);
}
private
static
ByteBuffer
allocateJNI
(
int
size
)
{
ByteBuffer
directBuffer
=
allocateDirectBufferNative
(
size
);
if
(
directBuffer
==
null
)
{
if
(
size
<=
0
)
{
throw
new
IllegalArgumentException
(
"Invalid allocation size: "
+
size
);
}
else
{
throw
new
OutOfMemoryError
(
"allocateDirectBuffer() returned null"
);
}
}
else
if
(!
directBuffer
.
isDirect
())
{
throw
new
AssertionError
(
"allocateDirectBuffer() did not return a direct buffer"
);
}
return
directBuffer
;
}
private
static
ByteBuffer
freeJNI
(
ByteBuffer
buffer
)
{
if
(
buffer
==
null
)
{
return
null
;
}
if
(!
buffer
.
isDirect
())
{
throw
new
IllegalArgumentException
(
"ByteBuffer must be direct"
);
}
freeDirectBufferNative
(
buffer
);
return
null
;
}
private
static
ByteBuffer
allocateVM
(
int
size
)
{
ByteBuffer
directBuffer
=
ByteBuffer
.
allocateDirect
(
size
);
ByteBuffer
directBuffer
=
ByteBuffer
.
allocateDirect
(
size
);
if
(
directBuffer
==
null
)
{
if
(
directBuffer
==
null
)
{
if
(
size
<=
0
)
{
if
(
size
<=
0
)
{
...
@@ -74,7 +33,7 @@ public final class DirectBufferAllocator {
...
@@ -74,7 +33,7 @@ public final class DirectBufferAllocator {
return
directBuffer
;
return
directBuffer
;
}
}
p
rivate
static
ByteBuffer
freeVM
(
ByteBuffer
buffer
)
{
p
ublic
static
ByteBuffer
free
(
ByteBuffer
buffer
)
{
if
(
buffer
==
null
)
{
if
(
buffer
==
null
)
{
return
null
;
return
null
;
}
}
...
...
desktop/source/lib/lokandroid.cxx
Dosyayı görüntüle @
c8dcec92
...
@@ -316,32 +316,4 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_resetSe
...
@@ -316,32 +316,4 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_resetSe
pDocument
->
pClass
->
resetSelection
(
pDocument
);
pDocument
->
pClass
->
resetSelection
(
pDocument
);
}
}
/* DirectBufferAllocator */
extern
"C"
SAL_JNI_EXPORT
jobject
JNICALL
Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative
(
JNIEnv
*
pEnv
,
jclass
/*aClass*/
,
jint
nSize
)
{
jobject
aBuffer
=
NULL
;
if
(
nSize
>
0
)
{
void
*
pMemory
=
malloc
(
nSize
);
if
(
pMemory
!=
NULL
)
{
aBuffer
=
pEnv
->
NewDirectByteBuffer
(
pMemory
,
nSize
);
if
(
aBuffer
==
NULL
)
{
free
(
pMemory
);
}
}
}
return
aBuffer
;
}
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_kit_DirectBufferAllocator_freeDirectBufferNative
(
JNIEnv
*
pEnv
,
jclass
,
jobject
aBuffer
)
{
free
(
pEnv
->
GetDirectBufferAddress
(
aBuffer
));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment