diff options
author | Iain Merrick <husky@google.com> | 2010-08-19 17:55:56 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-08-23 11:05:40 +0100 |
commit | f486d19d62f1bc33246748b14b14a9dfa617b57f (patch) | |
tree | 195485454c93125455a30e553a73981c3816144d /WebCore/bridge | |
parent | 6ba0b43722d16bc295606bec39f396f596e4fef1 (diff) | |
download | external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2 |
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebCore/bridge')
-rw-r--r-- | WebCore/bridge/IdentifierRep.cpp | 4 | ||||
-rw-r--r-- | WebCore/bridge/NP_jsobject.cpp | 2 | ||||
-rw-r--r-- | WebCore/bridge/c/c_class.cpp | 12 | ||||
-rw-r--r-- | WebCore/bridge/c/c_utility.cpp | 2 | ||||
-rw-r--r-- | WebCore/bridge/jni/JNIBridge.cpp | 8 | ||||
-rw-r--r-- | WebCore/bridge/jni/JNIBridge.h | 6 | ||||
-rw-r--r-- | WebCore/bridge/jni/jni_jsobject.mm | 14 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 6 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JNIBridgeJSC.h | 2 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp | 12 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaClassJSC.cpp | 10 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp | 6 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaStringJSC.h | 18 | ||||
-rw-r--r-- | WebCore/bridge/jni/v8/JavaClassV8.h | 2 | ||||
-rw-r--r-- | WebCore/bridge/jsc/BridgeJSC.h | 6 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_class.mm | 14 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_instance.mm | 4 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_runtime.mm | 2 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_class.cpp | 5 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_runtime.cpp | 22 | ||||
-rw-r--r-- | WebCore/bridge/runtime_array.cpp | 6 |
21 files changed, 82 insertions, 81 deletions
diff --git a/WebCore/bridge/IdentifierRep.cpp b/WebCore/bridge/IdentifierRep.cpp index bc599de..fed47ca 100644 --- a/WebCore/bridge/IdentifierRep.cpp +++ b/WebCore/bridge/IdentifierRep.cpp @@ -78,7 +78,7 @@ IdentifierRep* IdentifierRep::get(int intID) return result.first->second; } -typedef HashMap<RefPtr<JSC::UString::Rep>, IdentifierRep*> StringIdentifierMap; +typedef HashMap<RefPtr<StringImpl>, IdentifierRep*> StringIdentifierMap; static StringIdentifierMap& stringIdentifierMap() { @@ -93,7 +93,7 @@ IdentifierRep* IdentifierRep::get(const char* name) return 0; UString string = stringToUString(String::fromUTF8WithLatin1Fallback(name, strlen(name))); - pair<StringIdentifierMap::iterator, bool> result = stringIdentifierMap().add(string.rep(), 0); + pair<StringIdentifierMap::iterator, bool> result = stringIdentifierMap().add(string.impl(), 0); if (result.second) { ASSERT(!result.first->second); result.first->second = new IdentifierRep(name); diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp index d454c74..17270eb 100644 --- a/WebCore/bridge/NP_jsobject.cpp +++ b/WebCore/bridge/NP_jsobject.cpp @@ -474,7 +474,7 @@ bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count NPIdentifier* identifiers = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier) * size)); for (unsigned i = 0; i < size; ++i) - identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().data()); + identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().utf8().data()); *identifier = identifiers; *count = size; diff --git a/WebCore/bridge/c/c_class.cpp b/WebCore/bridge/c/c_class.cpp index ea71638..f4ae5ca 100644 --- a/WebCore/bridge/c/c_class.cpp +++ b/WebCore/bridge/c/c_class.cpp @@ -75,20 +75,20 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance { MethodList methodList; - Method* method = _methods.get(identifier.ustring().rep()); + Method* method = _methods.get(identifier.ustring().impl()); if (method) { methodList.append(method); return methodList; } - NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii()); + NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data()); const CInstance* inst = static_cast<const CInstance*>(instance); NPObject* obj = inst->getObject(); if (_isa->hasMethod && _isa->hasMethod(obj, ident)){ Method* aMethod = new CMethod(ident); // deleted in the CClass destructor { JSLock lock(SilenceAssertionsOnly); - _methods.set(identifier.ustring().rep(), aMethod); + _methods.set(identifier.ustring().impl(), aMethod); } methodList.append(aMethod); } @@ -98,18 +98,18 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance Field* CClass::fieldNamed(const Identifier& identifier, Instance* instance) const { - Field* aField = _fields.get(identifier.ustring().rep()); + Field* aField = _fields.get(identifier.ustring().impl()); if (aField) return aField; - NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii()); + NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data()); const CInstance* inst = static_cast<const CInstance*>(instance); NPObject* obj = inst->getObject(); if (_isa->hasProperty && _isa->hasProperty(obj, ident)){ aField = new CField(ident); // deleted in the CClass destructor { JSLock lock(SilenceAssertionsOnly); - _fields.set(identifier.ustring().rep(), aField); + _fields.set(identifier.ustring().impl(), aField); } } return aField; diff --git a/WebCore/bridge/c/c_utility.cpp b/WebCore/bridge/c/c_utility.cpp index 443ecca..b160f9f 100644 --- a/WebCore/bridge/c/c_utility.cpp +++ b/WebCore/bridge/c/c_utility.cpp @@ -74,7 +74,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) if (value.isString()) { UString ustring = value.toString(exec); - CString cstring = ustring.UTF8String(); + CString cstring = ustring.utf8(); NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) }; NPN_InitializeVariantWithStringCopy(result, &string); } else if (value.isNumber()) { diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp index 35a0d34..8fa2678 100644 --- a/WebCore/bridge/jni/JNIBridge.cpp +++ b/WebCore/bridge/jni/JNIBridge.cpp @@ -41,7 +41,7 @@ using namespace WebCore; JavaParameter::JavaParameter(JNIEnv* env, jstring type) { m_type = JavaString(env, type); - m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + m_JNIType = JNITypeFromClassName(m_type.utf8()); } JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod) @@ -55,7 +55,7 @@ JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod) env->DeleteLocalRef(returnType); } m_returnType = JavaString(env, returnTypeName); - m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String()); + m_JNIReturnType = JNITypeFromClassName(m_returnType.utf8()); env->DeleteLocalRef(returnTypeName); // Get method name @@ -148,7 +148,7 @@ const char* JavaMethod::signature() const } signatureBuilder.append(")"); - const char* returnType = m_returnType.UTF8String(); + const char* returnType = m_returnType.utf8(); if (m_JNIReturnType == array_type) appendClassName(signatureBuilder, returnType); else { @@ -174,7 +174,7 @@ JNIType JavaMethod::JNIReturnType() const jmethodID JavaMethod::methodID(jobject obj) const { if (!m_methodID) - m_methodID = getMethodID(obj, m_name.UTF8String(), signature()); + m_methodID = getMethodID(obj, m_name.utf8(), signature()); return m_methodID; } diff --git a/WebCore/bridge/jni/JNIBridge.h b/WebCore/bridge/jni/JNIBridge.h index 78202ae..4f5e6b7 100644 --- a/WebCore/bridge/jni/JNIBridge.h +++ b/WebCore/bridge/jni/JNIBridge.h @@ -61,7 +61,7 @@ public: m_impl.init(getJNIEnv(), s); } - const char* UTF8String() const { return m_impl.UTF8String(); } + const char* utf8() const { return m_impl.utf8(); } const jchar* uchars() const { return m_impl.uchars(); } int length() const { return m_impl.length(); } #if USE(JSC) @@ -78,7 +78,7 @@ public: JavaParameter(JNIEnv*, jstring type); virtual ~JavaParameter() { } - RuntimeType type() const { return m_type.UTF8String(); } + RuntimeType type() const { return m_type.utf8(); } JNIType getJNIType() const { return m_JNIType; } private: @@ -92,7 +92,7 @@ public: ~JavaMethod(); const JavaString& name() const { return m_name; } - RuntimeType returnType() const { return m_returnType.UTF8String(); } + RuntimeType returnType() const { return m_returnType.utf8(); } JavaParameter* parameterAt(int i) const { return &m_parameters[i]; } int numParameters() const { return m_numParameters; } diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 7793070..d7d3a54 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -276,7 +276,7 @@ RootObject* JavaJSObject::rootObject() const jobject JavaJSObject::call(jstring methodName, jobjectArray args) const { - LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -305,7 +305,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const jobject JavaJSObject::eval(jstring script) const { - LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).UTF8String()); + LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).utf8()); JSValue result; @@ -332,7 +332,7 @@ jobject JavaJSObject::eval(jstring script) const jobject JavaJSObject::getMember(jstring memberName) const { - LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -348,7 +348,7 @@ jobject JavaJSObject::getMember(jstring memberName) const void JavaJSObject::setMember(jstring memberName, jobject value) const { - LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).UTF8String(), value); + LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).utf8(), value); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -364,7 +364,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const void JavaJSObject::removeMember(jstring memberName) const { - LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -500,7 +500,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const } else if (value.isString()) { UString stringValue = value.toString(exec); JNIEnv *env = getJNIEnv(); - result = env->NewString ((const jchar *)stringValue.data(), stringValue.size()); + result = env->NewString ((const jchar *)stringValue.characters(), stringValue.length()); } else if (value.isBoolean()) { jclass JSObjectClass = env->FindClass ("java/lang/Boolean"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V"); @@ -572,7 +572,7 @@ JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) // created above to wrap internal browser objects. The constructor of this class takes the native // pointer and stores it in this object, so that it can be retrieved below. jstring className = (jstring)callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;"); - if (!className || (strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject") != 0)) { + if (!className || (strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject") != 0)) { JSLock lock(SilenceAssertionsOnly); return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); } diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index d5dc1cb..8a34ced 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -49,7 +49,7 @@ JavaField::JavaField(JNIEnv* env, jobject aField) fieldTypeName = env->NewStringUTF("<Unknown>"); m_type = JavaString(env, fieldTypeName); - m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + m_JNIType = JNITypeFromClassName(m_type.utf8()); // Get field name jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;")); @@ -150,7 +150,7 @@ JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const break; } - LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).UTF8String().data(), jsresult.toString(exec).ascii()); + LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).utf8().data(), jsresult.toString(exec).ascii().data()); return jsresult; } @@ -186,7 +186,7 @@ void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue a const JavaInstance* instance = static_cast<const JavaInstance*>(i); jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_JNIType, type()); - LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).UTF8String().data(), aValue.toString(exec).ascii()); + LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).utf8().data(), aValue.toString(exec).ascii().data()); switch (m_JNIType) { case array_type: diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h index dd65417..afb1bce 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h @@ -45,7 +45,7 @@ public: virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const; const JavaString& name() const { return m_name; } - virtual RuntimeType type() const { return m_type.UTF8String(); } + virtual RuntimeType type() const { return m_type.utf8(); } JNIType getJNIType() const { return m_JNIType; } diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp index 2048d8e..2fb72e9 100644 --- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp @@ -63,7 +63,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray JSValue item = jsArray->get(exec, i); UString stringValue = item.toString(exec); env->SetObjectArrayElement(jarray, i, - env->functions->NewString(env, (const jchar *)stringValue.data(), stringValue.size())); + env->functions->NewString(env, (const jchar *)stringValue.characters(), stringValue.length())); } } break; @@ -98,8 +98,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray JSValue item = jsArray->get(exec, i); UString stringValue = item.toString(exec); jchar value = 0; - if (stringValue.size() > 0) - value = ((const jchar*)stringValue.data())[0]; + if (stringValue.length() > 0) + value = ((const jchar*)stringValue.characters())[0]; env->SetCharArrayRegion((jcharArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -218,7 +218,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val if (value.isString()) { UString stringValue = asString(value)->value(exec); JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } else if (value.isNumber()) { double doubleValue = value.uncheckedGetNumber(); @@ -237,7 +237,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val } else if (value.isUndefined()) { UString stringValue = "undefined"; JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } } @@ -248,7 +248,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val if (!value.isNull()) { UString stringValue = value.toString(exec); JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } } diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp index 780c4fc..43cdc96 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp @@ -63,7 +63,7 @@ JavaClass::JavaClass(jobject anInstance) JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { JSLock lock(SilenceAssertionsOnly); - m_fields.set(((UString)aField->name()).rep(), aField); + m_fields.set(((UString)aField->name()).impl(), aField); } env->DeleteLocalRef(aJField); } @@ -80,10 +80,10 @@ JavaClass::JavaClass(jobject anInstance) { JSLock lock(SilenceAssertionsOnly); - methodList = m_methods.get(((UString)aMethod->name()).rep()); + methodList = m_methods.get(((UString)aMethod->name()).impl()); if (!methodList) { methodList = new MethodList(); - m_methods.set(((UString)aMethod->name()).rep(), methodList); + m_methods.set(((UString)aMethod->name()).impl(), methodList); } } methodList->append(aMethod); @@ -115,7 +115,7 @@ JavaClass::~JavaClass() MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const { - MethodList* methodList = m_methods.get(identifier.ustring().rep()); + MethodList* methodList = m_methods.get(identifier.ustring().impl()); if (methodList) return *methodList; @@ -124,7 +124,7 @@ MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) cons Field* JavaClass::fieldNamed(const Identifier& identifier, Instance*) const { - return m_fields.get(identifier.ustring().rep()); + return m_fields.get(identifier.ustring().impl()); } bool JavaClass::isNumberClass() const diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp index 2c9a4ad..1e584af 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -167,14 +167,14 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod } const JavaMethod* jMethod = static_cast<const JavaMethod*>(method); - LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).UTF8String().data(), jMethod->signature(), m_instance->m_instance); + LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).utf8().data(), jMethod->signature(), m_instance->m_instance); Vector<jvalue> jArgs(count); for (i = 0; i < count; i++) { JavaParameter* aParameter = jMethod->parameterAt(i); jArgs[i] = convertValueToJValue(exec, m_rootObject.get(), exec->argument(i), aParameter->getJNIType(), aParameter->type()); - LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii()); + LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii().data()); } jvalue result; @@ -258,7 +258,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod else { jobject classOfInstance = callJNIMethod<jobject>(result.l, "getClass", "()Ljava/lang/Class;"); jstring className = static_cast<jstring>(callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;")); - if (!strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject")) { + if (!strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject")) { // Pull the nativeJSObject value from the Java instance. This is a pointer to the JSObject. JNIEnv* env = getJNIEnv(); jfieldID fieldID = env->GetFieldID(static_cast<jclass>(classOfInstance), "nativeJSObject", "J"); diff --git a/WebCore/bridge/jni/jsc/JavaStringJSC.h b/WebCore/bridge/jni/jsc/JavaStringJSC.h index 0a7dad5..cf575b2 100644 --- a/WebCore/bridge/jni/jsc/JavaStringJSC.h +++ b/WebCore/bridge/jni/jsc/JavaStringJSC.h @@ -40,13 +40,13 @@ public: ~JavaStringImpl() { JSLock lock(SilenceAssertionsOnly); - m_rep = 0; + m_impl = 0; } void init() { JSLock lock(SilenceAssertionsOnly); - m_rep = UString().rep(); + m_impl = UString().impl(); } void init(JNIEnv* e, jstring s) @@ -55,25 +55,25 @@ public: const jchar* uc = getUCharactersFromJStringInEnv(e, s); { JSLock lock(SilenceAssertionsOnly); - m_rep = UString(reinterpret_cast<const UChar*>(uc), size).rep(); + m_impl = UString(reinterpret_cast<const UChar*>(uc), size).impl(); } releaseUCharactersForJStringInEnv(e, s, uc); } - const char* UTF8String() const + const char* utf8() const { if (!m_utf8String.data()) { JSLock lock(SilenceAssertionsOnly); - m_utf8String = UString(m_rep).UTF8String(); + m_utf8String = UString(m_impl).utf8(); } return m_utf8String.data(); } - const jchar* uchars() const { return (const jchar*)m_rep->characters(); } - int length() const { return m_rep->length(); } - UString uString() const { return UString(m_rep); } + const jchar* uchars() const { return (const jchar*)m_impl->characters(); } + int length() const { return m_impl->length(); } + UString uString() const { return UString(m_impl); } private: - RefPtr<UString::Rep> m_rep; + RefPtr<StringImpl> m_impl; mutable CString m_utf8String; }; diff --git a/WebCore/bridge/jni/v8/JavaClassV8.h b/WebCore/bridge/jni/v8/JavaClassV8.h index b7447b2..0c1d627 100644 --- a/WebCore/bridge/jni/v8/JavaClassV8.h +++ b/WebCore/bridge/jni/v8/JavaClassV8.h @@ -28,9 +28,9 @@ #include "JNIBridgeV8.h" #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace JSC { diff --git a/WebCore/bridge/jsc/BridgeJSC.h b/WebCore/bridge/jsc/BridgeJSC.h index 44ce4d1..9cc9140 100644 --- a/WebCore/bridge/jsc/BridgeJSC.h +++ b/WebCore/bridge/jsc/BridgeJSC.h @@ -140,9 +140,9 @@ protected: const char* signatureForParameters(const ArgList&); -typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap; -typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap; -typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap; +typedef HashMap<RefPtr<StringImpl>, MethodList*> MethodListMap; +typedef HashMap<RefPtr<StringImpl>, Method*> MethodMap; +typedef HashMap<RefPtr<StringImpl>, Field*> FieldMap; } // namespace Bindings diff --git a/WebCore/bridge/objc/objc_class.mm b/WebCore/bridge/objc/objc_class.mm index 62f0a34..2d29499 100644 --- a/WebCore/bridge/objc/objc_class.mm +++ b/WebCore/bridge/objc/objc_class.mm @@ -78,11 +78,11 @@ MethodList ObjcClass::methodsNamed(const Identifier& identifier, Instance*) cons MethodList methodList; char fixedSizeBuffer[1024]; char* buffer = fixedSizeBuffer; - const char* JSName = identifier.ascii(); - if (!convertJSMethodNameToObjc(JSName, buffer, sizeof(fixedSizeBuffer))) { - int length = strlen(JSName) + 1; + CString jsName = identifier.ascii(); + if (!convertJSMethodNameToObjc(jsName.data(), buffer, sizeof(fixedSizeBuffer))) { + int length = jsName.length() + 1; buffer = new char[length]; - if (!buffer || !convertJSMethodNameToObjc(JSName, buffer, length)) + if (!buffer || !convertJSMethodNameToObjc(jsName.data(), buffer, length)) return methodList; } @@ -153,8 +153,8 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c { ClassStructPtr thisClass = _isa; - const char* name = identifier.ascii(); - RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII)); + CString jsName = identifier.ascii(); + RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII)); Field* aField = (Field*)CFDictionaryGetValue(_fields.get(), fieldName.get()); if (aField) return aField; @@ -220,7 +220,7 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c if ([thisClass respondsToSelector:@selector(webScriptNameForKey:)]) mappedName = [thisClass webScriptNameForKey:objcIvarName]; - if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, name) == 0) { + if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, jsName.data()) == 0) { aField = new ObjcField(objcIVar); // deleted when the dictionary is destroyed CFDictionaryAddValue(_fields.get(), fieldName.get(), aField); break; diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 2b518b1..6c56458 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -391,7 +391,7 @@ bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier& p ObjcValue objcValue = convertValueToObjcValue(exec, aValue, ObjcObjectType); @try { - [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]]; + [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]]; } @catch(NSException* localException) { // Do nothing. Class did not override valueForUndefinedKey:. } @@ -417,7 +417,7 @@ JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier setGlobalException(nil); @try { - id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]]; + id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]]; result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, m_rootObject.get()); } @catch(NSException* localException) { // Do nothing. Class did not override valueForUndefinedKey:. diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index e86cb1e..3c4ba23 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -237,7 +237,7 @@ static EncodedJSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) ObjcClass* objcClass = static_cast<ObjcClass*>(objcInstance->getClass()); OwnPtr<ObjcMethod> fallbackMethod(new ObjcMethod(objcClass->isa(), @selector(invokeUndefinedMethodFromWebScript:withArguments:))); const Identifier& nameIdentifier = static_cast<ObjcFallbackObjectImp*>(exec->callee())->propertyName(); - RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.data(), nameIdentifier.size())); + RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.characters(), nameIdentifier.length())); fallbackMethod->setJavaScriptName(name.get()); result = objcInstance->invokeObjcMethod(exec, fallbackMethod.get()); } diff --git a/WebCore/bridge/qt/qt_class.cpp b/WebCore/bridge/qt/qt_class.cpp index d809c81..4c29c69 100644 --- a/WebCore/bridge/qt/qt_class.cpp +++ b/WebCore/bridge/qt/qt_class.cpp @@ -71,8 +71,7 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, const Identifie QtInstance* qtinst = static_cast<QtInstance*>(inst); const UString& ustring = identifier.ustring(); - const QByteArray name = QString(reinterpret_cast<const QChar*>(ustring.data()), - ustring.size()).toAscii(); + const QByteArray name = QString(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()).toAscii(); // First see if we have a cache hit JSObject* val = qtinst->m_methods.value(name); @@ -131,7 +130,7 @@ Field* QtClass::fieldNamed(const Identifier& identifier, Instance* instance) con QObject* obj = qtinst->getObject(); const UString& ustring = identifier.ustring(); - const QString name(reinterpret_cast<const QChar*>(ustring.data()), ustring.size()); + const QString name(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()); const QByteArray ascii = name.toAscii(); // First check for a cached field diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index b9cf4b0..6881c2e 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -310,7 +310,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 6; } else { UString str = value.toString(exec); - ret = QVariant(QChar(str.size() ? *(const ushort*)str.rep()->characters() : 0)); + ret = QVariant(QChar(str.length() ? *(const ushort*)str.impl()->characters() : 0)); if (type == String) dist = 3; else @@ -325,7 +325,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type return QString(); } else { UString ustring = value.toString(exec); - ret = QVariant(QString((const QChar*)ustring.rep()->characters(), ustring.size())); + ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length())); if (type == String) dist = 0; else @@ -349,7 +349,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist >= 0) { UString ustring = (*it).ustring(); - QString id = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString id = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.insert(id, v); } } @@ -424,7 +424,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); UString ustring = val.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.append(qstring); } @@ -438,7 +438,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); UString ustring = val.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.append(qstring); } @@ -447,7 +447,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } else { // Make a single length array UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); QStringList result; result.append(qstring); ret = QVariant(result); @@ -463,7 +463,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 0; } else { UString ustring = value.toString(exec); - ret = QVariant(QString((const QChar*)ustring.rep()->characters(), ustring.size()).toLatin1()); + ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length()).toLatin1()); if (type == String) dist = 5; else @@ -503,9 +503,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type ret = QTime(gdt.hour, gdt.minute, gdt.second); dist = 10; } +#ifndef QT_NO_DATESTRING } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); if (hint == QMetaType::QDateTime) { QDateTime dt = QDateTime::fromString(qstring, Qt::ISODate); @@ -544,6 +545,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 3; } } +#endif // QT_NO_DATESTRING } break; @@ -554,7 +556,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type */ // Attempt to convert.. a bit risky UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); // this is of the form '/xxxxxx/i' int firstSlash = qstring.indexOf(QLatin1Char('/')); @@ -574,7 +576,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); QRegExp re(qstring); if (re.isValid()) { diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp index 2cd7d66..ca12f48 100644 --- a/WebCore/bridge/runtime_array.cpp +++ b/WebCore/bridge/runtime_array.cpp @@ -82,7 +82,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState* exec, const Identifier& propert } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { if (index < getLength()) { slot.setCustomIndex(this, index, indexGetter); @@ -103,7 +103,7 @@ bool RuntimeArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& p } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { if (index < getLength()) { PropertySlot slot; @@ -134,7 +134,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { getConcreteArray()->setValueAt(exec, index, value); return; |