diff --git a/Osmand-kernel/Makefile.vars b/Osmand-kernel/Makefile.vars
index fe7c07bbf3..45d6f888de 100644
--- a/Osmand-kernel/Makefile.vars
+++ b/Osmand-kernel/Makefile.vars
@@ -1,6 +1,7 @@
-ifeq ($(ARCH),)
+ifndef $(ARCH)
ARCH := x86
endif
+
############################################
############# NACL ### TARGET
ifeq ($(TARGET),nacl)
@@ -26,10 +27,10 @@ CC:=$(TC_PATH)/bin/i686-nacl-gcc
STATICLIB_EXT := a
DYNAMICLIB_EXT := nexe
LIBRARY_PREFIX := lib
-LDFLAGS := -lppapi
+LDFLAGS := -lppapi_cpp -lppapi
GLOBAL_INCLUDES=-I../zlib/zlib_library -I$(TC_PATH)/i686-nacl/usr/include
-RT_NOT_SUPPORTED :=
-ZLIB_BUILD :=
+RT_NOT_SUPPORTED := defined
+ZLIB_BUILD := defined
ifeq ($(ARCH),x86)
CFLAGS += -m32
@@ -83,7 +84,9 @@ RANLIB := i586-mingw32msvc-ranlib
WINDRES := i586-mingw32msvc-windres
AR := i586-mingw32msvc-ar
GLOBAL_INCLUDES := -I../pthread/pthreads_library -I../zlib/zlib_library
-RT_NOT_SUPPORTED := 1
+RT_NOT_SUPPORTED := defined
+ZLIB_BUILD := defined
+PTHREAD_BUILD := defined
COMMONFLAGS := -D_Windows -DXMD_H -DHAVE_BOOLEAN -DRT_NOT_SUPPORTED
CPP_FLAGS := $(COMMONFLAGS)
CFLAGS := -D_JNI_IMPLEMENTATION $(COMMONFLAGS)
diff --git a/Osmand-kernel/osmand/Android.mk b/Osmand-kernel/osmand/Android.mk
index 26209e3b5f..336d8a2e81 100644
--- a/Osmand-kernel/osmand/Android.mk
+++ b/Osmand-kernel/osmand/Android.mk
@@ -11,6 +11,8 @@ LOCAL_MODULE := osmand_neon
LOCAL_ARM_NEON := true
endif
+LOCAL_SRC_FILES += src/java_wrap.cpp
+
LOCAL_CFLAGS := \
-DGOOGLE_PROTOBUF_NO_RTTI \
-DANDROID_BUILD \
diff --git a/Osmand-kernel/osmand/nacl/.gitignore b/Osmand-kernel/osmand/nacl/.gitignore
index e951f656a9..42c9587409 100644
--- a/Osmand-kernel/osmand/nacl/.gitignore
+++ b/Osmand-kernel/osmand/nacl/.gitignore
@@ -1 +1,2 @@
-*.nexe
+osmand-*.nexe
+
diff --git a/Osmand-kernel/osmand/nacl/index.html b/Osmand-kernel/osmand/nacl/index.html
index 6a9139a2ad..47f75e2cd5 100644
--- a/Osmand-kernel/osmand/nacl/index.html
+++ b/Osmand-kernel/osmand/nacl/index.html
@@ -69,11 +69,19 @@
appendToEventLog('abort');
}
- // When the NaCl module has loaded indicate success.
+ var piGenerator = null;
+ var paintInterval = null;
+
+ // Start up the paint timer when the NaCl module has loaded.
function moduleDidLoad() {
loadProgressModule = document.getElementById('load_progress');
appendToEventLog('load');
updateStatus('SUCCESS');
+ piGenerator = document.getElementById('load_progress');
+ paintInterval = setInterval('load_progress.postMessage("paint")', 50);
+ }
+ function pageDidUnload() {
+ clearInterval(paintInterval);
}
// Handler that gets called when the NaCl module loading has completed.
@@ -94,7 +102,8 @@
// Handle a message coming from the NaCl module.
function handleMessage(message_event) {
- alert(message_event.data);
+ // alert(message_event.data);
+ //document.form.pi.value = message_event.data;
}
// Set the global status message. Updates the 'status_field' element with
@@ -195,7 +204,7 @@
-->
diff --git a/Osmand-kernel/osmand/nacl/osmand-x64.nexe b/Osmand-kernel/osmand/nacl/osmand-x64.nexe
deleted file mode 100755
index fc46fabfd7..0000000000
Binary files a/Osmand-kernel/osmand/nacl/osmand-x64.nexe and /dev/null differ
diff --git a/Osmand-kernel/osmand/nacl/osmand-x86.nexe b/Osmand-kernel/osmand/nacl/osmand-x86.nexe
deleted file mode 100755
index b3afd9b836..0000000000
Binary files a/Osmand-kernel/osmand/nacl/osmand-x86.nexe and /dev/null differ
diff --git a/Osmand-kernel/osmand/src/osmand_nacl.cpp b/Osmand-kernel/osmand/src/osmand_nacl.cpp
index e6a2627cf1..ea379979c1 100644
--- a/Osmand-kernel/osmand/src/osmand_nacl.cpp
+++ b/Osmand-kernel/osmand/src/osmand_nacl.cpp
@@ -1,182 +1,266 @@
-/* Copyright (c) 2012 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.
- */
+// Copyright (c) 2012 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.
-/** @file hello_world.c
- * This example demonstrates loading, running and scripting a very simple
- * NaCl module.
- */
#include
#include
-#include
+#include
+#include
+#include
+#include
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/var.h"
+#include
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppb.h"
-#include "ppapi/c/ppb_instance.h"
-#include "ppapi/c/ppb_messaging.h"
-#include "ppapi/c/ppb_var.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/ppp_messaging.h"
+#include "osmand_nacl.h"
-static PPB_Messaging* ppb_messaging_interface = NULL;
-static PPB_Var* ppb_var_interface = NULL;
+namespace {
+const int kPthreadMutexSuccess = 0;
+const char* const kPaintMethodId = "paint";
+const double kInvalidPiValue = -1.0;
+const int kMaxPointCount = 1000000000; // The total number of points to draw.
+const uint32_t kOpaqueColorMask = 0xff000000; // Opaque pixels.
+const uint32_t kRedMask = 0xff0000;
+const uint32_t kBlueMask = 0xff;
+const uint32_t kRedShift = 16;
+const uint32_t kBlueShift = 0;
+// This is called by the browser when the 2D context has been flushed to the
+// browser window.
+void FlushCallback(void* data, int32_t result) {
+ static_cast(data)->set_flush_pending(false);
+}
+} // namespace
-/**
- * Creates new string PP_Var from C string. The resulting object will be a
- * refcounted string object. It will be AddRef()ed for the caller. When the
- * caller is done with it, it should be Release()d.
- * @param[in] str C string to be converted to PP_Var
- * @return PP_Var containing string.
- */
-static struct PP_Var CStrToVar(const char* str) {
- if (ppb_var_interface != NULL) {
- return ppb_var_interface->VarFromUtf8(str, strlen(str));
+namespace osmand {
+
+// A small helper RAII class that implementes a scoped pthread_mutex lock.
+class ScopedMutexLock {
+ public:
+ explicit ScopedMutexLock(pthread_mutex_t* mutex) : mutex_(mutex) {
+ if (pthread_mutex_lock(mutex_) != kPthreadMutexSuccess) {
+ mutex_ = NULL;
+ }
}
- return PP_MakeUndefined();
-}
-
-
-/**
- * Called when the NaCl module is instantiated on the web page. The identifier
- * of the new instance will be passed in as the first argument (this value is
- * generated by the browser and is an opaque handle). This is called for each
- * instantiation of the NaCl module, which is each time the