summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-01-21 15:58:20 +0000
committerSteve Block <steveblock@google.com>2010-01-21 18:22:13 +0000
commit54dec9637e20bfba1857f3d54df3c43ce94ff97b (patch)
tree9b58e2b839e3bfa85c54afb017b5c24602da6cd4
parent40c8c4abfc2d689e4aa21c5dfab61ce45e45b38b (diff)
downloadexternal_webkit-54dec9637e20bfba1857f3d54df3c43ce94ff97b.zip
external_webkit-54dec9637e20bfba1857f3d54df3c43ce94ff97b.tar.gz
external_webkit-54dec9637e20bfba1857f3d54df3c43ce94ff97b.tar.bz2
Move V8 jni_npobject to bridge/jni/v8/JavaNPObjectV8 and fix style
Change-Id: Icf99c709929ef14551de61e55780b97767575f01
-rw-r--r--Android.mk1
-rw-r--r--WebCore/Android.v8bindings.mk1
-rw-r--r--WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp2
-rw-r--r--WebCore/bridge/jni/v8/JavaNPObjectV8.cpp (renamed from V8Binding/jni/jni_npobject.cpp)49
-rw-r--r--WebCore/bridge/jni/v8/JavaNPObjectV8.h (renamed from V8Binding/jni/jni_npobject.h)40
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp2
6 files changed, 50 insertions, 45 deletions
diff --git a/Android.mk b/Android.mk
index 6ca9589..8c96e53 100644
--- a/Android.mk
+++ b/Android.mk
@@ -185,7 +185,6 @@ BINDING_C_INCLUDES += \
$(LOCAL_PATH)/bridge/jni \
$(LOCAL_PATH)/bridge/jni/v8
JNI_SRC_FILES := \
- jni_npobject.cpp \
jni_runtime.cpp
WEBKIT_SRC_FILES += $(addprefix $(JNI_PATH)/,$(JNI_SRC_FILES))
endif
diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index 32f5a5a..d5eb37a 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -173,5 +173,6 @@ LOCAL_SRC_FILES += \
LOCAL_SRC_FILES += \
bridge/jni/JNIUtility.cpp \
bridge/jni/v8/JNIUtilityPrivate.cpp \
+ bridge/jni/v8/JavaNPObjectV8.cpp \
bridge/jni/v8/JavaClassV8.cpp \
bridge/jni/v8/JavaInstanceV8.cpp
diff --git a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
index 1d2a029..a817bc0 100644
--- a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
+++ b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "JNIUtilityPrivate.h"
-#include "jni_npobject.h"
+#include "JavaNPObjectV8.h"
#include "jni_runtime.h"
namespace JSC {
diff --git a/V8Binding/jni/jni_npobject.cpp b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
index 2c79fb6..416cc9e 100644
--- a/V8Binding/jni/jni_npobject.cpp
+++ b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
@@ -25,22 +25,22 @@
#include "config.h"
-#include "jni_npobject.h"
+#include "JavaNPObjectV8.h"
#include "JNIUtility.h"
#include "JavaClassV8.h"
#include "JavaInstanceV8.h"
#include "jni_runtime.h"
-// This source file should be in bridge/jni, so it's OK to use the private
-// NPAPI header from here.
#include "npruntime_impl.h"
-namespace JSC { namespace Bindings {
+namespace JSC {
+
+namespace Bindings {
+
static NPObject* AllocJavaNPObject(NPP, NPClass*)
{
- JavaNPObject* obj =
- static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
- if (obj == 0)
+ JavaNPObject* obj = static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
+ if (!obj)
return 0;
bzero(obj, sizeof(JavaNPObject));
return reinterpret_cast<NPObject*>(obj);
@@ -49,7 +49,7 @@ static NPObject* AllocJavaNPObject(NPP, NPClass*)
static void FreeJavaNPObject(NPObject* npobj)
{
JavaNPObject* obj = reinterpret_cast<JavaNPObject*>(npobj);
- obj->_instance = 0; // free does not call the destructor
+ obj->m_instance = 0; // free does not call the destructor
free(obj);
}
@@ -72,7 +72,7 @@ static NPClass JavaNPObjectClass = {
NPObject* JavaInstanceToNPObject(JavaInstance* instance) {
JavaNPObject* object = reinterpret_cast<JavaNPObject*>(_NPN_CreateObject(0, &JavaNPObjectClass));
- object->_instance = instance;
+ object->m_instance = instance;
return reinterpret_cast<NPObject*>(object);
}
@@ -80,17 +80,17 @@ NPObject* JavaInstanceToNPObject(JavaInstance* instance) {
// Returns null if obj is not a wrapper of JavaInstance
JavaInstance* ExtractJavaInstance(NPObject* obj) {
if (obj->_class == &JavaNPObjectClass) {
- return reinterpret_cast<JavaNPObject*>(obj)->_instance.get();
+ return reinterpret_cast<JavaNPObject*>(obj)->m_instance.get();
}
return 0;
}
bool JavaNPObject_HasMethod(NPObject* obj, NPIdentifier identifier) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
@@ -103,13 +103,12 @@ bool JavaNPObject_HasMethod(NPObject* obj, NPIdentifier identifier) {
return result;
}
-bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier identifier,
- const NPVariant* args, uint32_t argCount, NPVariant* result) {
+bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier identifier, const NPVariant* args, uint32_t argCount, NPVariant* result) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
@@ -119,18 +118,17 @@ bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier identifier,
// TODO: use NPN_MemFree
free(name);
return r;
-
}
bool JavaNPObject_HasProperty(NPObject* obj, NPIdentifier identifier) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
- bool result = instance->getClass()->fieldNamed(name) != 0;
+ bool result = instance->getClass()->fieldNamed(name);
instance->end();
free(name);
return result;
@@ -139,10 +137,10 @@ bool JavaNPObject_HasProperty(NPObject* obj, NPIdentifier identifier) {
bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* result) {
VOID_TO_NPVARIANT(*result);
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
@@ -150,9 +148,8 @@ bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier identifier, NPVariant*
instance->end();
free(name); // TODO: use NPN_MemFree
- if (field == 0) {
+ if (!field)
return false;
- }
jvalue value = getJNIField(instance->javaInstance(),
field->getJNIType(),
@@ -164,4 +161,6 @@ bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier identifier, NPVariant*
return true;
}
-}} // namespace
+} // namespace Bindings
+
+} // namespace JSC
diff --git a/V8Binding/jni/jni_npobject.h b/WebCore/bridge/jni/v8/JavaNPObjectV8.h
index 943b661..c36ef70 100644
--- a/V8Binding/jni/jni_npobject.h
+++ b/WebCore/bridge/jni/v8/JavaNPObjectV8.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2009, The Android Open Source Project
+ * Copyright 2010, The Android Open Source Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,30 +23,36 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JNI_NPOBJECT_H_
-#define JNI_NPOBJECT_H_
+#ifndef JavaNPObjectV8_h
+#define JavaNPObjectV8_h
-#include "npruntime.h"
#include "jni_runtime.h"
-
-#include <wtf/RefPtr.h>
+#include "npruntime.h"
#include <JavaVM/jni.h>
+#include <wtf/RefPtr.h>
-namespace JSC { namespace Bindings {
+
+namespace JSC {
+
+namespace Bindings {
+
+class JavaInstance;
struct JavaNPObject {
- NPObject _object;
- RefPtr<JavaInstance> _instance;
+ NPObject m_object;
+ RefPtr<JavaInstance> m_instance;
};
-NPObject* JavaInstanceToNPObject(JavaInstance* instance);
-JavaInstance* ExtractJavaInstance(NPObject* obj);
+NPObject* JavaInstanceToNPObject(JavaInstance*);
+JavaInstance* ExtractJavaInstance(NPObject*);
+
+bool JavaNPObject_HasMethod(NPObject*, NPIdentifier name);
+bool JavaNPObject_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result);
+bool JavaNPObject_HasProperty(NPObject*, NPIdentifier name);
+bool JavaNPObject_GetProperty(NPObject*, NPIdentifier name, NPVariant* result);
-bool JavaNPObject_HasMethod(NPObject* obj, NPIdentifier name);
-bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result);
-bool JavaNPObject_HasProperty(NPObject* obj, NPIdentifier name);
-bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier name, NPVariant* ressult);
+} // namespace Bindings
-} }
+} // namespace JSC
-#endif JNI_NPOBJECT_H_
+#endif // JavaNPObjectV8_h
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 5c52d3c..6f11487 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -66,7 +66,7 @@
#include "JSDOMWindow.h"
#include <runtime/JSLock.h>
#elif USE(V8)
-#include "jni_npobject.h"
+#include "JavaNPObjectV8.h"
#include "JavaInstanceV8.h"
#endif // USE(JSC)