Merge "Syncronize pdfium initialization between users." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9594487548
@@ -51,22 +51,22 @@ static struct {
|
|||||||
jfieldID bottom;
|
jfieldID bottom;
|
||||||
} gRectClassInfo;
|
} gRectClassInfo;
|
||||||
|
|
||||||
static Mutex sLock;
|
// Also used in PdfRenderer.cpp
|
||||||
|
Mutex sPdfiumLock;
|
||||||
static int sUnmatchedInitRequestCount = 0;
|
int sUnmatchedPdfiumInitRequestCount = 0;
|
||||||
|
|
||||||
static void initializeLibraryIfNeeded() {
|
static void initializeLibraryIfNeeded() {
|
||||||
Mutex::Autolock _l(sLock);
|
Mutex::Autolock _l(sPdfiumLock);
|
||||||
if (sUnmatchedInitRequestCount == 0) {
|
if (sUnmatchedPdfiumInitRequestCount == 0) {
|
||||||
FPDF_InitLibrary();
|
FPDF_InitLibrary();
|
||||||
}
|
}
|
||||||
sUnmatchedInitRequestCount++;
|
sUnmatchedPdfiumInitRequestCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyLibraryIfNeeded() {
|
static void destroyLibraryIfNeeded() {
|
||||||
Mutex::Autolock _l(sLock);
|
Mutex::Autolock _l(sPdfiumLock);
|
||||||
sUnmatchedInitRequestCount--;
|
sUnmatchedPdfiumInitRequestCount--;
|
||||||
if (sUnmatchedInitRequestCount == 0) {
|
if (sUnmatchedPdfiumInitRequestCount == 0) {
|
||||||
FPDF_DestroyLibrary();
|
FPDF_DestroyLibrary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,22 +43,22 @@ static struct {
|
|||||||
jfieldID y;
|
jfieldID y;
|
||||||
} gPointClassInfo;
|
} gPointClassInfo;
|
||||||
|
|
||||||
static Mutex sLock;
|
// See PdfEditor.cpp
|
||||||
|
extern Mutex sPdfiumLock;
|
||||||
static int sUnmatchedInitRequestCount = 0;
|
extern int sUnmatchedPdfiumInitRequestCount;
|
||||||
|
|
||||||
static void initializeLibraryIfNeeded() {
|
static void initializeLibraryIfNeeded() {
|
||||||
Mutex::Autolock _l(sLock);
|
Mutex::Autolock _l(sPdfiumLock);
|
||||||
if (sUnmatchedInitRequestCount == 0) {
|
if (sUnmatchedPdfiumInitRequestCount == 0) {
|
||||||
FPDF_InitLibrary();
|
FPDF_InitLibrary();
|
||||||
}
|
}
|
||||||
sUnmatchedInitRequestCount++;
|
sUnmatchedPdfiumInitRequestCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyLibraryIfNeeded() {
|
static void destroyLibraryIfNeeded() {
|
||||||
Mutex::Autolock _l(sLock);
|
Mutex::Autolock _l(sPdfiumLock);
|
||||||
sUnmatchedInitRequestCount--;
|
sUnmatchedPdfiumInitRequestCount--;
|
||||||
if (sUnmatchedInitRequestCount == 0) {
|
if (sUnmatchedPdfiumInitRequestCount == 0) {
|
||||||
FPDF_DestroyLibrary();
|
FPDF_DestroyLibrary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user