diff options
author | Steve Block <steveblock@google.com> | 2010-01-20 04:51:13 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-01-20 04:51:13 -0800 |
commit | 906bb9eeafd2cfb6a3d3d39f43a4a3167d1fda1a (patch) | |
tree | 5da488353cfc1c1974fe3e0040d9fa4ea161886e /WebCore | |
parent | f94c3ecac24651c15569bdca42b311d0fc971861 (diff) | |
parent | 0cfc2e19eeb90d6897b190b056e192bc1afd5c44 (diff) | |
download | external_webkit-906bb9eeafd2cfb6a3d3d39f43a4a3167d1fda1a.zip external_webkit-906bb9eeafd2cfb6a3d3d39f43a4a3167d1fda1a.tar.gz external_webkit-906bb9eeafd2cfb6a3d3d39f43a4a3167d1fda1a.tar.bz2 |
am 0cfc2e19: am 315ee382: Merge "Cherry-pick WebKit change 53489 to fix style in JavaClassJSC." into eclair-mr2
Merge commit '0cfc2e19eeb90d6897b190b056e192bc1afd5c44'
* commit '0cfc2e19eeb90d6897b190b056e192bc1afd5c44':
Cherry-pick WebKit change 53489 to fix style in JavaClassJSC.
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/ChangeLog | 12 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaClassJSC.cpp | 71 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaClassJSC.h | 24 |
3 files changed, 60 insertions, 47 deletions
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index c7fa692..1a25ff5 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2010-01-19 Steve Block <steveblock@google.com> + + Reviewed by David Levin. + + Fixes style in WebCore/bridge/jni/jsc/JavaClassJSC + https://bugs.webkit.org/show_bug.cgi?id=33819 + + No new tests, style fixes only. + + * bridge/jni/jsc/JavaClassJSC.cpp: Modified. + * bridge/jni/jsc/JavaClassJSC.h: Modified. + 2010-01-18 Steve Block <steveblock@google.com> Reviewed by Adam Barth. diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp index b242cff..c003255 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -29,39 +29,39 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "JSDOMWindow.h" +#include "jni_runtime.h" +#include "jni_utility.h" #include <runtime/Identifier.h> #include <runtime/JSLock.h> -#include "jni_utility.h" -#include "jni_runtime.h" using namespace JSC::Bindings; JavaClass::JavaClass(jobject anInstance) { jobject aClass = callJNIMethod<jobject>(anInstance, "getClass", "()Ljava/lang/Class;"); - + if (!aClass) { fprintf(stderr, "%s: unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance); return; } - + jstring className = (jstring)callJNIMethod<jobject>(aClass, "getName", "()Ljava/lang/String;"); - const char *classNameC = getCharactersFromJString(className); - _name = strdup(classNameC); + const char* classNameC = getCharactersFromJString(className); + m_name = strdup(classNameC); releaseCharactersForJString(className, classNameC); int i; - JNIEnv *env = getJNIEnv(); + JNIEnv* env = getJNIEnv(); // Get the fields jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;"); - int numFields = env->GetArrayLength(fields); + int numFields = env->GetArrayLength(fields); for (i = 0; i < numFields; i++) { jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i); - JavaField *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor + JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { JSLock lock(SilenceAssertionsOnly); - _fields.set(((UString)aField->name()).rep(), aField); + m_fields.set(((UString)aField->name()).rep(), aField); } env->DeleteLocalRef(aJField); } @@ -71,75 +71,76 @@ JavaClass::JavaClass(jobject anInstance) int numMethods = env->GetArrayLength(methods); for (i = 0; i < numMethods; i++) { jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i); - JavaMethod *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor + JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor MethodList* methodList; { JSLock lock(SilenceAssertionsOnly); - methodList = _methods.get(((UString)aMethod->name()).rep()); + methodList = m_methods.get(((UString)aMethod->name()).rep()); if (!methodList) { methodList = new MethodList(); - _methods.set(((UString)aMethod->name()).rep(), methodList); + m_methods.set(((UString)aMethod->name()).rep(), methodList); } } methodList->append(aMethod); env->DeleteLocalRef(aJMethod); - } + } env->DeleteLocalRef(fields); env->DeleteLocalRef(methods); env->DeleteLocalRef(aClass); } -JavaClass::~JavaClass() { - free((void *)_name); +JavaClass::~JavaClass() +{ + free(const_cast<char*>(m_name)); JSLock lock(SilenceAssertionsOnly); - deleteAllValues(_fields); - _fields.clear(); + deleteAllValues(m_fields); + m_fields.clear(); - MethodListMap::const_iterator end = _methods.end(); - for (MethodListMap::const_iterator it = _methods.begin(); it != end; ++it) { + MethodListMap::const_iterator end = m_methods.end(); + for (MethodListMap::const_iterator it = m_methods.begin(); it != end; ++it) { const MethodList* methodList = it->second; deleteAllValues(*methodList); delete methodList; } - _methods.clear(); + m_methods.clear(); } MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const { - MethodList *methodList = _methods.get(identifier.ustring().rep()); - + MethodList* methodList = m_methods.get(identifier.ustring().rep()); + if (methodList) return *methodList; return MethodList(); } -Field *JavaClass::fieldNamed(const Identifier& identifier, Instance*) const +Field* JavaClass::fieldNamed(const Identifier& identifier, Instance*) const { - return _fields.get(identifier.ustring().rep()); + return m_fields.get(identifier.ustring().rep()); } bool JavaClass::isNumberClass() const { - return ((strcmp(_name, "java.lang.Byte") == 0 || - strcmp(_name, "java.lang.Short") == 0 || - strcmp(_name, "java.lang.Integer") == 0 || - strcmp(_name, "java.lang.Long") == 0 || - strcmp(_name, "java.lang.Float") == 0 || - strcmp(_name, "java.lang.Double") == 0) ); + return (!strcmp(m_name, "java.lang.Byte") + || !strcmp(m_name, "java.lang.Short") + || !strcmp(m_name, "java.lang.Integer") + || !strcmp(m_name, "java.lang.Long") + || !strcmp(m_name, "java.lang.Float") + || !strcmp(m_name, "java.lang.Double")); } bool JavaClass::isBooleanClass() const { - return strcmp(_name, "java.lang.Boolean") == 0; + return !strcmp(m_name, "java.lang.Boolean"); } bool JavaClass::isStringClass() const { - return strcmp(_name, "java.lang.String") == 0; + return !strcmp(m_name, "java.lang.String"); } #endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.h b/WebCore/bridge/jni/jsc/JavaClassJSC.h index cbf7160..0c5983c 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.h +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef JavaClassJSC_h @@ -28,7 +28,7 @@ #if ENABLE(MAC_JAVA_BRIDGE) -#include <jni_runtime.h> +#include "jni_runtime.h" #include <wtf/HashMap.h> namespace JSC { @@ -37,20 +37,20 @@ namespace Bindings { class JavaClass : public Class { public: - JavaClass (jobject anInstance); - ~JavaClass (); + JavaClass(jobject); + ~JavaClass(); + + virtual MethodList methodsNamed(const Identifier&, Instance*) const; + virtual Field* fieldNamed(const Identifier&, Instance*) const; - virtual MethodList methodsNamed(const Identifier&, Instance* instance) const; - virtual Field *fieldNamed(const Identifier&, Instance* instance) const; - bool isNumberClass() const; bool isBooleanClass() const; bool isStringClass() const; - + private: - const char *_name; - FieldMap _fields; - MethodListMap _methods; + const char* m_name; + FieldMap m_fields; + MethodListMap m_methods; }; } // namespace Bindings |