Changeset 160572 in webkit
- Timestamp:
- Dec 13, 2013 3:59:14 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160566 r160572 1 2013-12-13 Sam Weinig <sam@webkit.org> 2 3 [WK2] Start removing calls to String::characters() 4 https://bugs.webkit.org/show_bug.cgi?id=125699 5 6 Reviewed by Anders Carlsson. 7 8 * Shared/mac/WebCoreArgumentCodersMac.mm: 9 (CoreIPC::::decodePlatformData): 10 * UIProcess/Plugins/PluginInfoStore.cpp: 11 (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin): 12 (WebKit::PluginInfoStore::findPlugin): 13 * UIProcess/Plugins/PluginInfoStore.h: 14 * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: 15 (WebKit::PluginInfoStore::pluginsDirectories): 16 (WebKit::PluginInfoStore::pluginPathsInDirectory): 17 * UIProcess/cf/WebPreferencesCF.cpp: 18 (WebKit::makeKey): 19 * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: 20 (WebKit::InjectedBundle::load): 21 * WebProcess/WebPage/WebPage.cpp: 22 (WebKit::WebPage::loadStringImpl): 23 (WebKit::WebPage::loadHTMLString): 24 (WebKit::WebPage::loadAlternateHTMLString): 25 (WebKit::WebPage::loadPlainTextString): 26 (WebKit::WebPage::loadWebArchiveData): 27 * WebProcess/WebPage/WebPage.h: 28 1 29 2013-12-13 Enrica Casucci <enrica@apple.com> 2 30 -
trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
r160487 r160572 165 165 } 166 166 167 static NSString* nsString(const String& string)168 {169 return string.impl() ? [NSString stringWithCharacters:reinterpret_cast<const UniChar*>(string.characters()) length:string.length()] : @"";170 }171 172 167 void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) 173 168 { … … 242 237 } 243 238 244 RetainPtr<NSError> nsError = adoptNS([[NSError alloc] initWithDomain: nsString(domain)code:code userInfo:(NSDictionary *)userInfo.get()]);239 RetainPtr<NSError> nsError = adoptNS([[NSError alloc] initWithDomain:domain code:code userInfo:(NSDictionary *)userInfo.get()]); 245 240 246 241 resourceError = ResourceError(nsError.get()); -
trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
r156550 r160572 177 177 return PluginModuleLoadNormally; 178 178 } 179 180 String PluginInfoStore::getMIMETypeForExtension(const String& extension)181 {182 return MIMETypeRegistry::getMIMETypeForExtension(extension);183 }184 179 185 180 PluginModuleInfo PluginInfoStore::findPluginWithBundleIdentifier(const String&) … … 210 205 211 206 // Finally, try to get the MIME type from the extension in a platform specific manner and use that. 212 String extensionMimeType = getMIMETypeForExtension(extension);207 String extensionMimeType = MIMETypeRegistry::getMIMETypeForExtension(extension); 213 208 if (!extensionMimeType.isNull()) { 214 209 PluginModuleInfo plugin = findPluginForMIMEType(extensionMimeType, allowedPluginTypes); -
trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
r156550 r160572 101 101 static bool shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo&); 102 102 103 // Get the MIME type for the given extension.104 static String getMIMETypeForExtension(const String& extension);105 106 103 Vector<String> m_additionalPluginsDirectories; 107 104 Vector<PluginModuleInfo> m_plugins; -
trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
r156598 r160572 48 48 return pluginsDirectories; 49 49 } 50 51 // FIXME: Once the UI process knows the difference between the main thread and the web thread we can drop this and just use52 // String::createCFString.53 static CFStringRef safeCreateCFString(const String& string)54 {55 return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(string.characters()), string.length());56 }57 50 58 51 Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) … … 60 53 Vector<String> pluginPaths; 61 54 62 RetainPtr<CFStringRef> directoryCFString = adoptCF(safeCreateCFString(directory)); 63 55 RetainPtr<CFStringRef> directoryCFString = directory.createCFString(); 64 56 NSArray *filenames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:(NSString *)directoryCFString.get() error:nil]; 65 57 for (NSString *filename in filenames) … … 114 106 } 115 107 116 String PluginInfoStore::getMIMETypeForExtension(const String& extension)117 {118 // FIXME: This should just call MIMETypeRegistry::getMIMETypeForExtension and be119 // strength reduced into the callsite once we can safely convert String120 // to CFStringRef off the main thread.121 122 RetainPtr<CFStringRef> extensionCFString = adoptCF(safeCreateCFString(extension));123 return WKGetMIMETypeForExtension((NSString *)extensionCFString.get());124 }125 126 108 PluginModuleInfo PluginInfoStore::findPluginWithBundleIdentifier(const String& bundleIdentifier) 127 109 { -
trunk/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp
r149255 r160572 34 34 namespace WebKit { 35 35 36 static RetainPtr<CFStringRef> cfStringFromWebCoreString(const String& string)37 {38 return RetainPtr<CFStringRef> = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(string.characters()), string.length()));39 }40 41 36 static inline RetainPtr<CFStringRef> makeKey(const String& identifier, const String& baseKey) 42 37 { 43 return cfStringFromWebCoreString(makeString(identifier, ".WebKit2", baseKey));38 return makeString(identifier, ".WebKit2", baseKey).createCFString(); 44 39 } 45 40 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm
r160291 r160572 56 56 } 57 57 58 RetainPtr<CFStringRef> injectedBundlePathStr = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(m_path.characters()), m_path.length()));58 RetainPtr<CFStringRef> injectedBundlePathStr = m_path.createCFString(); 59 59 if (!injectedBundlePathStr) { 60 60 WTFLogAlways("InjectedBundle::load failed - Could not create the path string.\n"); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r160566 r160572 918 918 } 919 919 920 void WebPage::loadString(const String& htmlString, const String& MIMEType, const URL& baseURL, const URL& unreachableURL, CoreIPC::MessageDecoder& decoder) 921 { 922 if (htmlString.is8Bit()) { 923 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters8()), htmlString.length() * sizeof(LChar)); 924 loadDataImpl(sharedBuffer, MIMEType, ASCIILiteral("utf-8"), baseURL, unreachableURL, decoder); 925 } else { 926 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters16()), htmlString.length() * sizeof(UChar)); 927 loadDataImpl(sharedBuffer, MIMEType, ASCIILiteral("utf-16"), baseURL, unreachableURL, decoder); 928 } 929 } 930 920 931 void WebPage::loadData(const CoreIPC::DataReference& data, const String& MIMEType, const String& encodingName, const String& baseURLString, CoreIPC::MessageDecoder& decoder) 921 932 { … … 927 938 void WebPage::loadHTMLString(const String& htmlString, const String& baseURLString, CoreIPC::MessageDecoder& decoder) 928 939 { 929 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar));930 940 URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString); 931 load DataImpl(sharedBuffer, "text/html", "utf-16", baseURL, URL(), decoder);941 loadString(htmlString, ASCIILiteral("text/html"), baseURL, URL(), decoder); 932 942 } 933 943 934 944 void WebPage::loadAlternateHTMLString(const String& htmlString, const String& baseURLString, const String& unreachableURLString, CoreIPC::MessageDecoder& decoder) 935 945 { 936 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar));937 946 URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString); 938 947 URL unreachableURL = unreachableURLString.isEmpty() ? URL() : URL(URL(), unreachableURLString); 939 load DataImpl(sharedBuffer, "text/html", "utf-16", baseURL, unreachableURL, decoder);948 loadString(htmlString, ASCIILiteral("text/html"), baseURL, unreachableURL, decoder); 940 949 } 941 950 942 951 void WebPage::loadPlainTextString(const String& string, CoreIPC::MessageDecoder& decoder) 943 952 { 944 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(string.characters()), string.length() * sizeof(UChar)); 945 loadDataImpl(sharedBuffer, "text/plain", "utf-16", blankURL(), URL(), decoder); 953 loadString(string, ASCIILiteral("text/plain"), blankURL(), URL(), decoder); 946 954 } 947 955 … … 949 957 { 950 958 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(webArchiveData.data()), webArchiveData.size() * sizeof(uint8_t)); 951 loadDataImpl(sharedBuffer, "application/x-webarchive", "utf-16", blankURL(), URL(), decoder);959 loadDataImpl(sharedBuffer, ASCIILiteral("application/x-webarchive"), ASCIILiteral("utf-16"), blankURL(), URL(), decoder); 952 960 } 953 961 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r160566 r160572 701 701 702 702 void loadDataImpl(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, CoreIPC::MessageDecoder&); 703 void loadString(const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, CoreIPC::MessageDecoder&); 703 704 704 705 bool platformHasLocalDataForURL(const WebCore::URL&);
Note: See TracChangeset
for help on using the changeset viewer.